-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22 +/- ##
==========================================
+ Coverage 89.51% 92.21% +2.69%
==========================================
Files 18 16 -2
Lines 248 244 -4
Branches 58 58
==========================================
+ Hits 222 225 +3
+ Misses 24 17 -7
Partials 2 2
Continue to review full report at Codecov.
|
61dbbd7
to
8a09d94
Compare
Can you drop the commit regarding |
109e1f1
to
0519693
Compare
@satya164 My changes are built on thew top of yours. If you're force-pushed commit with another hash, it might imply problems. I can do it after merging your PR. |
6793b09
to
83477e3
Compare
e980e36
to
56fb0fa
Compare
src/useNavigationBuilder.tsx
Outdated
Options extends DefualtOptions = DefualtOptions | ||
>(router: RouterHelper<any, Options>, options: Options) { | ||
const { current: currentRouter } = React.useRef<Router<any>>( | ||
typeof router === 'function' ? router(options) : router |
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 it's better to just always make it a function rather than accepting both object and function
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 shouldn't pass things like children
to the router. It'll be problematic if someone writing a custom router uses children.
src/useNavigationBuilder.tsx
Outdated
@@ -79,7 +84,7 @@ export default function useNavigationBuilder<ScreenOptions extends object>( | |||
); | |||
|
|||
const [initialState] = React.useState(() => | |||
router.getInitialState({ | |||
currentRouter.getInitialState({ | |||
routeNames, | |||
initialRouteName, |
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.
Since we now pass initialRouteName
as an option, we could remove it from here
src/useNavigationBuilder.tsx
Outdated
@@ -79,7 +84,7 @@ export default function useNavigationBuilder<ScreenOptions extends object>( | |||
); | |||
|
|||
const [initialState] = React.useState(() => | |||
router.getInitialState({ | |||
currentRouter.getInitialState({ | |||
routeNames, | |||
initialRouteName, | |||
initialParamsList, |
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.
Let's rename this to routeParamList
, since it's not really initial as it changes when children change.
src/useNavigationBuilder.tsx
Outdated
ScreenOptions extends object, | ||
Options extends DefualtOptions = DefualtOptions | ||
>(router: RouterHelper<any, Options>, options: Options) { | ||
const { current: currentRouter } = React.useRef<Router<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.
Since there's always going to be one router, I think no need to say currentRouter
, router
looks nicer 😛
src/useNavigationBuilder.tsx
Outdated
) { | ||
export default function useNavigationBuilder< | ||
ScreenOptions extends object, | ||
Options extends DefualtOptions = DefualtOptions |
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.
RouterOptions
src/types.tsx
Outdated
@@ -55,6 +56,16 @@ export type ActionCreators<Action extends NavigationAction> = { | |||
[key: string]: (...args: any) => Action; | |||
}; | |||
|
|||
export type DefualtOptions = { |
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.
RouterDefaultOptions
e3d24a8
to
e81116a
Compare
69eceed
to
fec3e7f
Compare
No description provided.