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(native-stack): export NativeStackView to support custom routers on native-stack #10260

Merged
merged 6 commits into from
Jan 27, 2022

Conversation

AdityaPahilwani
Copy link
Contributor

Currently, there is no way to create a custom navigator and router on top of Native-Stack

So by exporting NativeStackView along with its types from native-stack, we can use it along with useNavigationBuilder to create custom navigators​ with some additional functionality built on top of it.

We can also use StackRouter from @react-navigation/native to create customised routers and use it with the navigator we created on top of NativeStackView.

We can follow the same doc to extend NativeStackView with our own router or build additional functionality on top of it.
https://reactnavigation.org/docs/custom-navigators#extending-navigators.

@github-actions
Copy link

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

@netlify
Copy link

netlify bot commented Jan 13, 2022

✔️ Deploy Preview for react-navigation-example ready!

🔨 Explore the source changes: 4353527

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-navigation-example/deploys/61f27e38a4d7dc0007613f32

😎 Browse the preview: https://deploy-preview-10260--react-navigation-example.netlify.app

@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2022

Codecov Report

Merging #10260 (b3df2c7) into main (82a1669) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10260   +/-   ##
=======================================
  Coverage   74.41%   74.41%           
=======================================
  Files         160      160           
  Lines        4858     4858           
  Branches     1838     1838           
=======================================
  Hits         3615     3615           
  Misses       1209     1209           
  Partials       34       34           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82a1669...b3df2c7. Read the comment docs.

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I think we don't need to export NativeStackNavigatorProps as you can already access it by React.ComponentProps<typeof NativeStackView>

Regarding exporting NativeStackNavigationEventMap, that's useful but currently, no other navigators export it (afaik). Could you add the export to other navigators as well? Then I'll be happy to merge the PR.

@AdityaPahilwani
Copy link
Contributor Author

Thanks for the review.
I have added exports for NavigationEventMap from other navigators.

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@satya164 satya164 enabled auto-merge (squash) January 27, 2022 11:02
@satya164 satya164 merged commit 7b761f1 into react-navigation:main Jan 27, 2022
MohamedLamineAllal pushed a commit to MohamedLamineAllal/react-navigation that referenced this pull request Feb 4, 2022
…on native-stack (react-navigation#10260)

Currently, there is no way to create a custom navigator and router on top of **Native-Stack**

So by exporting **NativeStackView** along with its types from native-stack, we can use it along with **useNavigationBuilder** to create custom navigators​ with some additional functionality built on top of it.

We can also use **StackRouter** from **@react-navigation/native** to create customised routers and use it with the navigator we created on top of **NativeStackView**.

We can follow the same doc to extend NativeStackView with our own router or build additional functionality on top of it.
https://reactnavigation.org/docs/custom-navigators#extending-navigators.

Co-authored-by: Aditya Pahilwani <aditya.pahilwani@groww.in>
MohamedLamineAllal pushed a commit to MohamedLamineAllal/react-navigation that referenced this pull request Feb 4, 2022
…on native-stack (react-navigation#10260)

Currently, there is no way to create a custom navigator and router on top of **Native-Stack**

So by exporting **NativeStackView** along with its types from native-stack, we can use it along with **useNavigationBuilder** to create custom navigators​ with some additional functionality built on top of it.

We can also use **StackRouter** from **@react-navigation/native** to create customised routers and use it with the navigator we created on top of **NativeStackView**.

We can follow the same doc to extend NativeStackView with our own router or build additional functionality on top of it.
https://reactnavigation.org/docs/custom-navigators#extending-navigators.

Co-authored-by: Aditya Pahilwani <aditya.pahilwani@groww.in>
MohamedLamineAllal pushed a commit to MohamedLamineAllal/react-navigation that referenced this pull request Feb 4, 2022
…on native-stack (react-navigation#10260)

Currently, there is no way to create a custom navigator and router on top of **Native-Stack**

So by exporting **NativeStackView** along with its types from native-stack, we can use it along with **useNavigationBuilder** to create custom navigators​ with some additional functionality built on top of it.

We can also use **StackRouter** from **@react-navigation/native** to create customised routers and use it with the navigator we created on top of **NativeStackView**.

We can follow the same doc to extend NativeStackView with our own router or build additional functionality on top of it.
https://reactnavigation.org/docs/custom-navigators#extending-navigators.

Co-authored-by: Aditya Pahilwani <aditya.pahilwani@groww.in>
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

4 participants