-
Notifications
You must be signed in to change notification settings - Fork 41
Add createNavigator and not export Screen directly #3
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
=========================================
Coverage ? 95.31%
=========================================
Files ? 11
Lines ? 128
Branches ? 25
=========================================
Hits ? 122
Misses ? 5
Partials ? 1 Continue to review full report at Codecov.
|
example/TabNavigator.tsx
Outdated
@@ -143,7 +144,7 @@ const TabRouter: Router<Action | CommonAction> = { | |||
}, | |||
}; | |||
|
|||
export default function TabNavigator(props: Props) { | |||
export default createNavigator((props: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better to do export default createNavigator(TabNavigator)
below so this component has a display name. Otherwise it'll show up as Unnamed
in dev tools and anonymous
in stack traces.
example/StackNavigator.tsx
Outdated
@@ -7,7 +7,7 @@ import { | |||
NavigationProp, | |||
CommonAction, | |||
ParamListBase, | |||
Router, | |||
Router, createNavigator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't prettier throw here 🤔
src/createNavigator.tsx
Outdated
import Screen from './Screen'; | ||
|
||
export default function createNavigator<ParamList extends ParamListBase>( | ||
Navigator: React.ComponentType<any> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to use generic for this for types to work properly
<ParamList extends ParamListBase, N extends React.ComponentType<any>>(Navigator: N): TypedNavigator<ParamList, N>
Though since this function is called by navigator now, we need to change it to not include the param list stuff.
No description provided.