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

drispy/gradient path doesn't match entrypoint #285

Closed
awinograd opened this issue May 6, 2023 · 9 comments
Closed

drispy/gradient path doesn't match entrypoint #285

awinograd opened this issue May 6, 2023 · 9 comments

Comments

@awinograd
Copy link

👋 Thanks @nandorojo for an awesome lib!

I just upgraded from 3.x to 4.1 and after updating gradients to import from `dripsy/gradient' I get the following error when rendering a Gradient:

Cannot read property 'theme' of null

What i'm seeing, is that dripsy.gradient always exports from build

export * from '../build/gradient'

But in react-native, metro bundler will import from on src

"react-native": "src/index.ts",

This leads to two different copies of dripsy being loaded from dripsy and dripsy/gradient so when I import DripsyProvider it doesn't properly provide to Gradient.

I'm a little surprised this hasn't come up yet in your usage of Gradient so I figure I must be "holding it wrong 🙃 . Am I missing something here? Thanks again!

@nandorojo
Copy link
Owner

Ah, that's interesting, will look into it

@nandorojo
Copy link
Owner

this might require removing the react-native field from package.json. i wonder if setting it to src instead of src/index would fix it.

@awinograd
Copy link
Author

removing react-native should work as then metro will use the main field.

I think that's probably the best option until full support for exports lands in metro (facebook/metro#670 (comment))

@awinograd
Copy link
Author

awinograd commented May 6, 2023

Another idea would be adding dripsy/gradient/index.native.js to export * from '../src/gradient'

@nandorojo
Copy link
Owner

yeah, not sure if there are downsides there. i guess everyone uses metro so could be fine

@Wilson-Lim
Copy link

Hi, i am hitting this issue as well.

How could i make it work temporarily, while waiting for the fix ?

  • i tried removing "react-native": "src/index.ts", at package.json Line 7
  • i tried adding dripsy/gradient/index.native.js to export * from '../src/gradient'

@Wilson-Lim
Copy link

Hi, i am hitting this issue as well.

How could i make it work temporarily, while waiting for the fix ?

  • i tried removing "react-native": "src/index.ts", at package.json Line 7
  • i tried adding dripsy/gradient/index.native.js to export * from '../src/gradient'

I did a clean yarn install, and it works.

Kindly ignore my post

@nandorojo
Copy link
Owner

Can you guys try 4.3.2 and see if this is fixed?

@gorbypark
Copy link

Can you guys try 4.3.2 and see if this is fixed?

@nandorojo Upgraded from drippy 3 to 4.3.5 and I am hitting this issue as well.

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

No branches or pull requests

4 participants