react-native-unistyles 3.0.0-beta.8 → 3.0.0-experimental-2025051402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +32 -26
  2. package/Unistyles.podspec +1 -0
  3. package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
  4. package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
  5. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -1
  6. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +2 -3
  7. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +1 -1
  8. package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
  9. package/components/native/ActivityIndicator/package.json +1 -0
  10. package/components/native/Animated/package.json +1 -0
  11. package/components/native/FlatList/package.json +1 -0
  12. package/components/native/Image/package.json +2 -1
  13. package/components/native/ImageBackground/package.json +1 -0
  14. package/components/native/KeyboardAvoidingView/package.json +1 -0
  15. package/components/native/NativeText/package.json +1 -0
  16. package/components/native/NativeView/package.json +1 -0
  17. package/components/native/Pressable/package.json +1 -0
  18. package/components/native/RefreshControl/package.json +1 -0
  19. package/components/native/ScrollView/package.json +1 -0
  20. package/components/native/SectionList/package.json +1 -0
  21. package/components/native/Switch/package.json +1 -0
  22. package/components/native/Text/package.json +1 -0
  23. package/components/native/TextInput/package.json +1 -0
  24. package/components/native/TouchableHighlight/package.json +1 -0
  25. package/components/native/TouchableOpacity/package.json +1 -0
  26. package/components/native/View/package.json +1 -0
  27. package/components/native/VirtualizedList/package.json +1 -0
  28. package/cxx/common/Helpers.h +4 -0
  29. package/cxx/core/HostUnistyle.cpp +14 -5
  30. package/cxx/core/StyleSheet.h +1 -1
  31. package/cxx/core/UnistyleWrapper.h +1 -1
  32. package/cxx/core/UnistylesCommitShadowNode.h +0 -21
  33. package/cxx/core/UnistylesRegistry.cpp +67 -64
  34. package/cxx/core/UnistylesRegistry.h +1 -1
  35. package/cxx/hybridObjects/HybridStyleSheet.cpp +10 -19
  36. package/cxx/hybridObjects/HybridStyleSheet.h +3 -8
  37. package/cxx/parser/Parser.cpp +161 -115
  38. package/cxx/parser/Parser.h +1 -1
  39. package/cxx/shadowTree/ShadowTrafficController.h +7 -9
  40. package/cxx/shadowTree/ShadowTreeManager.cpp +36 -33
  41. package/cxx/shadowTree/ShadowTreeManager.h +0 -1
  42. package/ios/NativePlatform+ios.swift +1 -1
  43. package/ios/NativePlatformListener+ios.swift +12 -7
  44. package/ios/UnistylesModuleOnLoad.h +1 -5
  45. package/ios/UnistylesModuleOnLoad.mm +5 -13
  46. package/lib/commonjs/components/native/Image.js +27 -1
  47. package/lib/commonjs/components/native/Image.js.map +1 -1
  48. package/lib/commonjs/components/native/Image.native.js +10 -0
  49. package/lib/commonjs/components/native/Image.native.js.map +1 -0
  50. package/lib/commonjs/components/native/ImageBackground.js +17 -28
  51. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  52. package/lib/commonjs/components/native/Pressable.native.js +7 -4
  53. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  54. package/lib/commonjs/core/createUnistylesElement.js +17 -21
  55. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  56. package/lib/commonjs/core/createUnistylesElement.native.js +6 -4
  57. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  58. package/lib/commonjs/core/createUnistylesImageBackground.js +7 -5
  59. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  60. package/lib/commonjs/core/getClassname.js +11 -5
  61. package/lib/commonjs/core/getClassname.js.map +1 -1
  62. package/lib/commonjs/core/passForwardRef.js +3 -5
  63. package/lib/commonjs/core/passForwardRef.js.map +1 -1
  64. package/lib/commonjs/core/useProxifiedUnistyles/listener.js +5 -3
  65. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
  66. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +14 -1
  67. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  68. package/lib/commonjs/core/withUnistyles/withUnistyles.js +14 -5
  69. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  70. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -1
  71. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  72. package/lib/commonjs/hooks/useMedia.js +4 -4
  73. package/lib/commonjs/hooks/useMedia.js.map +1 -1
  74. package/lib/commonjs/hooks/useMedia.native.js +4 -4
  75. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  76. package/lib/commonjs/mocks.js +203 -0
  77. package/lib/commonjs/mocks.js.map +1 -0
  78. package/lib/commonjs/mq.js +1 -23
  79. package/lib/commonjs/mq.js.map +1 -1
  80. package/lib/commonjs/reanimated/index.js +13 -0
  81. package/lib/commonjs/reanimated/index.js.map +1 -0
  82. package/lib/commonjs/reanimated/useAnimatedTheme.js +22 -0
  83. package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -0
  84. package/lib/commonjs/reanimated/useAnimatedTheme.native.js +24 -0
  85. package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -0
  86. package/lib/commonjs/server/getServerUnistyles.js +9 -4
  87. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  88. package/lib/commonjs/server/hydrateServerUnistyles.js +4 -2
  89. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  90. package/lib/commonjs/server/resetServerUnistyles.js +4 -2
  91. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  92. package/lib/commonjs/server/serialize.js +24 -0
  93. package/lib/commonjs/server/serialize.js.map +1 -0
  94. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  95. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  96. package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
  97. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  98. package/lib/commonjs/utils.js +23 -1
  99. package/lib/commonjs/utils.js.map +1 -1
  100. package/lib/commonjs/web/convert/index.js +4 -7
  101. package/lib/commonjs/web/convert/index.js.map +1 -1
  102. package/lib/commonjs/web/convert/object/filter.js +7 -8
  103. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  104. package/lib/commonjs/web/create.js +10 -2
  105. package/lib/commonjs/web/create.js.map +1 -1
  106. package/lib/commonjs/web/css/core.js +2 -2
  107. package/lib/commonjs/web/css/core.js.map +1 -1
  108. package/lib/commonjs/web/css/state.js +6 -3
  109. package/lib/commonjs/web/css/state.js.map +1 -1
  110. package/lib/commonjs/web/index.js +7 -12
  111. package/lib/commonjs/web/index.js.map +1 -1
  112. package/lib/commonjs/web/registry.js +11 -9
  113. package/lib/commonjs/web/registry.js.map +1 -1
  114. package/lib/commonjs/web/runtime.js +5 -1
  115. package/lib/commonjs/web/runtime.js.map +1 -1
  116. package/lib/commonjs/web/services.js +7 -2
  117. package/lib/commonjs/web/services.js.map +1 -1
  118. package/lib/commonjs/web/shadowRegistry.js +27 -10
  119. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  120. package/lib/commonjs/web/state.js +11 -2
  121. package/lib/commonjs/web/state.js.map +1 -1
  122. package/lib/commonjs/web/types.js +2 -0
  123. package/lib/commonjs/web/types.js.map +1 -1
  124. package/lib/commonjs/web/utils/createUnistylesRef.js +31 -0
  125. package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -0
  126. package/lib/commonjs/web/utils/unistyle.js +40 -14
  127. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  128. package/lib/commonjs/web-only/getWebProps.js +19 -0
  129. package/lib/commonjs/web-only/getWebProps.js.map +1 -0
  130. package/lib/commonjs/web-only/index.js +13 -0
  131. package/lib/commonjs/web-only/index.js.map +1 -0
  132. package/lib/module/components/native/Image.js +26 -2
  133. package/lib/module/components/native/Image.js.map +1 -1
  134. package/lib/module/components/native/Image.native.js +6 -0
  135. package/lib/module/components/native/Image.native.js.map +1 -0
  136. package/lib/module/components/native/ImageBackground.js +18 -29
  137. package/lib/module/components/native/ImageBackground.js.map +1 -1
  138. package/lib/module/components/native/Pressable.native.js +7 -4
  139. package/lib/module/components/native/Pressable.native.js.map +1 -1
  140. package/lib/module/core/createUnistylesElement.js +17 -21
  141. package/lib/module/core/createUnistylesElement.js.map +1 -1
  142. package/lib/module/core/createUnistylesElement.native.js +6 -4
  143. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  144. package/lib/module/core/createUnistylesImageBackground.js +7 -5
  145. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  146. package/lib/module/core/getClassname.js +9 -5
  147. package/lib/module/core/getClassname.js.map +1 -1
  148. package/lib/module/core/passForwardRef.js +3 -5
  149. package/lib/module/core/passForwardRef.js.map +1 -1
  150. package/lib/module/core/useProxifiedUnistyles/listener.js +3 -3
  151. package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
  152. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +14 -1
  153. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  154. package/lib/module/core/withUnistyles/withUnistyles.js +14 -5
  155. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  156. package/lib/module/core/withUnistyles/withUnistyles.native.js +1 -1
  157. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  158. package/lib/module/hooks/useMedia.js +1 -1
  159. package/lib/module/hooks/useMedia.js.map +1 -1
  160. package/lib/module/hooks/useMedia.native.js +1 -1
  161. package/lib/module/hooks/useMedia.native.js.map +1 -1
  162. package/lib/module/mocks.js +201 -0
  163. package/lib/module/mocks.js.map +1 -0
  164. package/lib/module/mq.js +0 -19
  165. package/lib/module/mq.js.map +1 -1
  166. package/lib/module/reanimated/index.js +4 -0
  167. package/lib/module/reanimated/index.js.map +1 -0
  168. package/lib/module/reanimated/useAnimatedTheme.js +17 -0
  169. package/lib/module/reanimated/useAnimatedTheme.js.map +1 -0
  170. package/lib/module/reanimated/useAnimatedTheme.native.js +19 -0
  171. package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -0
  172. package/lib/module/server/getServerUnistyles.js +7 -4
  173. package/lib/module/server/getServerUnistyles.js.map +1 -1
  174. package/lib/module/server/hydrateServerUnistyles.js +2 -2
  175. package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
  176. package/lib/module/server/resetServerUnistyles.js +2 -2
  177. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  178. package/lib/module/server/serialize.js +19 -0
  179. package/lib/module/server/serialize.js.map +1 -0
  180. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  181. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  182. package/lib/module/specs/ShadowRegistry/index.js +2 -2
  183. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  184. package/lib/module/utils.js +19 -0
  185. package/lib/module/utils.js.map +1 -1
  186. package/lib/module/web/convert/index.js +4 -7
  187. package/lib/module/web/convert/index.js.map +1 -1
  188. package/lib/module/web/convert/object/filter.js +3 -4
  189. package/lib/module/web/convert/object/filter.js.map +1 -1
  190. package/lib/module/web/create.js +9 -3
  191. package/lib/module/web/create.js.map +1 -1
  192. package/lib/module/web/css/core.js +2 -2
  193. package/lib/module/web/css/core.js.map +1 -1
  194. package/lib/module/web/css/state.js +6 -3
  195. package/lib/module/web/css/state.js.map +1 -1
  196. package/lib/module/web/index.js +4 -10
  197. package/lib/module/web/index.js.map +1 -1
  198. package/lib/module/web/registry.js +11 -9
  199. package/lib/module/web/registry.js.map +1 -1
  200. package/lib/module/web/runtime.js +5 -1
  201. package/lib/module/web/runtime.js.map +1 -1
  202. package/lib/module/web/services.js +7 -1
  203. package/lib/module/web/services.js.map +1 -1
  204. package/lib/module/web/shadowRegistry.js +27 -10
  205. package/lib/module/web/shadowRegistry.js.map +1 -1
  206. package/lib/module/web/state.js +11 -2
  207. package/lib/module/web/state.js.map +1 -1
  208. package/lib/module/web/types.js +1 -1
  209. package/lib/module/web/types.js.map +1 -1
  210. package/lib/module/web/utils/createUnistylesRef.js +24 -0
  211. package/lib/module/web/utils/createUnistylesRef.js.map +1 -0
  212. package/lib/module/web/utils/unistyle.js +32 -10
  213. package/lib/module/web/utils/unistyle.js.map +1 -1
  214. package/lib/module/web-only/getWebProps.js +14 -0
  215. package/lib/module/web-only/getWebProps.js.map +1 -0
  216. package/lib/module/web-only/index.js +4 -0
  217. package/lib/module/web-only/index.js.map +1 -0
  218. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
  219. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  220. package/lib/typescript/src/components/native/Image.native.d.ts +2 -0
  221. package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -0
  222. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  223. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  224. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  225. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  226. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  227. package/lib/typescript/src/core/getClassname.d.ts +5 -5
  228. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  229. package/lib/typescript/src/core/passForwardRef.d.ts +1 -1
  230. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
  231. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
  232. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
  233. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  234. package/lib/typescript/src/core/warn.d.ts.map +1 -1
  235. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +1 -1
  236. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  237. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +1 -3
  238. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  239. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  240. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
  241. package/lib/typescript/src/mocks.d.ts +2 -0
  242. package/lib/typescript/src/mocks.d.ts.map +1 -0
  243. package/lib/typescript/src/mq.d.ts +0 -8
  244. package/lib/typescript/src/mq.d.ts.map +1 -1
  245. package/lib/typescript/src/reanimated/index.d.ts +2 -0
  246. package/lib/typescript/src/reanimated/index.d.ts.map +1 -0
  247. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts +4 -0
  248. package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -0
  249. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts +4 -0
  250. package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -0
  251. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  252. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts +0 -1
  253. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
  254. package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -1
  255. package/lib/typescript/src/server/serialize.d.ts +2 -0
  256. package/lib/typescript/src/server/serialize.d.ts.map +1 -0
  257. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  258. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +2 -1
  259. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  260. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  261. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  262. package/lib/typescript/src/types/common.d.ts +0 -1
  263. package/lib/typescript/src/types/common.d.ts.map +1 -1
  264. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  265. package/lib/typescript/src/utils.d.ts +8 -0
  266. package/lib/typescript/src/utils.d.ts.map +1 -1
  267. package/lib/typescript/src/web/convert/index.d.ts +2 -1
  268. package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
  269. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
  270. package/lib/typescript/src/web/convert/object/filter.d.ts +2 -1
  271. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  272. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
  273. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  274. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
  275. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
  276. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
  277. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
  278. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  279. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  280. package/lib/typescript/src/web/create.d.ts.map +1 -1
  281. package/lib/typescript/src/web/css/core.d.ts.map +1 -1
  282. package/lib/typescript/src/web/css/state.d.ts +4 -1
  283. package/lib/typescript/src/web/css/state.d.ts.map +1 -1
  284. package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
  285. package/lib/typescript/src/web/index.d.ts +0 -5
  286. package/lib/typescript/src/web/index.d.ts.map +1 -1
  287. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  288. package/lib/typescript/src/web/registry.d.ts +2 -2
  289. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  290. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  291. package/lib/typescript/src/web/services.d.ts +6 -1
  292. package/lib/typescript/src/web/services.d.ts.map +1 -1
  293. package/lib/typescript/src/web/shadowRegistry.d.ts +2 -2
  294. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  295. package/lib/typescript/src/web/state.d.ts +2 -0
  296. package/lib/typescript/src/web/state.d.ts.map +1 -1
  297. package/lib/typescript/src/web/types.d.ts +3 -0
  298. package/lib/typescript/src/web/types.d.ts.map +1 -1
  299. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  300. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts +11 -0
  301. package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -0
  302. package/lib/typescript/src/web/utils/unistyle.d.ts +5 -2
  303. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  304. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  305. package/lib/typescript/src/web-only/getWebProps.d.ts +7 -0
  306. package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -0
  307. package/lib/typescript/src/web-only/index.d.ts +2 -0
  308. package/lib/typescript/src/web-only/index.d.ts.map +1 -0
  309. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +3 -0
  310. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +2 -1
  311. package/nitrogen/generated/ios/swift/UnistyleDependency.swift +4 -0
  312. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -1
  313. package/package.json +66 -32
  314. package/plugin/index.js +155 -67
  315. package/reanimated/package.json +6 -0
  316. package/server/package.json +6 -0
  317. package/src/components/native/Image.native.tsx +4 -0
  318. package/src/components/native/Image.tsx +36 -3
  319. package/src/components/native/ImageBackground.tsx +18 -33
  320. package/src/components/native/Pressable.native.tsx +12 -4
  321. package/src/core/createUnistylesElement.native.tsx +12 -6
  322. package/src/core/createUnistylesElement.tsx +26 -27
  323. package/src/core/createUnistylesImageBackground.tsx +16 -10
  324. package/src/core/getClassname.ts +16 -5
  325. package/src/core/passForwardRef.ts +5 -5
  326. package/src/core/useProxifiedUnistyles/listener.ts +3 -3
  327. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +17 -0
  328. package/src/core/withUnistyles/withUnistyles.native.tsx +3 -4
  329. package/src/core/withUnistyles/withUnistyles.tsx +23 -6
  330. package/src/hooks/useMedia.native.ts +1 -1
  331. package/src/hooks/useMedia.ts +1 -1
  332. package/src/mocks.ts +217 -0
  333. package/src/mq.ts +0 -24
  334. package/src/reanimated/index.ts +1 -0
  335. package/src/reanimated/useAnimatedTheme.native.ts +21 -0
  336. package/src/reanimated/useAnimatedTheme.ts +19 -0
  337. package/src/server/getServerUnistyles.tsx +15 -10
  338. package/src/server/hydrateServerUnistyles.ts +3 -2
  339. package/src/server/resetServerUnistyles.ts +4 -3
  340. package/src/server/serialize.ts +20 -0
  341. package/src/specs/NativePlatform/NativePlatform.nitro.ts +2 -1
  342. package/src/specs/ShadowRegistry/index.ts +1 -2
  343. package/src/types/common.ts +0 -1
  344. package/src/utils.ts +25 -0
  345. package/src/web/convert/index.ts +5 -7
  346. package/src/web/convert/object/filter.ts +4 -4
  347. package/src/web/create.ts +10 -3
  348. package/src/web/css/core.ts +2 -2
  349. package/src/web/css/state.ts +5 -3
  350. package/src/web/index.ts +4 -16
  351. package/src/web/registry.ts +20 -11
  352. package/src/web/runtime.ts +6 -2
  353. package/src/web/services.ts +14 -1
  354. package/src/web/shadowRegistry.ts +35 -13
  355. package/src/web/state.ts +14 -2
  356. package/src/web/types.ts +9 -4
  357. package/src/web/utils/createUnistylesRef.ts +33 -0
  358. package/src/web/utils/unistyle.ts +55 -23
  359. package/src/web-only/getWebProps.ts +18 -0
  360. package/src/web-only/index.ts +2 -0
  361. package/web/package.json +6 -0
  362. package/cxx/core/UnistylesCommitHook.cpp +0 -52
  363. package/cxx/core/UnistylesCommitHook.h +0 -27
  364. package/cxx/core/UnistylesMountHook.cpp +0 -28
  365. package/cxx/core/UnistylesMountHook.h +0 -24
  366. package/lib/module/package.json +0 -1
  367. /package/cxx/common/{Constants.h → UnistylesConstants.h} +0 -0
