diff --git a/src/screens/QuizzScreen.js b/src/screens/QuizzScreen.js
index 7676b01..9202c88 100644
--- a/src/screens/QuizzScreen.js
+++ b/src/screens/QuizzScreen.js
@@ -31,6 +31,12 @@ export default (props) => {
(level === Levels.ANY || level === question.level) &&
(checkedCategories.length === 0 || checkedCategories.includes(question.category)),
);
+ if (filteredQuestions.length === 0)
+ return (
+
+ {I18n.t('quizzScreen.noQuestions')}
+
+ );
const [selectedQuestions, _setSelectedQuestions] = useState(getRandomElementsFromArray(filteredQuestions, number));
const [current, setCurrent] = useState(1);
diff --git a/src/screens/__tests__/QuizzScreen.test.js b/src/screens/__tests__/QuizzScreen.test.js
index 4183eba..34a6e87 100644
--- a/src/screens/__tests__/QuizzScreen.test.js
+++ b/src/screens/__tests__/QuizzScreen.test.js
@@ -28,4 +28,19 @@ describe('', () => {
expect(toJSON()).toMatchSnapshot();
});
+
+ it('renders correctly with no questions', async () => {
+ const navigation = { setOptions: jest.fn() };
+ const route = {
+ params: {
+ number: 5,
+ time: 30,
+ level: Levels.DIFFICULT,
+ checkedCategories: [Categories.INDOOR],
+ },
+ };
+ const { toJSON, getByText } = render();
+
+ expect(toJSON()).toMatchSnapshot();
+ });
});
diff --git a/src/screens/__tests__/__snapshots__/QuizzScreen.test.js.snap b/src/screens/__tests__/__snapshots__/QuizzScreen.test.js.snap
index 3938376..c843645 100644
--- a/src/screens/__tests__/__snapshots__/QuizzScreen.test.js.snap
+++ b/src/screens/__tests__/__snapshots__/QuizzScreen.test.js.snap
@@ -1435,3 +1435,25 @@ exports[` renders correctly 3`] = `
`;
+
+exports[` renders correctly with no questions 1`] = `
+
+
+
+ We have no question matching your criteria.
+
+
+
+`;
diff --git a/src/utils/locales/en.js b/src/utils/locales/en.js
index 520dc25..1c66f97 100644
--- a/src/utils/locales/en.js
+++ b/src/utils/locales/en.js
@@ -98,6 +98,7 @@ export default {
one: '{{count}} correct answer',
other: '{{count}} correct answers',
},
+ noQuestions: 'We have no question matching your criteria.',
nextQuestion: 'Next question',
},
rulesScreen: {
diff --git a/src/utils/locales/fr.js b/src/utils/locales/fr.js
index 4ff6f67..bc4e3d8 100644
--- a/src/utils/locales/fr.js
+++ b/src/utils/locales/fr.js
@@ -98,6 +98,7 @@ export default {
one: '{{count}} bonne réponse',
other: '{{count}} bonnes réponses',
},
+ noQuestions: 'Aucune question ne correspond aux critères choisis.',
nextQuestion: 'Question suivante',
},
rulesScreen: {