0

I want to run my animations from react-native-reanimated everytime my screen is focused. How can I achieve this.

Sagar Karki
  • 399
  • 2
  • 8

1 Answers1

1

I am not sure whether I understand your question correctly, but in most cases you can use the useIsFocused hook from react navigation.

like this:

import React from "react";
import { useIsFocused } from '@react-navigation/native';

function YourScreenScreen() {
  const isFocused = useIsFocused();

   React.useEffect(() => {
    
   //put whatever you want here when the screen is focused

  }, [isFocused]);

  return <>......</>;
}

more reference here Hope this answers your question, Gl!