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 (
@@ -69,6 +71,7 @@ const Activity = ({
}
}}
authToken={authToken}
+ onContentError={() => setContentError(true)}
/>
{!fullScreen && (
@@ -76,9 +79,18 @@ const Activity = ({
)}
{
+ setContentError(false);
+ nextScreen();
+ }}
prevLabel={getPrevLabel(currentScreen, itemVisibility)}
prevEnabled={isPrevEnabled(currentScreen, activity)}
onPressPrev={prevScreen}
diff --git a/app/services/activityNavigation.js b/app/services/activityNavigation.js
index 076ad2bcf..9743f81be 100644
--- a/app/services/activityNavigation.js
+++ b/app/services/activityNavigation.js
@@ -42,10 +42,10 @@ export const getLastPos = (index, ar) => {
return -1;
};
-export const getNextLabel = (index, visibility, activity, responses) => {
+export const getNextLabel = (index, visibility, activity, responses, isContentError) => {
// If the screen is not valid, then the label is Skip
const isValid = checkValidity(activity.items[index], responses[index]);
- if (!isValid) {
+ if (!isValid || isContentError) {
return SKIP;
}
@@ -60,10 +60,10 @@ export const getNextLabel = (index, visibility, activity, responses) => {
};
// If item has a valid response, or is skippable, then next is enabled
-export const isNextEnabled = (index, activity, responses) => {
+export const isNextEnabled = (index, activity, responses, isContentError) => {
const isValid = checkValidity(activity.items[index], responses[index]);
const isSkippable = checkSkippable(activity, activity.items[index]);
- return isValid || isSkippable;
+ return isValid || isSkippable || isContentError;
};
export const isPrevEnabled = (index, activity) => {