Any reason RootContainer is opaque when it comes to props? I'm trying to configure react-native's Navigator component to work with relay. I've gotten it to successfully work, but any components rendered into RootContainer do not have access to the navigator prop.
import {RootContainer} from 'react-relay';
export default function routeMapper(route, navigator) {
var props = {
Component: route.component,
route: route,
navigator: navigator
};
return (
<RootContainer {...props} />
);
}
const route = {
name: 'root',
component: RootController,
params: {},
queries: {
viewer: (Component) => Relay.QL`
query {
viewer {
${Component.getFragment('viewer')},
}
}
`
}
};
@amccloud This is intentional - Relay.RootContainer does not pass through props. However, you can customize the props passed to the component via the renderFetched() prop. In this example, you might do:
<RootContainer
renderFetched={data =>
<Component {...data} navigator={navigator} />
} />
I see, thanks!
<RootContainer
renderFetched={data =>
<Component {...data} passedProps={this.props} />
} />
worked for me to pass between scenes using react-native-router-flux
Most helpful comment
@amccloud This is intentional -
Relay.RootContainerdoes not pass through props. However, you can customize the props passed to the component via therenderFetched()prop. In this example, you might do: