react-native-unistyles 3.0.0-alpha.26 → 3.0.0-alpha.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/cxx/core/UnistylesRegistry.cpp +4 -8
  2. package/cxx/core/UnistylesRegistry.h +1 -1
  3. package/cxx/core/UnistylesState.cpp +6 -10
  4. package/cxx/core/UnistylesState.h +2 -1
  5. package/cxx/hybridObjects/HybridStyleSheet.cpp +5 -2
  6. package/cxx/parser/Parser.cpp +73 -4
  7. package/cxx/parser/Parser.h +2 -0
  8. package/lib/commonjs/core/index.js.map +1 -1
  9. package/lib/commonjs/core/useTheme.js.map +1 -1
  10. package/lib/commonjs/core/useTheme.native.js.map +1 -1
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/mq.js +1 -4
  13. package/lib/commonjs/mq.js.map +2 -1
  14. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -0
  15. package/lib/commonjs/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +1 -1
  16. package/lib/commonjs/specs/NavigtionBar/index.js.map +2 -1
  17. package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -1
  18. package/lib/commonjs/specs/ShadowRegistry/types.js +3 -0
  19. package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
  20. package/lib/commonjs/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
  21. package/lib/commonjs/specs/StatusBar/index.js.map +2 -1
  22. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +2 -4
  23. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
  24. package/lib/commonjs/specs/index.js.map +1 -1
  25. package/lib/commonjs/specs/types.js +10 -10
  26. package/lib/commonjs/specs/types.js.map +1 -1
  27. package/lib/commonjs/types/stylesheet.js.map +1 -1
  28. package/lib/commonjs/web/convert/index.js +1 -7
  29. package/lib/commonjs/web/convert/shadow.js +1 -5
  30. package/lib/commonjs/web/convert/shadow.js.map +2 -1
  31. package/lib/commonjs/web/convert/textShadow.js +1 -4
  32. package/lib/commonjs/web/convert/textShadow.js.map +2 -1
  33. package/lib/commonjs/web/convert/transform.js.map +2 -1
  34. package/lib/commonjs/web/create.js +1 -5
  35. package/lib/commonjs/web/create.js.map +2 -1
  36. package/lib/commonjs/web/mock.js.map +2 -1
  37. package/lib/commonjs/web/runtime.js.map +2 -1
  38. package/lib/commonjs/web/state.js.map +1 -1
  39. package/lib/commonjs/web/utils/common.js +1 -3
  40. package/lib/commonjs/web/utils/common.js.map +2 -1
  41. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  42. package/lib/commonjs/web/variants/index.js.map +1 -1
  43. package/lib/module/common.js.map +1 -1
  44. package/lib/module/core/useBreakpoint.js.map +1 -1
  45. package/lib/module/core/useBreakpoint.native.js.map +2 -1
  46. package/lib/module/core/useTheme.js.map +2 -1
  47. package/lib/module/core/useTheme.native.js.map +2 -1
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/mq.js +1 -4
  50. package/lib/module/mq.js.map +2 -1
  51. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +5 -6
  52. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  53. package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +1 -1
  54. package/lib/module/specs/NavigtionBar/index.js.map +2 -1
  55. package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -0
  56. package/lib/module/specs/ShadowRegistry/index.js.map +2 -1
  57. package/lib/module/specs/ShadowRegistry/types.js +2 -0
  58. package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
  59. package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
  60. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
  61. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -0
  62. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +2 -3
  63. package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +2 -1
  64. package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
  65. package/lib/module/specs/index.web.js.map +2 -1
  66. package/lib/module/specs/types.js.map +1 -1
  67. package/lib/module/types/stylesheet.js.map +1 -1
  68. package/lib/module/web/convert/boxShadow.js +1 -4
  69. package/lib/module/web/convert/boxShadow.js.map +2 -1
  70. package/lib/module/web/convert/pseudo.js.map +2 -1
  71. package/lib/module/web/convert/shadow.js +1 -5
  72. package/lib/module/web/convert/shadow.js.map +2 -1
  73. package/lib/module/web/convert/style.js.map +2 -1
  74. package/lib/module/web/convert/textShadow.js +1 -4
  75. package/lib/module/web/convert/textShadow.js.map +2 -1
  76. package/lib/module/web/convert/transform.js.map +2 -1
  77. package/lib/module/web/convert/utils.js.map +2 -1
  78. package/lib/module/web/index.js +1 -2
  79. package/lib/module/web/index.js.map +2 -1
  80. package/lib/module/web/listener.js.map +2 -1
  81. package/lib/module/web/mock.js.map +2 -1
  82. package/lib/module/web/registry.js +1 -3
  83. package/lib/module/web/registry.js.map +2 -1
  84. package/lib/module/web/runtime.js.map +2 -1
  85. package/lib/module/web/shadowRegistry.js +1 -9
  86. package/lib/module/web/shadowRegistry.js.map +2 -1
  87. package/lib/module/web/state.js.map +1 -1
  88. package/lib/module/web/utils/index.js.map +1 -1
  89. package/lib/module/web/utils/unistyle.js.map +2 -1
  90. package/lib/module/web/variants/index.js.map +1 -1
  91. package/lib/module/web/variants/useVariants.js +1 -2
  92. package/lib/module/web/variants/useVariants.js.map +2 -1
  93. package/lib/typescript/src/core/useBreakpoint.d.ts +1 -1
  94. package/lib/typescript/src/core/useBreakpoint.d.ts.map +1 -1
  95. package/lib/typescript/src/core/useBreakpoint.native.d.ts +1 -1
  96. package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +1 -1
  97. package/lib/typescript/src/core/useTheme.d.ts +2 -40
  98. package/lib/typescript/src/core/useTheme.d.ts.map +1 -1
  99. package/lib/typescript/src/core/useTheme.native.d.ts +2 -40
  100. package/lib/typescript/src/core/useTheme.native.d.ts.map +1 -1
  101. package/lib/typescript/src/types/stylesheet.d.ts +4 -2
  102. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  103. package/lib/typescript/src/types/variants.d.ts +1 -1
  104. package/lib/typescript/src/types/variants.d.ts.map +1 -1
  105. package/lib/typescript/src/web/create.d.ts +214 -1220
  106. package/lib/typescript/src/web/create.d.ts.map +1 -1
  107. package/lib/typescript/src/web/index.d.ts +214 -1220
  108. package/lib/typescript/src/web/index.d.ts.map +1 -1
  109. package/lib/typescript/src/web/runtime.d.ts +4 -4
  110. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  111. package/lib/typescript/src/web/state.d.ts +1 -2
  112. package/lib/typescript/src/web/state.d.ts.map +1 -1
  113. package/lib/typescript/src/web/utils/unistyle.d.ts +2 -2
  114. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  115. package/package.json +15 -16
  116. package/src/common.js +4 -0
  117. package/src/core/index.js +2 -0
  118. package/src/core/useBreakpoint.js +14 -0
  119. package/src/core/useBreakpoint.native.js +16 -0
  120. package/src/core/useTheme.js +14 -0
  121. package/src/core/useTheme.native.js +16 -0
  122. package/src/core/useTheme.native.ts +2 -1
  123. package/src/core/useTheme.ts +2 -1
  124. package/src/index.js +3 -0
  125. package/src/mq.js +38 -0
  126. package/src/specs/NativePlatform/NativePlatform.nitro.js +18 -0
  127. package/src/specs/NativePlatform/index.js +1 -0
  128. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +1 -0
  129. package/src/specs/NavigtionBar/index.js +9 -0
  130. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +1 -0
  131. package/src/specs/ShadowRegistry/index.js +26 -0
  132. package/src/specs/ShadowRegistry/types.js +1 -0
  133. package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +1 -0
  134. package/src/specs/StatusBar/index.js +25 -0
  135. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -0
  136. package/src/specs/StyleSheet/index.js +13 -0
  137. package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +2 -0
  138. package/src/specs/TurboUnistyles/index.js +1 -0
  139. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +1 -0
  140. package/src/specs/UnistylesRuntime/index.js +20 -0
  141. package/src/specs/index.js +8 -0
  142. package/src/specs/index.web.js +2 -0
  143. package/src/specs/types.js +17 -0
  144. package/src/types/stylesheet.ts +5 -3
  145. package/src/types/variants.ts +1 -1
  146. package/src/web/convert/boxShadow.js +59 -0
  147. package/src/web/convert/index.js +56 -0
  148. package/src/web/convert/pseudo.js +131 -0
  149. package/src/web/convert/shadow.js +50 -0
  150. package/src/web/convert/style.js +137 -0
  151. package/src/web/convert/textShadow.js +56 -0
  152. package/src/web/convert/transform.js +65 -0
  153. package/src/web/convert/types.js +2 -0
  154. package/src/web/convert/utils.js +39 -0
  155. package/src/web/create.js +39 -0
  156. package/src/web/index.js +22 -0
  157. package/src/web/listener.js +26 -0
  158. package/src/web/mock.js +21 -0
  159. package/src/web/mq.js +14 -0
  160. package/src/web/registry.js +168 -0
  161. package/src/web/runtime.js +160 -0
  162. package/src/web/runtime.ts +1 -1
  163. package/src/web/shadowRegistry.js +99 -0
  164. package/src/web/state.ts +3 -3
  165. package/src/web/utils/common.js +79 -0
  166. package/src/web/utils/index.js +2 -0
  167. package/src/web/utils/unistyle.js +72 -0
  168. package/src/web/utils/unistyle.ts +2 -2
  169. package/src/web/variants/getVariants.js +26 -0
  170. package/src/web/variants/index.js +2 -0
  171. package/src/web/variants/useVariants.js +50 -0
  172. package/lib/typescript/example/App.d.ts +0 -4
  173. package/lib/typescript/example/App.d.ts.map +0 -1
  174. package/lib/typescript/example/Typography.d.ts +0 -35
  175. package/lib/typescript/example/Typography.d.ts.map +0 -1
  176. package/lib/typescript/example/unistyles.d.ts +0 -63
  177. package/lib/typescript/example/unistyles.d.ts.map +0 -1
  178. package/lib/typescript/expo-example/App.d.ts +0 -4
  179. package/lib/typescript/expo-example/App.d.ts.map +0 -1
  180. package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts +0 -3
  181. package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts.map +0 -1
  182. package/lib/typescript/expo-example/app/(tabs)/explore.d.ts +0 -3
  183. package/lib/typescript/expo-example/app/(tabs)/explore.d.ts.map +0 -1
  184. package/lib/typescript/expo-example/app/(tabs)/index.d.ts +0 -3
  185. package/lib/typescript/expo-example/app/(tabs)/index.d.ts.map +0 -1
  186. package/lib/typescript/expo-example/app/+html.d.ts +0 -4
  187. package/lib/typescript/expo-example/app/+html.d.ts.map +0 -1
  188. package/lib/typescript/expo-example/app/+not-found.d.ts +0 -3
  189. package/lib/typescript/expo-example/app/+not-found.d.ts.map +0 -1
  190. package/lib/typescript/expo-example/app/_layout.d.ts +0 -3
  191. package/lib/typescript/expo-example/app/_layout.d.ts.map +0 -1
  192. package/lib/typescript/expo-example/unistyles.d.ts +0 -63
  193. package/lib/typescript/expo-example/unistyles.d.ts.map +0 -1
  194. package/plugin/__tests__/dependencies.spec.js +0 -448
  195. package/plugin/__tests__/ref.spec.js +0 -1427
  196. package/plugin/__tests__/stylesheet.spec.js +0 -507
