Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Add createNavigator and not export Screen directly #3

Merged
merged 4 commits into from
Jul 16, 2019

Conversation

osdnk
Copy link
Member

@osdnk osdnk commented Jul 15, 2019

No description provided.

@codecov-io
Copy link

codecov-io commented Jul 16, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@e7014a6). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7014a6...785a2cb. Read the comment docs.

example/index.tsx Show resolved Hide resolved
@@ -143,7 +144,7 @@ const TabRouter: Router<Action | CommonAction> = {
},
};

export default function TabNavigator(props: Props) {
export default createNavigator((props: Props) => {
Copy link
Member

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.

@@ -7,7 +7,7 @@ import {
NavigationProp,
CommonAction,
ParamListBase,
Router,
Router, createNavigator,
Copy link
Member

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 🤔

import Screen from './Screen';

export default function createNavigator<ParamList extends ParamListBase>(
Navigator: React.ComponentType<any>
Copy link
Member

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.

@osdnk osdnk merged commit 9f04fd5 into master Jul 16, 2019
@osdnk osdnk deleted the @osdnk/create-navigator branch July 16, 2019 23:11
satya164 added a commit that referenced this pull request Aug 18, 2019
satya164 added a commit that referenced this pull request Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants