-
Notifications
You must be signed in to change notification settings - Fork 734
Migrate Drawer to TS #861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Drawer to TS #861
Conversation
/** | ||
* Style | ||
*/ | ||
style: ViewStyle; |
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.
Style is not optional?
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.
Indeed. Fixed
* with gestureHandlerRootHOC from 'react-native-gesture-handler'. see | ||
* @importantLink: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation | ||
*/ | ||
declare class NewDrawer extends PureComponent<DrawerProps> { |
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.
This class should be renamed, no?
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.
Fixed
src/components/drawer/index.tsx
Outdated
/** | ||
* Style | ||
*/ | ||
style: ViewStyle; |
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.
It here...
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.
Fixed
src/components/drawer/index.tsx
Outdated
if (items) { | ||
return ( | ||
<View animated row style={{transform: [{translateX: this.leftActionX}]}}> | ||
{_.map(items, (item, index) => { | ||
<View animated row style={{transform: [{translateX: this.leftActionX}]} as any as ViewStyle}> |
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.
Why you need ' as any as ViewStyle' here?
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.
TBH, not sure why it's even giving me an error.
This is a trick I learned from the guys from Kiev.
First you cast to any and from there you can cast to anything you want.
Not a fan of this solution. another option is to explicitly ts-ignore
this line and revisit in the future.
WDYT?
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 would ts-ignore it, the casting seems redundant and expensive
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.
Done
Also fixed minor issue with drawer toggle invocation. (What I sent you in slack)