Skip to content
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

Fix types for react native 0.72 and more #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MateuszRostkowski
Copy link

@MateuszRostkowski MateuszRostkowski commented Jul 13, 2023

Issue:
React native in 0.72 have added new type DimensionValue and react-native-whirlwind types are not working with react-native versions higher than 0.72.

React native changes:

FYI:

  • I have not tested this in projects with react-native versions lower than 0.72
  • I have tested it on 0.72.1 and it works perfectly

In case someone want to test it, you can add my repository to your repo:

Update react native types package to the newest version;
@MateuszRostkowski MateuszRostkowski changed the title Improve react native types; Fix types for react native 0.72 and more Jul 13, 2023
@arabold
Copy link
Owner

arabold commented Jul 13, 2023

Thank you for pointing this out and for your contribution 🙏. Unfortunately, this change isn't going to work ultimately. Everything in the dist/ folder is automatically generated when releasing a new package version. The types are originally defined in src/theme/ThemeProps.ts.

To make this work with 0.72, I believe there we need to change the types from string to DimensionValue. This would ensure we're using the same types as React does. I'm currently not working on any React Native projects professionally or personally and going to travel for the next two weeks, but I see if I can set up a local environment and test this properly.

If you urgently need a working version in the meantime, you can also check out patch-package which allows you to apply your own fixes (like this one) to NPM packages during installation.

@MateuszRostkowski
Copy link
Author

@arabold
Thanks for response. Every change that I've made in dist folder was automatically, I've just run the npm script build.

To make this work I've done this steps:

  1. Install new version of react native types - npm install --save @types/react-native@latest
  2. Make change in src/styles/sizing.ts file because this hScreen: { height: '100vh' } is not working with new react native types
  3. Build library: npm run build

For now I don't need to make the patch of this package, because I'm just using the fork in my app. So take your time and check this when you will be available.

@MateuszRostkowski
Copy link
Author

@arabold
If it's needed I can remove all the changes that I've made in dist folder.

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