package/README.md CHANGED
@@ -15,21 +15,21 @@
15
15
  ## Installation
16
16
 
17
17
  ```shell
18
- yarn add react-native-unistyles@beta
18
+ yarn add react-native-unistyles@next
19
19
  ```
20
20
 
21
21
  Install dependencies:
22
22
 
23
23
  ```shell
24
- yarn add react-native-edge-to-edge react-native-nitro-modules@0.22.1
24
+ yarn add react-native-edge-to-edge react-native-nitro-modules@0.25.2
25
25
  ```
26
26
 
27
- > Always use fixed version of `react-native-nitro-modules` to avoid unexpected behaviors.
27
+ > To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
28
28
 
29
29
  | react-native-unistyles | react-native-nitro-modules |
30
30
  |------------------------|----------------------------|
31
- | 3.0.0.beta.7 | 0.22.1 |
32
- | 3.0.0.nightly-20250226 | 0.24.1 |
31
+ | 3.0.0-nightly-20250513 | 0.25.2 |
32
+ | 3.0.0-rc.4 | 0.25.2 |
33
33
 
34
34
  Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
35
35
 
@@ -78,47 +78,53 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
78
78
  <a href="https://github.com/oscklm">
79
79
  <img src="https://avatars.githubusercontent.com/u/22825865?v=4" height="70px" width="70px" alt="oscklm" />
