Skip to content

refactor!: disable child navigators handling actions by default#10905

Merged
satya164 merged 2 commits into7.xfrom
@satya164/navigation-in-child
Oct 11, 2022
Merged

refactor!: disable child navigators handling actions by default#10905
satya164 merged 2 commits into7.xfrom
@satya164/navigation-in-child

Conversation

@satya164
Copy link
Copy Markdown
Member

@satya164 satya164 commented Oct 4, 2022

Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with navigation.navigate(ScreenName) syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (navigation.navigate(ParentScreenName, { screen: ScreenName })).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 4, 2022

The Expo app for the example from this branch is ready!

expo.dev/@react-navigation/react-navigation-example?release-channel=pr-10905

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (7.x@53ffd98). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@          Coverage Diff           @@
##             7.x   #10905   +/-   ##
======================================
  Coverage       ?   75.27%           
======================================
  Files          ?      168           
  Lines          ?     5173           
  Branches       ?     2005           
======================================
  Hits           ?     3894           
  Misses         ?     1239           
  Partials       ?       40           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@satya164 satya164 force-pushed the @satya164/navigation-in-child branch from cdc8f11 to 6fa3de4 Compare October 9, 2022 14:10
)

This drops the `independent` prop from the container in favor of a component. In case of cases such as mini-apps, this allows the parent app to disconnect the child navigation tree from itself.

Another reason is that a lot of newbies added `independent` prop to avoid error and got confused when nested navigation didn't work. By moving it into a component and making it harder to do it accidentally, maybe this can be avoided.
@satya164 satya164 merged commit 7524c46 into 7.x Oct 11, 2022
@satya164 satya164 deleted the @satya164/navigation-in-child branch October 11, 2022 09:47
satya164 added a commit that referenced this pull request Oct 11, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Oct 11, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Nov 16, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Nov 16, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Nov 16, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Nov 18, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
josemak25 pushed a commit to josemak25/react-navigation that referenced this pull request Nov 21, 2022
…t-navigation#10905)

Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
satya164 added a commit that referenced this pull request Nov 28, 2022
Due to backward compatibility reasons, React Navigation 5 and 6 support navigating to a screen in a child navigator with `navigation.navigate(ScreenName)` syntax. But this is problematic with the new architecture - it only works if the navigator is already mounted, doesn't work with TypeScript, etc. That's why there's a special API to navigate to a nested screen (`navigation.navigate(ParentScreenName, { screen: ScreenName })`).

This drops this behavior and adds a prop to explicitly enable it to make it easier to migrate. This prop will be removed in the next major.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants