0

i hope you are doing well.

I made an app with React Native Expo.

I've deployed succesfully to Play Store and everything works, also works in IOS emulator and in a physical ios device using expo.

Now i have to record a video working in a real device in order to request the upload to Apple Store so I'm using TestFlight to install the .ipa but in a section of my app when I try to select a component parameter, the app crash but i have no idea about the reason.

The screen where the error occur :

const list = [
    {
        title: "Mettre à jour mes informations",
        icon: "information-circle-sharp",
        clickon: "signOutHandler1",
        nameScreen: "UpdateAccount",
    },
    {
        title: "Aide at assistance",
        icon: "help-circle",
        clickon: "signOutHandle4",
        nameScreen: "Help",
    },
    {
        title: "Nous contacter",
        icon: "mail",
        clickon: "signOutHandler5",
        nameScreen: "Contact",
    },
    {
        title: "Conditions générales d'utilisation",
        icon: "reader",
        clickon: "signOutHandler6",
        nameScreen: "TermsAndConditions",
    },
    {
        title: "Déconnexion",
        icon: "log-out",
        clickon: "signOutHandler",
        nameScreen: "",
    },
];

/**
 * Account screen
 *
 * @author [mamadou barry](alioufetowel@gmail.com)
 */
const AccountScreen = (props) => {
    /**
     * Error handling
     */
    const [error, setError] = useState();
    const [isLoading, setIsLoading] = useState(false);

    /**
     * Allow to call actions in order to update
     * The global state through redux
     */
    const dispatch = useDispatch();

    const loadFollowers = useCallback(async () => {
        setError(null);
        try {
            await dispatch(fetchFollowers());
        } catch (err) {
            setError(err.message);
        }
    }, [dispatch, setError]);
    /**
     * Hangling error when it occur
     */
    useEffect(() => {
        let mounted = true;
        setIsLoading(true);
        if (mounted && error) {
            console.log('Une erreur est survenue')
        }
        loadFollowers().then(() => {
            if (mounted) {
                setIsLoading(false);
            }
        });
        return () => (mounted = false);
    }, [error, dispatch, loadFollowers]);

    const userInfos = useSelector((state) => state.auth);
    const userAbonnements = useSelector((state) => state.followers.abonnements);
    const userAbonnes = useSelector((state) => state.followers.abonnes);
    const userEvents = useSelector((state) => state.events.userEvents);

    /**
     * Logout the user
     */
    const signOutHandler = async () => {
        setError(null);
        try {
            await dispatch(logout());
        } catch (err) {
            setError(err.message);
        }
    };

    onPressSubmitButton = (item) => {
        if (item.clickon === "signOutHandler") {
            return signOutHandler();
        } else return props.navigation.navigate(item.nameScreen);
    };

    if (!userInfos || isLoading) {
        return (
            <View style={styles.centered}>
                <ActivityIndicator size="large" color={Colors.primary500} />
            </View>
        );
    }

    return (
        <SafeAreaView style={styles.container}>
            <ScrollView>
                <View style={styles.optionAccount}>
                    {list.map((item, i) => (
                        <ListItem
                            key={i}
                            bottomDivider
                            onPress={() => onPressSubmitButton(item)}
                        >
                            <Ionicons
                                name={item.icon}
                                size={26}
                                color={Colors.primary500}
                            />
                            <ListItem.Content>
                                <ListItem.Title>{item.title}</ListItem.Title>
                            </ListItem.Content>
                            <FontAwesome5
                                name="chevron-right"
                                size={15}
                                color={Colors.primary500}
                            />
                        </ListItem>
                    ))}
                </View>
                <Text style={styles.appVersion}>
                    Version {app.expo.version}
                </Text>
            </ScrollView>
        </SafeAreaView>
    );
};

Hope anyone can help.

Thanks in advance.

Here is the log:

CrashLog1 Carasjlog2

emile kaba
  • 63
  • 4
  • check you got these values on first render state.followers,state.events or state . you can use "?" operator to prev crash e.g const userAbonnes = useSelector((state) => state?.followers?.abonnes); – Ragnar Dec 05 '22 at 05:25
  • Thank you for your answer. I try this but i got the same errors. – emile kaba Dec 05 '22 at 10:14

0 Answers0