80
80
  </a>
81
- <a href="https://github.com/guillaumehcht">
82
- <img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="70px" width="70px" alt="guillaumehcht" />
81
+ <a href="https://github.com/ryanlanciaux">
82
+ <img src="https://avatars.githubusercontent.com/u/85041?v=4" height="70px" width="70px" alt="ryanlanciaux" />
83
83
  </a>
84
- <a href="https://github.com/FilipiRafael">
85
- <img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="70px" width="70px" alt="FilipiRafael" />
86
- </a>
87
- <a href="https://github.com/4cc3ssX">
88
- <img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="70px" width="70px" alt="4cc3ssX" />
89
- </a>
90
- <a href="https://github.com/dacoto97">
91
- <img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="70px" width="70px" alt="dacoto97" />
92
- </a>
93
- <a href="https://github.com/chinamcafee">
94
- <img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="70px" width="70px" alt="chinamcafee" />
84
+ <a href="https://github.com/loopsware">
85
+ <img src="https://avatars.githubusercontent.com/u/161434039?s=200&v=4" height="70px" width="70px" alt="loopsware" />
95
86
  </a>
96
87
 
97
88
  ## Past sponsors
98
89
 
99
90
  <a href="https://github.com/kmartinezmedia">
100
- <img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="70px" width="70px" alt="kmartinezmedia" />
91
+ <img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="60px" width="60px" alt="kmartinezmedia" />
101
92
  </a>
