Is it possible to "curry" <Scene>, <Drawer>, <Tabs>, maybe others?
See original GitHub issueVersions
- react-native-router-flux v4.0.0-beta.28
- react-native v0.51.0
Expected behaviour
I’m making some wrappers for the built-in <Scene />
component, changing it to take children
instead of component
, changing the api from <Scene component={...} />
to <MyScene>{component}</MyScene>
so I can get a router file that looks like the following:
const MyComponent = () => (
<View>
<Text>Hello, World!</Text>
</View>
)
const MyScene = ({ children }) => <Scene key={'myScene'} component={children} />
const MyStack = ({ children }) => <Stack key={'myStack'}>{children}</Stack>
const MyTabs = ({ children }) => <Tabs key={'myTabs'} hideNavBar>{children}</Tabs>
const MyDrawer = ({ children }) => <Drawer key={'myDrawer'} hideNavBar>{children}</Drawer>
export type Props = {}
export default class App extends Component<Props> {
render () {
return (
<Router>
<MyStack>
<MyDrawer>
<MyTabs>
<MyScene>
<MyComponent />
</MyScene>
</MyTabs>
</MyDrawer>
</MyStack>
</Router>
)
}
}
Actual behaviour
When wrapping <Scene>
Error: Route 'key1' should declare a screen. For example:
import MyScreen from './MyScreen';
...
key1: {
screen: MyScreen,
}
This error is located at:
in Router (at App.js:36)
in App (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
When wrapping the other components, they compile but the router doesn’t see any of the props
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Curry Rub Recipe | Martha Stewart
Ingredients · 4 teaspoons curry powder · 1 1/2 teaspoons ground coriander · 1 1/2 teaspoons coarse salt · 1 teaspoon ground ginger...
Read more >Curry Chicken with Cilantro Lime Sauce - Martha Stewart
Step 1. Sprinkle chicken with curry powder, season with salt and pepper. · Step 2. In a blender, combine 1 tablespoon oil, cilantro,...
Read more >Chicken Curry Recipe | Martha Stewart
In a 5-quart slow cooker, toss chicken, onion, garlic, ginger, curry powder, coriander, and cumin to coat. Season with 2 teaspoons salt.
Read more >Algorithms and their others: Algorithmic culture in context
In doing so, I hope to be able to identify fruitful directions for taking up the algorithm as an object of attention within...
Read more >DOCUMENT RESUME AUTHOR Highlights of American ...
The scene ends in thanksgiving by the good people who have been able to triumph over the bad. The struggle and victory are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just… why? I don’t think it is a good practice at all, and the library is already good enough to do whatever you want, what you’re doing is not very appropriated to the library and kind of useless. I strongly advise you to check the example project and understand the library
i prefer passing components as
children
whenever possible