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

Disable pre-rendering the screens #11084

Closed
5 of 14 tasks
nightspite opened this issue Dec 8, 2022 · 7 comments
Closed
5 of 14 tasks

Disable pre-rendering the screens #11084

nightspite opened this issue Dec 8, 2022 · 7 comments

Comments

@nightspite
Copy link

nightspite commented Dec 8, 2022

Current behavior

When navigating to a "heavy" screen (that uses a few useEffects) it kinda waits for them to be completed and then switch the screen. It happens on a development build done with expo.

Expected behavior

I handle animations & loading by myself, so I don't need to preload anything there. I believe it was the default behavior based on that issue react-navigation/rfcs#51, so I don't see why would it be removed, but I cannot find how to use it that way.

Reproduction

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/​bottom-tabs
  • @react-navigation/​drawer
  • @react-navigation/​material-bottom-tabs
  • @react-navigation/​material-top-tabs
  • @react-navigation/​stack
  • @react-navigation/​native-stack
  • react-native-tab-view
  • flipper-plugin-react-navigation

Environment

  • I've removed the packages that I don't use
package version
@react-navigation/native ^6.0.13
@react-navigation/native-stack ^6.9.0
react-native 0.69.6
expo ~46.0.17
node 16.18.1
yarn 3.2.4
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link, a www.typescriptlang.org/play link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

A repro will help us debug the issue. The issue will be closed automatically after a while if you don't provide a repro.

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Couldn't find version numbers for the following packages in the issue:

  • react-native-tab-view
  • flipper-plugin-react-navigation

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/native (found: 6.0.13, latest: 6.1.0)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

@github-actions
Copy link

github-actions bot commented Jan 8, 2023

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@github-actions github-actions bot added the stale label Jan 8, 2023
@gmerino92
Copy link

gmerino92 commented Jan 13, 2023

Having the same issue here on both dev client and standalone build. When using react-navigation on Expo SDK 45, navigation switches and then code is run. On update to Expo SDK 47, navigation waits for code on next screen to run before switching to it.

By the way, nothing in our codebase changed and the react navigation package versions being used stayed the same through the upgrade.

@github-actions github-actions bot removed the stale label Jan 14, 2023
@github-actions
Copy link

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@abumalick
Copy link

I used this dirty fix to launch navigation before rendering:

const isFirstRender = React.useRef(true);
  useFocusEffect(
    useCallback(() => {
      isFirstRender.current = false;
      return () => (isFirstRender.current = true);
    }, []),
  );
  if (isFirstRender.current) {
    return <Loading />;
  }

Copy link

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

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

No branches or pull requests

3 participants