102
93
  <a href="https://github.com/levibuzolic">
103
- <img src="https://avatars.githubusercontent.com/u/721323?v=4" height="70px" width="70px" alt="levibuzolic" />
94
+ <img src="https://avatars.githubusercontent.com/u/721323?v=4" height="60px" width="60px" alt="levibuzolic" />
104
95
  </a>
105
96
  <a href="https://github.com/claudesortwell">
106
- <img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="70px" width="70px" alt="claudesortwell" />
97
+ <img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="60px" width="60px" alt="claudesortwell" />
107
98
  </a>
108
99
  <a href="https://github.com/luoxuhai">
109
- <img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="70px" width="70px" alt="luoxuhai" />
100
+ <img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="60px" width="60px" alt="luoxuhai" />
110
101
  </a>
111
102
  <a href="https://github.com">
112
- <img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="70px" width="70px" alt="anonymous" />
103
+ <img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="60px" width="60px" alt="anonymous" />
113
104
  </a>
114
105
  <a href="https://github.com/abanobboles">
115
- <img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="70px" width="70px" alt="abanobboles" />
106
+ <img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="60px" width="60px" alt="abanobboles" />
116
107
  </a>
117
108
  <a href="https://github.com/hyoban">
118
- <img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="70px" width="70px" alt="hyoban" />
109
+ <img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="60px" width="60px" alt="hyoban" />
119
110
  </a>
