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

Binding for Stack-component render-callback . #31

Closed
a-c-sreedhar-reddy opened this issue Jun 1, 2020 · 1 comment · Fixed by #32
Closed

Binding for Stack-component render-callback . #31

a-c-sreedhar-reddy opened this issue Jun 1, 2020 · 1 comment · Fixed by #32

Comments

@a-c-sreedhar-reddy
Copy link
Contributor

a-c-sreedhar-reddy commented Jun 1, 2020

Feature request

https://reactnavigation.org/docs/hello-react-navigation#passing-additional-props

Stack component can accept render callback instead of component prop.

eg:

<Stack.Screen name="Home">
  {props => <HomeScreen {...props} extraData={someData} />}
</Stack.Screen>
@a-c-sreedhar-reddy
Copy link
Contributor Author

  module Screen = {
    type componentProps = {navigation};
    type renderCallbackProp = {
      navigation,
      route,
    };
    [@bs.obj]
    external makeProps:
      (
        ~name: string,
        ~options: optionCallback=?,
        ~initialParams: M.params=?,
        ~component: React.component({
                      .
                      "navigation": navigation,
                      "route": route,
                    })
                      =?,
        ~children: renderCallbackProp => React.element=?,
        unit
      ) =>
      screenProps(M.params);
    let make = stack##"Screen";
  };

How can I make sure that either component or children is given as props? Both of them should not be undefined and both of them should not be provided.

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 a pull request may close this issue.

1 participant