Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react-navigation: Detect when screen, tabbar is activated / appear / focus / blur

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

function ProfileScreen() {
  useFocusEffect(
    React.useCallback(() => {

      alert('Screen was focused');

      return () => {

        alert('Screen was unfocused');
        // Useful for cleanup functions

      };
    }, [])
  );

  return <View />;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Detect #tabbar #activated #focus #blur
ADD COMMENT
Topic
Name
4+5 =