120
111
  <a href="https://github.com/giovannilondero">
121
- <img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="70px" width="70px" alt="giovannilondero" />
112
+ <img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="60px" width="60px" alt="giovannilondero" />
113
+ </a>
114
+ <a href="https://github.com/4cc3ssX">
115
+ <img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="60px" width="60px" alt="4cc3ssX" />
116
+ </a>
117
+ <a href="https://github.com/FilipiRafael">
118
+ <img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="60px" width="60px" alt="FilipiRafael" />
119
+ </a>
120
+ <a href="https://github.com/dacoto97">
121
+ <img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="60px" width="60px" alt="dacoto97" />
122
+ </a>
123
+ <a href="https://github.com/chinamcafee">
124
+ <img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="60px" width="60px" alt="chinamcafee" />
125
+ </a>
126
+ <a href="https://github.com/guillaumehcht">
127
+ <img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="60px" width="60px" alt="guillaumehcht" />
122
128
  </a>
123
129
 
124
130
  ## Sponsor my work
package/Unistyles.podspec CHANGED
@@ -29,6 +29,7 @@ Pod::Spec.new do |s|
29
29
  if ENV["USE_FRAMEWORKS"]
30
30
  s.dependency "React-Core"
31
31
  add_dependency(s, "React-jsinspector", :framework_name => "jsinspector_modern")
32
+ add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
32
33
  add_dependency(s, "React-rendererconsistency", :framework_name => "React_rendererconsistency")
33
34
  end
34
35
 
@@ -10,19 +10,16 @@ using namespace facebook::react;
10
10
  UnistylesModule::UnistylesModule(
11
11
  jni::alias_ref<UnistylesModule::jhybridobject> jThis,
12
12
  jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
13
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
14
13
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
15
14
  ): _runtimeExecutor(runtimeExecutorHolder->cthis()->get()),
16
- _uiManager(fabricUIManager->getBinding()->getScheduler()->getUIManager()),
17
15
  _nativePlatform(nativePlatform->cthis()) {}
18
16
 
19
17
  jni::local_ref<UnistylesModule::jhybriddata> UnistylesModule::initHybrid(
20
18
  jni::alias_ref<UnistylesModule::jhybridobject> jThis,
21
19
  jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
22
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
23
20
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
24
21
  ) {
25
- return makeCxxInstance(jThis, runtimeExecutorHolder, fabricUIManager, nativePlatform);
22
+ return makeCxxInstance(jThis, runtimeExecutorHolder, nativePlatform);
26
23
  }
27
24
 
28
25
  void UnistylesModule::registerNatives() {
@@ -34,10 +31,9 @@ void UnistylesModule::registerNatives() {
34
31
 
35
32
  jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jobj) {
36
33
  auto& runtimeExecutor = jobj->cthis()->_runtimeExecutor;
37
- auto& uiManager = jobj->cthis()->_uiManager;
38
34
  auto& nativePlatform = jobj->cthis()->_nativePlatform;
39
35
 
40
- return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &uiManager, &nativePlatform](jsi::Runtime& rt) {
36
+ return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &nativePlatform](jsi::Runtime& rt) {
41
37
  // function is called on: first init and every live reload
42
38
  // check if this is live reload, if so let's replace UnistylesRuntime with new runtime
43
39
  auto hasUnistylesRuntime = HybridObjectRegistry::hasHybridObject("UnistylesRuntime");
@@ -56,7 +52,7 @@ jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindings
56
52
 
57
53
  // init hybrids
58
54
  auto unistylesRuntime = std::make_shared<HybridUnistylesRuntime>(nativePlatform, rt, runOnJSThread);
59
- auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime, uiManager);
55
+ auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime);
60
56
 
61
57
  HybridObjectRegistry::registerHybridObjectConstructor("UnistylesRuntime", [unistylesRuntime]() -> std::shared_ptr<HybridObject>{
62
58
  return unistylesRuntime;
@@ -1,7 +1,6 @@
1
1
  #pragma once
2
2
 
3
3
  #include <ReactCommon/BindingsInstallerHolder.h>
4
- #include <react/fabric/JFabricUIManager.h>
5
4
  #include <react/jni/JRuntimeExecutor.h>
6
5
  #include <react/renderer/scheduler/Scheduler.h>
7
6
  #include <fbjni/fbjni.h>
@@ -19,7 +18,6 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
19
18
  explicit UnistylesModule(
20
19
  jni::alias_ref<jhybridobject> jThis,
21
20
  jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
22
- jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
23
21
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
24
22
  );
25
23
 
@@ -27,14 +25,12 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
27
25
  static jni::local_ref<jhybriddata> initHybrid(
28
26
  jni::alias_ref<jhybridobject> jThis,
29
27
  jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
30
- jni::alias_ref<JFabricUIManager::javaobject>,
31
28
  jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
32
29
  );
33
30
 
34
31
  static jni::local_ref<BindingsInstallerHolder::javaobject> getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jThis);
35
32
 
36
33
  private:
37
- std::shared_ptr<UIManager> _uiManager;
38
34
  RuntimeExecutor _runtimeExecutor;
39
35
  std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
40
36
  };
@@ -27,7 +27,7 @@ import java.util.Locale
27
27
  @Keep
28
28
  @DoNotStrip
29
29
  class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
30
- private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
30
+ private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.onConfigChange() }
31
31
  private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
32
32
  private val _listener = NativePlatformListener(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
33
33
 
@@ -263,6 +263,10 @@ class NativePlatformAndroid(private val reactContext: ReactApplicationContext):
263
263
  return changedDependencies
264
264
  }
265
265
 
266
+ private fun onConfigChange() {
267
+ this._listener.onConfigChange()
268
+ }
269
+
266
270
  override fun registerPlatformListener(callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit) {
267
271
  this._listener.addPlatformListener(callback)
268
272
  }
@@ -12,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
13
  import com.facebook.react.bridge.ReactApplicationContext
14
14
  import com.margelo.nitro.unistyles.Insets
15
- import com.margelo.nitro.unistyles.UnistyleDependency
16
15
  import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
17
16
 
18
17
  typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
@@ -22,7 +21,7 @@ typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
22
21
  class NativePlatformInsets(
23
22
  private val reactContext: ReactApplicationContext,
24
23
  private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
25
- private val diffMiniRuntime: () -> Array<UnistyleDependency>
24
+ private val onConfigChange: () -> Unit
26
25
  ) {
27
26
  private var _shouldListenToImeEvents = false
28
27
  private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
@@ -106,7 +105,7 @@ class NativePlatformInsets(
106
105
  return
107
106
  }
108
107
 
109
- diffMiniRuntime()
108
+ this@NativePlatformInsets.onConfigChange()
110
109
 
111
110
  if (shouldEmitImeEvent) {
112
111
  this@NativePlatformInsets.emitImeEvent(this.getMiniRuntime())
@@ -27,7 +27,7 @@ class NativePlatformListener(
27
27
  override fun onReceive(context: Context, intent: Intent) {
28
28
  Handler(Looper.getMainLooper()).postDelayed({
29
29
  this@NativePlatformListener.onConfigChange()
30
- }, 10)
30
+ }, 25)
31
31
  }
32
32
  }
33
33
 
@@ -5,11 +5,8 @@ import com.facebook.jni.HybridData
5
5
  import com.facebook.proguard.annotations.DoNotStrip
6
6
  import com.facebook.react.bridge.ReactApplicationContext
7
7
  import com.facebook.react.bridge.RuntimeExecutor
8
- import com.facebook.react.fabric.FabricUIManager
9
8
  import com.facebook.react.turbomodule.core.interfaces.BindingsInstallerHolder
10
9
  import com.facebook.react.turbomodule.core.interfaces.TurboModuleWithJSIBindings
