React useNavigation says can't perform a react state update on unmounted component

134 views Asked by At

onPressing The button navigation.goBack triggers the warning can't perform a react state update on unmounted component. I'm using react navigation 5 with useNavigation hook. can't find anything how to fix.

<View style={styles.left}>
    <TouchableRipple style={styles.back} borderless onPress={() => navigation.goBack()}>
        <View style={styles.alignContent}>
            <Icon
                iconStyle={{ left: -6 }}
                size={14}
                name="caretleft"
                type="antdesign"
                color={Colors.green[900]}
                containerStyle={{ paddingLeft: 5 }}
            />
            <Text style={{ ...styles.buttonTitle, left: -4, color: Colors.green[900] }}>Back</Text>
        </View>
    </TouchableRipple>
</View>
0

There are 0 answers