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

[v3] - Improvement for babel plugin detection #436

Open
jpudysz opened this issue Dec 14, 2024 · 0 comments
Open

[v3] - Improvement for babel plugin detection #436

jpudysz opened this issue Dec 14, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@jpudysz
Copy link
Owner

jpudysz commented Dec 14, 2024

Description

Currently, to enable babel dependency discovery as mentioned here: https://www.unistyl.es/v3/other/babel-plugin#1-detecting-stylesheet-dependencies, we require that the user imports something from react-native-unistyles in the given file.

This prevents overriding StyleSheet from React Native. While this assumption was initially fine, more and more users are reporting issues where a given view/file is not responding to ShadowUpdates.

That's why I believe we should change the default behavior of the Babel plugin and allow for some customization:

  1. By default, we will parse every file that either contains StyleSheet.create or imports from react-native-unistyles.
  2. If someone wants to limit this, we should provide an array of imports that will trigger the Babel plugin (e.g., @/theme or lib/styles).
  3. The other option is to fallback to the default discovery method (require import from unistyles.

Steps to Reproduce

Snack or Repository Link (Optional)

No response

Unistyles Version

3.0.0-beta.2

React Native Version

0.76.0

Platforms

Android, iOS, Web

Expo

Yes

@jpudysz jpudysz added the enhancement New feature or request label Dec 14, 2024
@jpudysz jpudysz added this to the 3.0.0-beta.5 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant