Skip to content

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

Merged
merged 5 commits into from
Jul 23, 2020
Merged

Migrate Drawer to TS #861

merged 5 commits into from
Jul 23, 2020

Conversation

ethanshar
Copy link
Collaborator

Also fixed minor issue with drawer toggle invocation. (What I sent you in slack)

/**
* Style
*/
style: ViewStyle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style is not optional?

Copy link
Collaborator Author

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> {
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Jul 22, 2020

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

/**
* Style
*/
style: ViewStyle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It here...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

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}>
Copy link
Collaborator

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?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ethanshar ethanshar requested a review from Inbal-Tish July 22, 2020 14:21
@Inbal-Tish Inbal-Tish merged commit 030ea61 into master Jul 23, 2020
@ethanshar ethanshar deleted the typescript/Drawer branch September 21, 2020 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants