Skip to content

Commit

Permalink
fix: undefined is not an object
Browse files Browse the repository at this point in the history
  • Loading branch information
tangimds committed Jun 2, 2022
1 parent 9b15be9 commit 2c45c9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scenes/onboarding/onboardingSymptomsCustom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CustomSymptomScreen = ({ navigation, route, settings = false }) => {
useEffect(() => {
(async () => {
const preselectedCategories = await localStorage.getSymptoms();
if (!Object.keys(preselectedCategories).length) {
if (!preselectedCategories || !Object.keys(preselectedCategories).length) {
return;
}

Expand Down Expand Up @@ -60,7 +60,7 @@ const CustomSymptomScreen = ({ navigation, route, settings = false }) => {
}, [settings]);

useEffect(() => {
if (chosenCategories === undefined) return;
if (!chosenCategories || chosenCategories === undefined) return;
(async () => {
const isCustom = (e) => !displayedCategories[e] && !INDICATEURS_LISTE.includes(e);
const isDefault = (e) => !!displayedCategories[e] || INDICATEURS_LISTE.includes(e);
Expand Down Expand Up @@ -128,7 +128,7 @@ const CustomSymptomScreen = ({ navigation, route, settings = false }) => {
</View>
<AjoutIndicateurPerso
onChange={(v) => {
if (Object.keys(chosenCategories).find((e) => e === v)) return;
if (Object.keys(chosenCategories || {}).find((e) => e === v)) return;
handleAddNewSymptom(v);
}}
/>
Expand Down

0 comments on commit 2c45c9c

Please sign in to comment.