11
- import com.facebook.react.uimanager.UIManagerHelper
12
- import com.facebook.react.uimanager.common.UIManagerType
13
10
  import com.margelo.nitro.unistyles.HybridNativePlatformSpec
14
11
  import com.margelo.nitro.unistyles.unistylesOnLoad.Companion.initializeNative
15
12
 
@@ -34,10 +31,8 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
34
31
  private fun initializeHybridData(reactContext: ReactApplicationContext): HybridData {
35
32
  val runtimeExecutor = reactContext.catalystInstance?.runtimeExecutor
36
33
  ?: throw IllegalStateException("Unistyles: React Native runtime executor is not available. Please follow installation guides.")
37
- val fabricUIManager = UIManagerHelper.getUIManager(reactContext, UIManagerType.FABRIC) as? FabricUIManager
38
- ?: throw IllegalStateException("Unistyles: Fabric UI Manager is not available. Please follow installation guides.")
39
34
 
40
- return initHybrid(runtimeExecutor, fabricUIManager, _nativePlatform)
35
+ return initHybrid(runtimeExecutor, _nativePlatform)
41
36
  }
42
37
 
43
38
  @DoNotStrip
@@ -46,7 +41,6 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
46
41
  @DoNotStrip
47
42
  private external fun initHybrid(
48
43
  runtimeExecutor: RuntimeExecutor,
49
- fabricUIManager: FabricUIManager,
50
44
  nativePlatform: HybridNativePlatformSpec
51
45
  ): HybridData
52
46
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ActivityIndicator.js",
3
3
  "module": "../../../lib/module/components/native/ActivityIndicator.js",
4
+ "browser": "../../../lib/module/components/native/ActivityIndicator.js",
4
5
  "react-native": "../../../src/components/native/ActivityIndicator.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Animated.js",
3
3
  "module": "../../../lib/module/components/native/Animated.js",
4
+ "browser": "../../../lib/module/components/native/Animated.js",
4
5
  "react-native": "../../../src/components/native/Animated.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/FlatList.js",
3
3
  "module": "../../../lib/module/components/native/FlatList.js",
4
+ "browser": "../../../lib/module/components/native/FlatList.js",
4
5
  "react-native": "../../../src/components/native/FlatList.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Image.js",
3
3
  "module": "../../../lib/module/components/native/Image.js",
4
- "react-native": "../../../src/components/native/Image.tsx"
4
+ "browser": "../../../lib/module/components/native/Image.js",
5
+ "react-native": "../../../src/components/native/Image.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ImageBackground.js",
3
3
  "module": "../../../lib/module/components/native/ImageBackground.js",
4
+ "browser": "../../../lib/module/components/native/ImageBackground.js",
4
5
  "react-native": "../../../src/components/native/ImageBackground.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js",
3
3
  "module": "../../../lib/module/components/native/KeyboardAvoidingView.js",
4
+ "browser": "../../../lib/module/components/native/KeyboardAvoidingView.js",
4
5
  "react-native": "../../../src/components/native/KeyboardAvoidingView.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/NativeText.js",
3
3
  "module": "../../../lib/module/components/native/NativeText.js",
4
+ "browser": "../../../lib/module/components/native/NativeText.js",
4
5
  "react-native": "../../../src/components/native/NativeText.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/NativeView.js",
3
3
  "module": "../../../lib/module/components/native/NativeView.js",
4
+ "browser": "../../../lib/module/components/native/NativeView.js",
4
5
  "react-native": "../../../src/components/native/NativeView.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Pressable.js",
3
3
  "module": "../../../lib/module/components/native/Pressable.js",
4
+ "browser": "../../../lib/module/components/native/Pressable.js",
4
5
  "react-native": "../../../src/components/native/Pressable.native.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/RefreshControl.js",
3
3
  "module": "../../../lib/module/components/native/RefreshControl.js",
4
+ "browser": "../../../lib/module/components/native/RefreshControl.js",
4
5
  "react-native": "../../../src/components/native/RefreshControl.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/ScrollView.js",
3
3
  "module": "../../../lib/module/components/native/ScrollView.js",
4
+ "browser": "../../../lib/module/components/native/ScrollView.js",
4
5
  "react-native": "../../../src/components/native/ScrollView.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/SectionList.js",
3
3
  "module": "../../../lib/module/components/native/SectionList.js",
4
+ "browser": "../../../lib/module/components/native/SectionList.js",
4
5
  "react-native": "../../../src/components/native/SectionList.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Switch.js",
3
3
  "module": "../../../lib/module/components/native/Switch.js",
4
+ "browser": "../../../lib/module/components/native/Switch.js",
4
5
  "react-native": "../../../src/components/native/Switch.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/Text.js",
3
3
  "module": "../../../lib/module/components/native/Text.js",
4
+ "browser": "../../../lib/module/components/native/Text.js",
4
5
  "react-native": "../../../src/components/native/Text.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TextInput.js",
3
3
  "module": "../../../lib/module/components/native/TextInput.js",
4
+ "browser": "../../../lib/module/components/native/TextInput.js",
4
5
  "react-native": "../../../src/components/native/TextInput.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TouchableHighlight.js",
3
3
  "module": "../../../lib/module/components/native/TouchableHighlight.js",
