Skip to content

Add route params to Drawer screen component props #26

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/BottomTabs.re
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ module Make = (M: {type params;}) => {
~name: string,
~options: optionsCallback=?,
~initialParams: M.params=?,
~component: React.component({. "navigation": navigation}),
~component: React.component({
.
"navigation": navigation,
"route": route(M.params),
}),
unit
) =>
screenProps =
Expand Down
6 changes: 5 additions & 1 deletion src/Drawer.re
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ module Make = (M: {type params;}) => {
~name: string,
~options: optionsCallback=?,
~initialParams: M.params=?,
~component: React.component({. "navigation": navigation}),
~component: React.component({
.
"navigation": navigation,
"route": route(M.params),
}),
unit
) =>
screenProps =
Expand Down
2 changes: 1 addition & 1 deletion src/Example.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var $$Screen$1 = include$1.Screen;
var $$Navigator$1 = include$1.Navigator;

function Example$RootStackScreen(Props) {
return React.createElement(Native.NavigationNativeContainer, {
return React.createElement(Native.NavigationContainer, {
children: React.createElement($$Navigator$1.make, {
mode: "modal",
headerMode: "none",
Expand Down
4 changes: 2 additions & 2 deletions src/Example.re
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ module RootStackScreen = {
});
[@react.component]
let make = () =>
<Native.NavigationNativeContainer>
<Native.NavigationContainer>
<Navigator mode=`modal headerMode=`none>
<Screen name="Main" component=MainStackScreen.make />
<Screen name="MyModal" component=ModalScreen.make />
</Navigator>
</Native.NavigationNativeContainer>;
</Native.NavigationContainer>;
};
4 changes: 2 additions & 2 deletions src/Native.bs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';


var NavigationNativeContainer = { };
var NavigationContainer = { };

exports.NavigationNativeContainer = NavigationNativeContainer;
exports.NavigationContainer = NavigationContainer;
/* No side effect */
4 changes: 2 additions & 2 deletions src/Native.re
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
```
*/

module NavigationNativeContainer = {
module NavigationContainer = {
type state = Js.Json.t;
type navigationState = state => unit;

Expand All @@ -104,7 +104,7 @@ module NavigationNativeContainer = {
~children: React.element
) =>
React.element =
"NavigationNativeContainer";
"NavigationContainer";
};

[@bs.module "@react-navigation/native"]
Expand Down