Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

EXPO useEffect not called on navigating to same screen

import { useFocusEffect } from '@react-navigation/native';

const x = ({ navigation}) => {
    
   useFocusEffect(
     React.useCallback(() => {
      // called when screen is focused, thus everytime on navigation
      return () => {
        // unfocus... cleanup ... or whatever
      };
    }, [])
  );

   ...

   return (
    <View style={styles.a}>
            ...    
   </View>
  );
};

export default x;
 
PREVIOUS NEXT
Tagged: #EXPO #useEffect #called #navigating #screen
ADD COMMENT
Topic
Name
4+5 =