diff --git a/app/components/ActivityScreens.js b/app/components/ActivityScreens.js index c9c373943..2f7e17c1d 100644 --- a/app/components/ActivityScreens.js +++ b/app/components/ActivityScreens.js @@ -39,6 +39,7 @@ class ActivityScreens extends React.PureComponent { currentScreen, onChange, authToken, + onContentError, } = this.props; const { activeScreens, direction } = this.state; return ( @@ -60,6 +61,7 @@ class ActivityScreens extends React.PureComponent { onChange={onChange} authToken={authToken} isCurrent={index === currentScreen} + onContentError={onContentError} /> ))} @@ -74,6 +76,7 @@ ActivityScreens.propTypes = { currentScreen: PropTypes.number.isRequired, authToken: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, + onContentError: PropTypes.func.isRequired, }; export default ActivityScreens; diff --git a/app/components/screen/Widget.js b/app/components/screen/Widget.js index d152dd44e..32ed1dd1d 100644 --- a/app/components/screen/Widget.js +++ b/app/components/screen/Widget.js @@ -21,7 +21,7 @@ import { } from '../../widgets'; import TimePicker from '../../widgets/TimeRange/TimePicker'; -const Widget = ({ screen, answer, onChange, isCurrent, onPress, onRelease }) => { +const Widget = ({ screen, answer, onChange, isCurrent, onPress, onRelease, onContentError }) => { if (screen.inputType === 'radio' && R.path(['valueConstraints', 'multipleChoice'], screen) === true) { return ( @@ -194,6 +194,8 @@ const Widget = ({ screen, answer, onChange, isCurrent, onPress, onRelease }) => if (screen.inputType === 'markdown-message') { return null; } + + onContentError(); return ; }; @@ -207,6 +209,7 @@ Widget.propTypes = { screen: PropTypes.object.isRequired, answer: PropTypes.any, onChange: PropTypes.func.isRequired, + onContentError: PropTypes.func.isRequired, isCurrent: PropTypes.bool.isRequired, onPress: PropTypes.func, onRelease: PropTypes.func, diff --git a/app/components/screen/index.js b/app/components/screen/index.js index 05d21562f..fc0102b08 100644 --- a/app/components/screen/index.js +++ b/app/components/screen/index.js @@ -132,7 +132,7 @@ class ActivityScreen extends Component { } render() { - const { screen, answer, onChange, isCurrent } = this.props; + const { screen, answer, onChange, isCurrent, onContentError } = this.props; const { scrollEnabled, inputDelayed, timerActive } = this.state; return ( @@ -174,6 +174,7 @@ class ActivityScreen extends Component { screen={screen} onPress={() => { this.setState({ scrollEnabled: false }); }} onRelease={() => { this.setState({ scrollEnabled: true }); }} + onContentError={onContentError} /> ) } @@ -196,6 +197,7 @@ ActivityScreen.propTypes = { screen: PropTypes.object.isRequired, answer: PropTypes.any, onChange: PropTypes.func.isRequired, + onContentError: PropTypes.func.isRequired, isCurrent: PropTypes.bool.isRequired, }; diff --git a/app/scenes/Activity/index.js b/app/scenes/Activity/index.js index d5d16ab6e..6f002494f 100644 --- a/app/scenes/Activity/index.js +++ b/app/scenes/Activity/index.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { StatusBar, View, StyleSheet } from 'react-native'; import { Container } from 'native-base'; import PropTypes from 'prop-types'; @@ -55,6 +55,8 @@ const Activity = ({ const fullScreen = currentItem.fullScreen || activity.fullScreen; const autoAdvance = currentItem.autoAdvance || activity.autoAdvance; + const [isContentError, setContentError] = useState(false); + return (