Instawork / hyperview

Server-driven mobile apps with React Native
https://hyperview.org
MIT License
1.22k stars 57 forks source link

Support connecting external navigation for screen with undefined navigation parameters #779

Open Charles-Johnson opened 8 months ago

Charles-Johnson commented 8 months ago

I tried using Hyperview in an existing app using 'react-navigation' for a screen without any navigation parameters passed to it e.g.

function Screen({navigation, route}) {

  return <Hyperview
    navigation={navigation}
    route={route}
    push={(params) => {
      // parse params and call navigation.push
    }}
    back={navigation.goBack}
   navigate={(params) => {
    // parse params and call navigation.navigate
   }}
   // other props
  />;
}

In this case, route.params === undefined which hyperview doesn't seem to handle. I forked the library and fixed the issue in these commits:

Perhaps stricter type checking is needed in https://github.com/Instawork/hyperview/tree/master/src/core/components/hv-screen to avoid these kinds of issues?

What would be the best way to contribute back?

adamstep commented 8 months ago

Thanks for reporting @Charles-Johnson . We have developed a new way to define navigation hierarchy in HXML itself, this is a new feature that isn't well documented yet. Perhaps @hgray-instawork can chime in since he worked on it. We welcome contributions but I want to make sure the work would be relevant given we are rolling out the new system soon!

hgray-instawork commented 8 months ago

Thanks very much for your contribution @Charles-Johnson. I'll have a look at the proposed changes and compare them to what we have in our new implementation.