Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added integration for InteractionManager with native-stack #11887

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kirillzyusko
Copy link

Motivation

The integration with interactionManager was added in react-navigation@5 I believe (https://reactnavigation.org/blog/2020/02/06/react-navigation-5.0/#other-improvements).

And since then it was a convenient way to run tasks when animation gets finished.

Since react-navigation@6 it's recommended to use native-stack instead of stack. However it seems like InteractionManager doesn't take into consideration animations driven by native-stack. As a result all code that was relying on execution InteractionManager.runAfterInteractions callback after animation is broken when we switch to native-stack.

Test plan

The way to test the integration would be to add a code, like:

const [color, setColor] = useState("#000000");

const goToNextScreen = () => {
  navigation.navigate("NextScreenInStack");

  InteractionManager.runAfterInteractions(() => {
    setColor("#ff0000");
  });
};
  • Without these change the color would be changed immediately and you could see a change during the animation;
  • With these changes the callback will be executed only when animation gets completed.

Copy link

Hey @kirillzyusko! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 70eb555
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/65f0844e4c6a7b000820115b
😎 Deploy Preview https://deploy-preview-11887--react-navigation-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kirillzyusko
Copy link
Author

@satya164 may I kindly ask you to review these changes? 🙏 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant