baransu / bs-react-navigation

Bucklescript bindings to react-navigation
MIT License
6 stars 0 forks source link

Unable to nest navigators without creating new navigators due to screen component being created #7

Open cem2ran opened 6 years ago

cem2ran commented 6 years ago

Currently it seems that intermediary screen components are created due to the screen parameter in routes being interpreted as a react functional component.

image

function route(screen, path, navigationOptions, _) {
  return {
          screen: (function (props) {
              var navigation = props.navigation;
              var state = Navigation$BsReactNavigation.stackState(navigation);
              return Curry._3(screen, navigation, state[/* params */2], props.screenProps);
            }),
          path: Js_undefined.fromOption(path),
          navigationOptions: Js_undefined.fromOption(navigationOptions)
        };
}

This issue triggers the following warning and breaks the ability to navigate across navigators: You should only render one navigator explicitly in your app, and other navigators should by rendered by including them in that navigator. Full details at: https://reactnavigation.org/docs/common-mistakes.html#explicitly-rendering-more-than-one-navigator

baransu commented 6 years ago

Yes. That's an actual issue. We want to have intermediate step to convert JS navigation screen props to Reason component which accepts props as function arguments instead of object. I don't know how to solve this issue right now. Maybe some escape with JS HoC accepting Reason component. I'm not sure when I'll have time to check this.