@@ -1,507 +0,0 @@
1
- import { pluginTester } from 'babel-plugin-tester'
2
- import plugin from '../'
3
-
4
- pluginTester({
5
- plugin,
6
- pluginOptions: {
7
- debug: false
8
- },
9
- babelOptions: {
10
- plugins: ['@babel/plugin-syntax-jsx'],
11
- generatorOpts: {
12
- retainLines: true
13
- }
14
- },
15
- tests: [
16
- {
17
- title: 'Should not add dependencies to StyleSheet if user is not using theme or miniRuntime',
18
- code: `
19
- import { View, Text } from 'react-native'
20
- import { StyleSheet } from 'react-native-unistyles'
21
-
22
- export const Example = () => {
23
- return (
24
- <View style={styles.container}>
25
- <Text>Hello world</Text>
26
- </View>
27
- )
28
- }
29
-
30
- const styles = StyleSheet.create({
31
- container: {
32
- backgroundColor: 'red'
33
- }
34
- })
35
- `,
36
- output: `
37
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
38
- import { View, Text } from 'react-native'
39
- import { StyleSheet } from 'react-native-unistyles'
40
-
41
- export const Example = () => {
42
- return (
43
- <View
44
- style={[styles.container]}
45
- ref={ref => {
46
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
47
- return () => UnistylesShadowRegistry.remove(ref)
48
- }}
49
- >
50
- <Text>Hello world</Text>
51
- </View>
52
- )
53
- }
54
-
55
- const styles = StyleSheet.create(
56
- {
57
- container: {
58
- backgroundColor: 'red'
59
- }
60
- },
61
- 793953373
62
- )
63
- `
64
- },
65
- {
66
- title: 'Should add dependencies to StyleSheet if user is using theme',
67
- code: `
68
- import { View, Text } from 'react-native'
69
- import { StyleSheet } from 'react-native-unistyles'
70
-
71
- export const Example = () => {
72
- return (
73
- <View style={styles.container}>
74
- <Text>Hello world</Text>
75
- </View>
76
- )
77
- }
78
-
79
- const styles = StyleSheet.create(theme => ({
80
- container: {
81
- backgroundColor: theme.colors.background
82
- }
83
- }))
84
- `,
85
- output: `
86
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
87
- import { View, Text } from 'react-native'
88
- import { StyleSheet } from 'react-native-unistyles'
89
-
90
- export const Example = () => {
91
- return (
92
- <View
93
- style={[styles.container]}
94
- ref={ref => {
95
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
96
- return () => UnistylesShadowRegistry.remove(ref)
97
- }}
98
- >
99
- <Text>Hello world</Text>
100
- </View>
101
- )
102
- }
103
-
104
- const styles = StyleSheet.create(
105
- theme => ({
106
- container: {
107
- backgroundColor: theme.colors.background,
108
- uni__dependencies: [0]
109
- }
110
- }),
111
- 793953373
112
- )
113
- `
114
- },
115
- {
116
- title: 'Should add dependencies to StyleSheet even if user did rename import',
117
- code: `
118
- import { View, Text } from 'react-native'
119
- import { StyleSheet as ST } from 'react-native-unistyles'
120
-
121
- export const Example = () => {
122
- return (
123
- <View style={styles.container}>
124
- <Text>Hello world</Text>
125
- </View>
126
- )
127
- }
128
-
129
- const styles = ST.create(theme => ({
130
- container: {
131
- backgroundColor: theme.colors.background
132
- }
133
- }))
134
- `,
135
- output: `
136
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
137
- import { View, Text } from 'react-native'
138
- import { StyleSheet as ST } from 'react-native-unistyles'
139
-
140
- export const Example = () => {
141
- return (
142
- <View
143
- style={[styles.container]}
144
- ref={ref => {
145
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
146
- return () => UnistylesShadowRegistry.remove(ref)
147
- }}
148
- >
149
- <Text>Hello world</Text>
150
- </View>
151
- )
152
- }
153
-
154
- const styles = ST.create(
155
- theme => ({
156
- container: {
157
- backgroundColor: theme.colors.background,
158
- uni__dependencies: [0]
159
- }
160
- }),
161
- 793953373
162
- )
163
- `
164
- },
165
- {
166
- title: 'Should detect variants for object StyleSheet',
167
- code: `
168
- import { View, Text } from 'react-native'
169
- import { StyleSheet } from 'react-native-unistyles'
170
-
171
- export const Example = () => {
172
- return (
173
- <View style={styles.container}>
174
- <Text>Hello world</Text>
175
- </View>
176
- )
177
- }
178
-
179
- const styles = StyleSheet.create({
180
- container: {
181
- backgroundColor: 'red',
182
- variants: {}
183
- }
184
- })
185
- `,
186
- output: `
187
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
188
- import { View, Text } from 'react-native'
189
- import { StyleSheet } from 'react-native-unistyles'
190
-
191
- export const Example = () => {
192
- return (
193
- <View
194
- style={[styles.container]}
195
- ref={ref => {
196
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
197
- return () => UnistylesShadowRegistry.remove(ref)
198
- }}
199
- >
200
- <Text>Hello world</Text>
201
- </View>
202
- )
203
- }
204
-
205
- const styles = StyleSheet.create(
206
- {
207
- container: {
208
- backgroundColor: 'red',
209
- variants: {},
210
- uni__dependencies: [4]
211
- }
212
- },
213
- 793953373
214
- )
215
- `
216
- },
217
- {
218
- title: 'Should detect variants for object StyleSheet and dynamic function',
219
- code: `
220
- import { View, Text } from 'react-native'
221
- import { StyleSheet } from 'react-native-unistyles'
222
-
223
- export const Example = () => {
224
- return (
225
- <View style={styles.container}>
226
- <Text>Hello world</Text>
227
- </View>
228
- )
229
- }
230
-
231
- const styles = StyleSheet.create({
232
- container: () => ({
233
- backgroundColor: 'red',
234
- variants: {}
235
- })
236
- })
237
- `,
238
- output: `
239
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
240
- import { View, Text } from 'react-native'
241
- import { StyleSheet } from 'react-native-unistyles'
242
-
243
- export const Example = () => {
244
- return (
245
- <View
246
- style={[styles.container]}
247
- ref={ref => {
248
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
249
- return () => UnistylesShadowRegistry.remove(ref)
250
- }}
251
- >
252
- <Text>Hello world</Text>
253
- </View>
254
- )
255
- }
256
-
257
- const styles = StyleSheet.create(
258
- {
259
- container: () => ({
260
- backgroundColor: 'red',
261
- variants: {},
262
- uni__dependencies: [4]
263
- })
264
- },
265
- 793953373
266
- )
267
- `
268
- },
269
- {
270
- title: 'Should detect miniRuntime dependency',
271
- code: `
272
- import { View, Text } from 'react-native'
273
- import { StyleSheet } from 'react-native-unistyles'
274
-
275
- export const Example = () => {
276
- return (
277
- <View style={styles.container}>
278
- <Text>Hello world</Text>
279
- </View>
280
- )
281
- }
282
-
283
- const styles = StyleSheet.create((_, rt) => ({
284
- container: () => ({
285
- backgroundColor: 'red',
286
- variants: {},
287
- paddingTop: rt.insets.top
288
- })
289
- }))
290
- `,
291
- output: `
292
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
293
- import { View, Text } from 'react-native'
294
- import { StyleSheet } from 'react-native-unistyles'
295
-
296
- export const Example = () => {
297
- return (
298
- <View
299
- style={[styles.container]}
300
- ref={ref => {
301
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
302
- return () => UnistylesShadowRegistry.remove(ref)
303
- }}
304
- >
305
- <Text>Hello world</Text>
306
- </View>
307
- )
308
- }
309
-
310
- const styles = StyleSheet.create(
311
- (_, rt) => ({
312
- container: () => ({
313
- backgroundColor: 'red',
314
- variants: {},
315
- paddingTop: rt.insets.top,
316
- uni__dependencies: [4, 9]
317
- })
318
- }),
319
- 793953373
320
- )
321
- `
322
- },
323
- {
324
- title: 'Should detect miniRuntime and theme dependencies even if user renamed it\'s names',
325
- code: `
326
- import { View, Text } from 'react-native'
327
- import { StyleSheet } from 'react-native-unistyles'
328
-
329
- export const Example = () => {
330
- return (
331
- <View style={styles.container}>
332
- <Text>Hello world</Text>
333
- </View>
334
- )
335
- }
336
-
337
- const styles = StyleSheet.create((hhsa, dee) => ({
338
- container: () => ({
339
- backgroundColor: hhsa.colors.background,
340
- variants: {},
341
- paddingTop: dee.colorScheme === 'dark' ? 0 : 10
342
- })
343
- }))
344
- `,
345
- output: `
346
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
347
- import { View, Text } from 'react-native'
348
- import { StyleSheet } from 'react-native-unistyles'
349
-
350
- export const Example = () => {
351
- return (
352
- <View
353
- style={[styles.container]}
354
- ref={ref => {
355
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
356
- return () => UnistylesShadowRegistry.remove(ref)
357
- }}
358
- >
359
- <Text>Hello world</Text>
360
- </View>
361
- )
362
- }
363
-
364
- const styles = StyleSheet.create(
365
- (hhsa, dee) => ({
366
- container: () => ({
367
- backgroundColor: hhsa.colors.background,
368
- variants: {},
369
- paddingTop: dee.colorScheme === 'dark' ? 0 : 10,
370
- uni__dependencies: [0, 4, 5]
371
- })
372
- }),
373
- 793953373
374
- )
375
- `
376
- },
377
- {
378
- title: 'Should detect dependencies in function',
379
- code: `
380
- import { View, Text } from 'react-native'
381
- import { StyleSheet } from 'react-native-unistyles'
382
-
383
- export const Example = () => {
384
- return (
385
- <View style={styles.container}>
386
- <Text>Hello world</Text>
387
- </View>
388
- )
389
- }
390
-
391
- const styles = StyleSheet.create((theme, rt) => {
392
- return {
393
- container: () => ({
394
- backgroundColor: theme.colors.background,
395
- variants: {},
396
- paddingTop: rt.insets.top
397
- })
398
- }
399
- })
400
- `,
401
- output: `
402
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
403
- import { View, Text } from 'react-native'
404
- import { StyleSheet } from 'react-native-unistyles'
405
-
406
- export const Example = () => {
407
- return (
408
- <View
409
- style={[styles.container]}
410
- ref={ref => {
411
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
412
- return () => UnistylesShadowRegistry.remove(ref)
413
- }}
414
- >
415
- <Text>Hello world</Text>
416
- </View>
417
- )
418
- }
419
-
420
- const styles = StyleSheet.create((theme, rt) => {
421
- return {
422
- container: () => ({
423
- backgroundColor: theme.colors.background,
424
- variants: {},
425
- paddingTop: rt.insets.top,
426
- uni__dependencies: [0, 4, 9]
427
- })
428
- }
429
- }, 793953373)
430
- `
431
- },
432
- {
433
- title: 'Should generates two different ids for 2 stylesheets in the same file',
434
- code: `
435
- import { View, Text } from 'react-native'
436
- import { StyleSheet } from 'react-native-unistyles'
437
-
438
- export const Example = () => {
439
- return (
440
- <View style={styles.container}>
441
- <Text>Hello world</Text>
442
- </View>
443
- )
444
- }
445
-
446
- const styles = StyleSheet.create((theme, rt) => {
447
- return {
448
- container: () => ({
449
- backgroundColor: theme.colors.background,
450
- variants: {},
451
- paddingTop: rt.insets.top
452
- })
453
- }
454
- })
455
- const styles2 = StyleSheet.create((theme, rt) => {
456
- return {
457
- container: () => ({
458
- backgroundColor: theme.colors.background,
459
- variants: {},
460
- paddingTop: rt.insets.top
461
- })
462
- }
463
- })
464
- `,
465
- output: `
466
- import { UnistylesShadowRegistry } from 'react-native-unistyles'
467
- import { View, Text } from 'react-native'
468
- import { StyleSheet } from 'react-native-unistyles'
469
-
470
- export const Example = () => {
471
- return (
472
- <View
473
- style={[styles.container]}
474
- ref={ref => {
475
- UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
476
- return () => UnistylesShadowRegistry.remove(ref)
477
- }}
478
- >
479
- <Text>Hello world</Text>
480
- </View>
481
- )
482
- }
483
-
484
- const styles = StyleSheet.create((theme, rt) => {
485
- return {
486
- container: () => ({
487
- backgroundColor: theme.colors.background,
488
- variants: {},
489
- paddingTop: rt.insets.top,
490
- uni__dependencies: [0, 4, 9]
491
- })
492
- }
493
- }, 793953373)
494
- const styles2 = StyleSheet.create((theme, rt) => {
495
- return {
496
- container: () => ({
497
- backgroundColor: theme.colors.background,
498
- variants: {},
499
- paddingTop: rt.insets.top,
500
- uni__dependencies: [0, 4, 9]
501
- })
502
- }
503
- }, 793953374)
504
- `
505
- },
506
- ]
507
- })