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

Potential issue with configuration workflow on web #9

Open
leggomuhgreggo opened this issue Oct 14, 2021 · 1 comment
Open

Potential issue with configuration workflow on web #9

leggomuhgreggo opened this issue Oct 14, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@leggomuhgreggo
Copy link

leggomuhgreggo commented Oct 14, 2021

Noticed a potential issue where the recommended pattern of exporting within a StyleSheet.create wasn't working on web.

When I export just the raw style object the styles apply as expected.

But when I export the config within StyleSheet.create the same style class doesn't apply. Seems like reference ID isn't computing back to the actual styles for some reason.

Might be a quirk of the RNW implementation or something but wanted to share in case it was relevant here.

You can see at the bottom of the theme file in this demo, I have the StyleSheet version of the export commented out:
Codesandbox Demo

Thanks!

@arabold arabold added the bug Something isn't working label Oct 14, 2021
@arabold
Copy link
Owner

arabold commented Oct 14, 2021

Thanks for reporting this issue. It is certainly related to a quirk in React Native Web, that doesn't handle the style IDs the same way as iOS and Android do. I believe the related bug in RNW is this: necolas/react-native-web#1377

Unfortunately, there doesn't seem to be any intent to fix it 😞

Not sure what a good workaround would be. Maybe the createTheme function needs to be split into two functions: createTheme that works as it does now and a buildThemeDefinition (or similar) that only returns the plain JS objects 🤔 Or maybe there's a way of making the theme composable again using StyleSheet.compose? Didn't try that myself yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants