jpudysz / react-native-unistyles

Level up your React Native StyleSheet
https://unistyl.es
MIT License
1.42k stars 40 forks source link

feat: allow createStyleSheet to take UniStyle(Text|Image|View) #253

Closed yzhe554 closed 2 months ago

yzhe554 commented 2 months ago

Summary

Allow createStyleSheet to take UniStyle types

I want to reuse some common styles for typography for example. Currently, it will introduce a typing errors if I use UnistyleText. Added examples. Without the change in stylesheet.ts, npm run tsc will throw an error.

image

Issues are gone after the change

image
vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-unistyles-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 2:50am
jpudysz commented 2 months ago

Hey, I'm against changes in the core. It requires a lot of testing for dozens of stylesheets.

Maybe it will be better to postpone it until 3.0 as I'm gonna test everything couple times.

yzhe554 commented 2 months ago

Hey, I'm against changes in the core. It requires a lot of testing for dozens of stylesheets.

Maybe it will be better to postpone it until 3.0 as I'm gonna test everything couple times.

Could we add this support in V3 roadmap? I can do a patch for the company's project to get this supported for the time being. Do you want me to close the PR or just leave it open? I am also happy to support test if you need any support.

jpudysz commented 2 months ago

Yes, we can! I'm happy to export more types. I will add it to my roadmap, and ping you when first beta is available.

jpudysz commented 2 months ago

As we discussed, we can improve it in 3.0. Right now i don't wont to focus too much on 2.x branch (test it multiple times).