react-native-auto-scroll icon indicating copy to clipboard operation
react-native-auto-scroll copied to clipboard

Animation stoping when navigate to another screen

Open matheuscasavechia opened this issue 1 year ago • 6 comments

Hi everyone, I'm having a problem with te animation... I use the same component exporting it to use in another screen and the component is using AutoScroll, but when i navigate to another screen, and this has the component i'm exporting, the animation stop... Can you guys help me ?

matheuscasavechia avatar Aug 09 '22 20:08 matheuscasavechia

Can you provide me with a more accurate environment or code to check the issue?

bhyoo99 avatar Aug 10 '22 15:08 bhyoo99

�Can you provide me with a more accurate environment or code to check the issue?

Like, i have a component that is using the tag AutoScroll, and this component i use an many screen in my app. When i'm in the home screen of my app (in this screen i declare the component), and navigate to another screen, screen that have the component, the AutoScroll stop the scroll, to get the scroll work again i need to retry the same flow, many times until they appear start working again... but when i continue testing the scroll stop again and i need to do the flow again to get the component working again.

matheuscasavechia avatar Aug 10 '22 16:08 matheuscasavechia

@matheuscasavechia did you find solution about this error?

kmlrmdhn avatar Aug 24 '23 07:08 kmlrmdhn

I had the same problem and I fixed it by deleting the following code snippet from index.tsx:

React.useEffect(() => {
    return () => {
      contentRef.current = null;
    };
  });

Depending on how you setup your app, it appears that contentRef.current can be null even though you have data in your children components. React is apparently already setting contentRef.current to null when the component is unmounted.

julien-ctx avatar Sep 07 '23 11:09 julien-ctx

@julien-ctx it works, thanks man.

kmlrmdhn avatar Sep 13 '23 06:09 kmlrmdhn

I had the same problem and I fixed it by deleting the following code snippet from index.tsx:

React.useEffect(() => {
    return () => {
      contentRef.current = null;
    };
  });

Depending on how you setup your app, it appears that contentRef.current can be null even though you have data in your children components. React is apparently already setting contentRef.current to null when the component is unmounted.

Thank you. Can you help me by make a pull request?

minhtc avatar Sep 13 '23 12:09 minhtc