4
+ "browser": "../../../lib/module/components/native/TouchableHighlight.js",
4
5
  "react-native": "../../../src/components/native/TouchableHighlight.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/TouchableOpacity.js",
3
3
  "module": "../../../lib/module/components/native/TouchableOpacity.js",
4
+ "browser": "../../../lib/module/components/native/TouchableOpacity.js",
4
5
  "react-native": "../../../src/components/native/TouchableOpacity.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/View.js",
3
3
  "module": "../../../lib/module/components/native/View.js",
4
+ "browser": "../../../lib/module/components/native/View.js",
4
5
  "react-native": "../../../src/components/native/View.tsx"
5
6
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "main": "../../../lib/commonjs/components/native/VirtualizedList.js",
3
3
  "module": "../../../lib/module/components/native/VirtualizedList.js",
4
+ "browser": "../../../lib/module/components/native/VirtualizedList.js",
4
5
  "react-native": "../../../src/components/native/VirtualizedList.tsx"
5
6
  }
@@ -122,6 +122,10 @@ inline Variants variantsToPairs(jsi::Runtime& rt, jsi::Object&& variants) {
122
122
  if (variantValue.isString()) {
123
123
  pairs.emplace_back(std::make_pair(variantName, variantValue.asString(rt).utf8(rt)));
124
124
  }
125
+
126
+ if (variantValue.isNumber()) {
127
+ pairs.emplace_back(std::make_pair(variantName, std::to_string(static_cast<int>(variantValue.asNumber()))));
128
+ }
125
129
  });
126
130
 
127
131
  return pairs;
@@ -87,19 +87,28 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
87
87
  Variants variants = helpers::variantsToPairs(rt, arguments[0].asObject(rt));
88
88
  parser::Parser parser = parser::Parser(this->_unistylesRuntime);
89
89
 
90
- helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants](const std::string& name, jsi::Value& value){
91
- if (name == helpers::ADD_VARIANTS_FN || !this->_stylesheet->unistyles.contains(name)) {
90
+ auto stylesheetCopy = std::make_shared<StyleSheet>(
91
+ this->_stylesheet->tag,
92
+ this->_stylesheet->type,
93
+ jsi::Value(rt, this->_stylesheet->rawValue).asObject(rt)
94
+ );
95
+
96
+ parser.buildUnistyles(rt, stylesheetCopy);
97
+ parser.parseUnistyles(rt, stylesheetCopy);
98
+
99
+ helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants, stylesheetCopy](const std::string& name, jsi::Value& value){
100
+ if (name == helpers::ADD_VARIANTS_FN || !stylesheetCopy->unistyles.contains(name)) {
92
101
  return;
93
102
  }
94
103
 
95
- auto unistyle = this->_stylesheet->unistyles[name];
96
-
104
+ auto unistyle = stylesheetCopy->unistyles[name];
105
+
97
106
  if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) {
98
107
  parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt);
99
108
  }
100
109
  });
101
110
 
102
- auto style = std::make_shared<core::HostUnistyle>(this->_stylesheet, this->_unistylesRuntime, variants);
111
+ auto style = std::make_shared<core::HostUnistyle>(stylesheetCopy, this->_unistylesRuntime, variants);
103
112
  auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
104
113
 
105
114
  return styleHostObject;
@@ -3,7 +3,7 @@
3
3
  #include <jsi/jsi.h>
4
4
  #include "Unistyle.h"
5
5
  #include "Helpers.h"
6
- #include "Constants.h"
6
+ #include "UnistylesConstants.h"
7
7
 
8
8
  namespace margelo::nitro::unistyles::core {
9
9
 
@@ -5,7 +5,7 @@
5
5
  #include "UnistylesRegistry.h"
6
6
  #include "Helpers.h"
7
7
  #include "HybridUnistylesRuntime.h"
8
- #include "Constants.h"
8
+ #include "UnistylesConstants.h"
9
9
  #include "Parser.h"
10
10
 
11
11
  namespace margelo::nitro::unistyles::core {
@@ -8,32 +8,11 @@ namespace margelo::nitro::unistyles::core {
8
8
  // React Native uses 0-10
9
9
  // Reanimated uses 27-28
10
10
  constexpr shadow::ShadowNodeTraits::Trait UnistylesCommitTrait{1 << 30};
11
- constexpr shadow::ShadowNodeTraits::Trait UnistylesMountTrait{1 << 31};
12
11
 
13
12
  struct UnistylesCommitShadowNode: public shadow::ShadowNode {
14
13
  inline void addUnistylesCommitTrait() {
15
14
  traits_.set(UnistylesCommitTrait);
16
15
  }
17
-
18
- inline void removeUnistylesCommitTrait() {
19
- traits_.unset(UnistylesCommitTrait);
20
- }
21
-
22
- inline bool hasUnistylesCommitTrait() {
23
- return traits_.check(UnistylesCommitTrait);
24
- }
25
-
26
- inline void addUnistylesMountTrait() {
27
- traits_.set(UnistylesMountTrait);
28
- }
29
-
30
- inline void removeUnistylesMountTrait() {
31
- traits_.unset(UnistylesMountTrait);
32
- }
33
-
34
- inline bool hasUnistylesMountTrait() {
35
- return traits_.check(UnistylesMountTrait);
36
- }
37
16
  };
38
17
 
39
18
  }