Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React native - 'Cant perform a react state update on an unmounted component'? Library not working?

$
0
0

Alright, Im following the most basic example from this RN animation library - https://popmotion.io/pose/learn/native-get-started/#get-started-setup and I dont know whats going on.

I can see my View, however Im getting the warning

Cant perform a react state update on an unmounted component

And NO animation occurs when I update states. The only difference between my file and example is Im using a functional component:

<View style={styles.cardContainer}><Box style={styles.box} pose={isVisible ? 'visible' : 'hidden'} /></View>

And

export default function App() {  let [fontsLoaded] = useFonts({'Inter-SemiBoldItalic': 'https://rsms.me/inter/font-files/Inter-SemiBoldItalic.otf?v=3.12',  });  useEffect(() => {    // Init  });//Set states and hooks  const [colorValue, setColorValue] = useState('#fff');  const [isVisible, setIsVisible] = useState('hidden');  const Box = posed.View({    visible: {      opacity: 1,      transition: { duration: 500 }  },    hidden: {      opacity: 0    }  });  useEffect(() => {    const interval = setInterval(() => {      setIsVisible('visible');      setColorValue('#ff0000');    }, 3000);    return () => clearInterval(interval);  }, []);

The box shows up as visible when I run my app, and no animation occurs. What is wrong here?


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>