react-native-unistyles 3.0.0-alpha.6 → 3.0.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +24 -0
- package/cxx/core/HostStyle.cpp +4 -5
- package/cxx/core/HostStyle.h +4 -0
- package/cxx/core/StyleSheet.h +0 -1
- package/cxx/core/StyleSheetRegistry.cpp +9 -17
- package/cxx/core/StyleSheetRegistry.h +3 -4
- package/cxx/core/UnistyleData.h +22 -0
- package/cxx/core/UnistylesCommitHook.cpp +4 -1
- package/cxx/core/UnistylesRegistry.cpp +33 -49
- package/cxx/core/UnistylesRegistry.h +8 -8
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +4 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +8 -11
- package/cxx/parser/Parser.cpp +41 -57
- package/cxx/parser/Parser.h +8 -13
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +77 -0
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/breakpoint.js +25 -0
- package/lib/commonjs/web/convert/breakpoint.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +76 -0
- package/lib/commonjs/web/convert/index.js.map +1 -0
- package/lib/commonjs/web/convert/module.d.js +2 -0
- package/lib/commonjs/web/convert/module.d.js.map +1 -0
- package/lib/commonjs/web/convert/shadow.js +68 -0
- package/lib/commonjs/web/convert/shadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +89 -0
- package/lib/commonjs/web/convert/style.js.map +1 -0
- package/lib/commonjs/web/convert/textShadow.js +73 -0
- package/lib/commonjs/web/convert/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/transform.js +72 -0
- package/lib/commonjs/web/convert/transform.js.map +1 -0
- package/lib/commonjs/web/convert/types.js +9 -0
- package/lib/commonjs/web/convert/types.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +55 -0
- package/lib/commonjs/web/convert/utils.js.map +1 -0
- package/lib/commonjs/web/create.js +89 -0
- package/lib/commonjs/web/create.js.map +1 -0
- package/lib/commonjs/web/index.js +51 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/listener/index.js +13 -0
- package/lib/commonjs/web/listener/index.js.map +1 -0
- package/lib/commonjs/web/listener/listener.js +36 -0
- package/lib/commonjs/web/listener/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +37 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/mq.js +23 -0
- package/lib/commonjs/web/mq.js.map +1 -0
- package/lib/commonjs/web/pseudo.js +11 -0
- package/lib/commonjs/web/pseudo.js.map +1 -0
- package/lib/commonjs/web/registry.js +37 -0
- package/lib/commonjs/web/registry.js.map +1 -0
- package/lib/commonjs/web/runtime.js +164 -0
- package/lib/commonjs/web/runtime.js.map +1 -0
- package/lib/commonjs/web/state.js +121 -0
- package/lib/commonjs/web/state.js.map +1 -0
- package/lib/commonjs/web/utils.js +78 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +1 -0
- package/lib/commonjs/web/variants/index.js +28 -0
- package/lib/commonjs/web/variants/index.js.map +1 -0
- package/lib/commonjs/web/variants/useVariants.js +75 -0
- package/lib/commonjs/web/variants/useVariants.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +2 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/index.web.js +1 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/web/convert/boxShadow.js +72 -0
- package/lib/module/web/convert/boxShadow.js.map +1 -0
- package/lib/module/web/convert/breakpoint.js +20 -0
- package/lib/module/web/convert/breakpoint.js.map +1 -0
- package/lib/module/web/convert/index.js +71 -0
- package/lib/module/web/convert/index.js.map +1 -0
- package/lib/module/web/convert/module.d.js +2 -0
- package/lib/module/web/convert/module.d.js.map +1 -0
- package/lib/module/web/convert/shadow.js +63 -0
- package/lib/module/web/convert/shadow.js.map +1 -0
- package/lib/module/web/convert/style.js +84 -0
- package/lib/module/web/convert/style.js.map +1 -0
- package/lib/module/web/convert/textShadow.js +68 -0
- package/lib/module/web/convert/textShadow.js.map +1 -0
- package/lib/module/web/convert/transform.js +67 -0
- package/lib/module/web/convert/transform.js.map +1 -0
- package/lib/module/web/convert/types.js +5 -0
- package/lib/module/web/convert/types.js.map +1 -0
- package/lib/module/web/convert/utils.js +43 -0
- package/lib/module/web/convert/utils.js.map +1 -0
- package/lib/module/web/create.js +84 -0
- package/lib/module/web/create.js.map +1 -0
- package/lib/module/web/index.js +24 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener/index.js +4 -0
- package/lib/module/web/listener/index.js.map +1 -0
- package/lib/module/web/listener/listener.js +31 -0
- package/lib/module/web/listener/listener.js.map +1 -0
- package/lib/module/web/mock.js +33 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/mq.js +17 -0
- package/lib/module/web/mq.js.map +1 -0
- package/lib/module/web/pseudo.js +6 -0
- package/lib/module/web/pseudo.js.map +1 -0
- package/lib/module/web/registry.js +33 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +160 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/state.js +117 -0
- package/lib/module/web/state.js.map +1 -0
- package/lib/module/web/utils.js +65 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web/variants/getVariants.js +34 -0
- package/lib/module/web/variants/getVariants.js.map +1 -0
- package/lib/module/web/variants/index.js +5 -0
- package/lib/module/web/variants/index.js.map +1 -0
- package/lib/module/web/variants/useVariants.js +70 -0
- package/lib/module/web/variants/useVariants.js.map +1 -0
- package/lib/typescript/example/App.d.ts.map +1 -1
- package/lib/typescript/example/Typography.d.ts +11 -0
- package/lib/typescript/example/Typography.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +1 -1
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/index.d.ts +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/create.d.ts +11 -11
- package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
- package/lib/typescript/{web → src/web}/index.d.ts +12 -12
- package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener/index.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/listener/listener.d.ts +1 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/mock.d.ts +2 -2
- package/lib/typescript/src/web/mock.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts.map +1 -0
- package/lib/typescript/src/web/pseudo.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +6 -6
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/state.d.ts +4 -4
- package/lib/typescript/src/web/state.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/utils.d.ts +5 -3
- package/lib/typescript/src/web/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/index.d.ts +3 -0
- package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
- package/package.json +1 -1
- package/plugin/__tests__/dependencies.spec.js +181 -103
- package/plugin/__tests__/ref.spec.js +346 -156
- package/plugin/__tests__/stylesheet.spec.js +148 -55
- package/plugin/index.js +31 -21
- package/plugin/ref.js +67 -15
- package/plugin/style.js +13 -24
- package/plugin/stylesheet.js +44 -1
- package/plugin/variants.js +33 -0
- package/src/specs/ShadowRegistry/index.ts +4 -4
- package/src/specs/StyleSheet/index.ts +3 -1
- package/src/specs/index.web.ts +1 -1
- package/src/types/stylesheet.ts +1 -1
- package/{web → src/web}/convert/breakpoint.ts +1 -1
- package/{web → src/web}/convert/index.ts +1 -1
- package/{web → src/web}/convert/types.ts +1 -1
- package/{web → src/web}/create.ts +36 -33
- package/{web → src/web}/listener/listener.ts +1 -1
- package/{web → src/web}/mock.ts +2 -2
- package/{web → src/web}/registry.ts +1 -1
- package/{web → src/web}/runtime.ts +4 -4
- package/{web → src/web}/state.ts +5 -5
- package/{web → src/web}/utils.ts +5 -5
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.ts +2 -0
- package/{web → src/web/variants}/useVariants.ts +24 -44
- package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/web/convert/index.d.ts.map +0 -1
- package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/style.d.ts.map +0 -1
- package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/web/convert/types.d.ts.map +0 -1
- package/lib/typescript/web/convert/utils.d.ts.map +0 -1
- package/lib/typescript/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/web/mock.d.ts.map +0 -1
- package/lib/typescript/web/mq.d.ts.map +0 -1
- package/lib/typescript/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/web/registry.d.ts.map +0 -1
- package/lib/typescript/web/runtime.d.ts.map +0 -1
- package/lib/typescript/web/state.d.ts.map +0 -1
- package/lib/typescript/web/useVariants.d.ts +0 -3
- package/lib/typescript/web/useVariants.d.ts.map +0 -1
- package/lib/typescript/web/utils.d.ts.map +0 -1
- /package/lib/typescript/{web → src/web}/convert/boxShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/breakpoint.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/style.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/textShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/transform.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/listener/index.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/mq.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/pseudo.d.ts +0 -0
- /package/{web → src/web}/convert/boxShadow.ts +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
- /package/{web → src/web}/convert/shadow.ts +0 -0
- /package/{web → src/web}/convert/style.ts +0 -0
- /package/{web → src/web}/convert/textShadow.ts +0 -0
- /package/{web → src/web}/convert/transform.ts +0 -0
- /package/{web → src/web}/convert/utils.ts +0 -0
- /package/{web → src/web}/index.ts +0 -0
- /package/{web → src/web}/listener/index.ts +0 -0
- /package/{web → src/web}/mq.ts +0 -0
- /package/{web → src/web}/pseudo.ts +0 -0
@@ -78,7 +78,7 @@ pluginTester({
|
|
78
78
|
<View
|
79
79
|
style={styles.container}
|
80
80
|
ref={ref => {
|
81
|
-
UnistylesShadowRegistry.add(ref, styles.container)
|
81
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
82
82
|
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
83
83
|
}}
|
84
84
|
>
|
@@ -130,8 +130,8 @@ pluginTester({
|
|
130
130
|
return (
|
131
131
|
<View
|
132
132
|
ref={_ref => {
|
133
|
-
ref = _ref
|
134
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
133
|
+
ref.current = _ref
|
134
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
135
135
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
136
136
|
}}
|
137
137
|
style={styles.container}
|
@@ -141,11 +141,14 @@ pluginTester({
|
|
141
141
|
)
|
142
142
|
}
|
143
143
|
|
144
|
-
const styles = StyleSheet.create(
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
144
|
+
const styles = StyleSheet.create(
|
145
|
+
{
|
146
|
+
container: {
|
147
|
+
backgroundColor: 'red'
|
148
|
+
}
|
149
|
+
},
|
150
|
+
921918562
|
151
|
+
)
|
149
152
|
`
|
150
153
|
},
|
151
154
|
{
|
@@ -155,13 +158,13 @@ pluginTester({
|
|
155
158
|
import { StyleSheet } from 'react-native-unistyles'
|
156
159
|
|
157
160
|
export const Example = () => {
|
158
|
-
|
161
|
+
const myRef = useRef()
|
159
162
|
|
160
163
|
return (
|
161
164
|
<View
|
162
165
|
ref={ref => {
|
163
166
|
doSomething(ref)
|
164
|
-
myRef = ref
|
167
|
+
myRef.current = ref
|
165
168
|
}}
|
166
169
|
style={styles.container}
|
167
170
|
>
|
@@ -182,14 +185,14 @@ pluginTester({
|
|
182
185
|
import { StyleSheet } from 'react-native-unistyles'
|
183
186
|
|
184
187
|
export const Example = () => {
|
185
|
-
|
188
|
+
const myRef = useRef()
|
186
189
|
|
187
190
|
return (
|
188
191
|
<View
|
189
192
|
ref={ref => {
|
190
193
|
doSomething(ref)
|
191
|
-
myRef = ref
|
192
|
-
UnistylesShadowRegistry.add(ref, styles.container)
|
194
|
+
myRef.current = ref
|
195
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
193
196
|
return () => {
|
194
197
|
UnistylesShadowRegistry.remove(ref, styles.container)
|
195
198
|
}
|
@@ -201,11 +204,14 @@ pluginTester({
|
|
201
204
|
)
|
202
205
|
}
|
203
206
|
|
204
|
-
const styles = StyleSheet.create(
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
207
|
+
const styles = StyleSheet.create(
|
208
|
+
{
|
209
|
+
container: {
|
210
|
+
backgroundColor: 'red'
|
211
|
+
}
|
212
|
+
},
|
213
|
+
921918562
|
214
|
+
)
|
209
215
|
`
|
210
216
|
},
|
211
217
|
{
|
@@ -215,13 +221,13 @@ pluginTester({
|
|
215
221
|
import { StyleSheet } from 'react-native-unistyles'
|
216
222
|
|
217
223
|
export const Example = () => {
|
218
|
-
|
224
|
+
const myRef = React.useRef()
|
219
225
|
|
220
226
|
return (
|
221
227
|
<View
|
222
228
|
ref={ref => {
|
223
229
|
doSomething(ref)
|
224
|
-
myRef = ref
|
230
|
+
myRef.current = ref
|
225
231
|
|
226
232
|
return () => {
|
227
233
|
customCleanup()
|
@@ -246,14 +252,14 @@ pluginTester({
|
|
246
252
|
import { StyleSheet } from 'react-native-unistyles'
|
247
253
|
|
248
254
|
export const Example = () => {
|
249
|
-
|
255
|
+
const myRef = React.useRef()
|
250
256
|
|
251
257
|
return (
|
252
258
|
<View
|
253
259
|
ref={ref => {
|
254
260
|
doSomething(ref)
|
255
|
-
myRef = ref
|
256
|
-
UnistylesShadowRegistry.add(ref, styles.container)
|
261
|
+
myRef.current = ref
|
262
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
257
263
|
return () => {
|
258
264
|
;(() => {
|
259
265
|
customCleanup()
|
@@ -268,11 +274,14 @@ pluginTester({
|
|
268
274
|
)
|
269
275
|
}
|
270
276
|
|
271
|
-
const styles = StyleSheet.create(
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
277
|
+
const styles = StyleSheet.create(
|
278
|
+
{
|
279
|
+
container: {
|
280
|
+
backgroundColor: 'red'
|
281
|
+
}
|
282
|
+
},
|
283
|
+
921918562
|
284
|
+
)
|
276
285
|
`
|
277
286
|
},
|
278
287
|
{
|
@@ -282,10 +291,10 @@ pluginTester({
|
|
282
291
|
import { StyleSheet } from 'react-native-unistyles'
|
283
292
|
|
284
293
|
export const Example = () => {
|
285
|
-
|
294
|
+
const myRef = React.useRef()
|
286
295
|
const fn = ref => {
|
287
296
|
doSomething(ref)
|
288
|
-
myRef = ref
|
297
|
+
myRef.current = ref
|
289
298
|
|
290
299
|
return () => {
|
291
300
|
customCleanup2()
|
@@ -314,17 +323,17 @@ pluginTester({
|
|
314
323
|
import { StyleSheet } from 'react-native-unistyles'
|
315
324
|
|
316
325
|
export const Example = () => {
|
317
|
-
|
326
|
+
const myRef = React.useRef()
|
318
327
|
const fn = ref => {
|
319
328
|
doSomething(ref)
|
320
|
-
myRef = ref
|
329
|
+
myRef.current = ref
|
321
330
|
}
|
322
331
|
|
323
332
|
return (
|
324
333
|
<View
|
325
334
|
ref={_ref => {
|
326
335
|
fn(_ref)
|
327
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
336
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
328
337
|
return () => {
|
329
338
|
;(() => {
|
330
339
|
customCleanup2()
|
@@ -339,11 +348,14 @@ pluginTester({
|
|
339
348
|
)
|
340
349
|
}
|
341
350
|
|
342
|
-
const styles = StyleSheet.create(
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
351
|
+
const styles = StyleSheet.create(
|
352
|
+
{
|
353
|
+
container: {
|
354
|
+
backgroundColor: 'red'
|
355
|
+
}
|
356
|
+
},
|
357
|
+
921918562
|
358
|
+
)
|
347
359
|
`
|
348
360
|
},
|
349
361
|
{
|
@@ -353,10 +365,10 @@ pluginTester({
|
|
353
365
|
import { StyleSheet } from 'react-native-unistyles'
|
354
366
|
|
355
367
|
export const Example = () => {
|
356
|
-
|
368
|
+
const myRef = React.useRef()
|
357
369
|
function fn(ref) {
|
358
370
|
doSomething(ref)
|
359
|
-
myRef = ref
|
371
|
+
myRef.current = ref
|
360
372
|
|
361
373
|
return () => {
|
362
374
|
customCleanup2()
|
@@ -385,17 +397,17 @@ pluginTester({
|
|
385
397
|
import { StyleSheet } from 'react-native-unistyles'
|
386
398
|
|
387
399
|
export const Example = () => {
|
388
|
-
|
400
|
+
const myRef = React.useRef()
|
389
401
|
function fn(ref) {
|
390
402
|
doSomething(ref)
|
391
|
-
myRef = ref
|
403
|
+
myRef.current = ref
|
392
404
|
}
|
393
405
|
|
394
406
|
return (
|
395
407
|
<View
|
396
408
|
ref={_ref => {
|
397
409
|
fn(_ref)
|
398
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
410
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
399
411
|
return () => {
|
400
412
|
;(() => {
|
401
413
|
customCleanup2()
|
@@ -410,11 +422,14 @@ pluginTester({
|
|
410
422
|
)
|
411
423
|
}
|
412
424
|
|
413
|
-
const styles = StyleSheet.create(
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
425
|
+
const styles = StyleSheet.create(
|
426
|
+
{
|
427
|
+
container: {
|
428
|
+
backgroundColor: 'red'
|
429
|
+
}
|
430
|
+
},
|
431
|
+
921918562
|
432
|
+
)
|
418
433
|
`
|
419
434
|
},
|
420
435
|
{
|
@@ -424,7 +439,7 @@ pluginTester({
|
|
424
439
|
import { StyleSheet } from 'react-native-unistyles'
|
425
440
|
|
426
441
|
export const Example = () => {
|
427
|
-
|
442
|
+
const myRef = useRef()
|
428
443
|
|
429
444
|
return (
|
430
445
|
<View
|
@@ -449,7 +464,7 @@ pluginTester({
|
|
449
464
|
import { StyleSheet } from 'react-native-unistyles'
|
450
465
|
|
451
466
|
export const Example = () => {
|
452
|
-
|
467
|
+
const myRef = useRef()
|
453
468
|
|
454
469
|
return (
|
455
470
|
<View
|
@@ -463,11 +478,14 @@ pluginTester({
|
|
463
478
|
)
|
464
479
|
}
|
465
480
|
|
466
|
-
const styles = StyleSheet.create(
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
481
|
+
const styles = StyleSheet.create(
|
482
|
+
{
|
483
|
+
container: {
|
484
|
+
backgroundColor: 'red'
|
485
|
+
}
|
486
|
+
},
|
487
|
+
921918562
|
488
|
+
)
|
471
489
|
`
|
472
490
|
},
|
473
491
|
{
|
@@ -477,7 +495,7 @@ pluginTester({
|
|
477
495
|
import { StyleSheet } from 'react-native-unistyles'
|
478
496
|
|
479
497
|
export const Example = () => {
|
480
|
-
|
498
|
+
const myRef = useRef()
|
481
499
|
|
482
500
|
return (
|
483
501
|
<View
|
@@ -503,7 +521,7 @@ pluginTester({
|
|
503
521
|
import { StyleSheet } from 'react-native-unistyles'
|
504
522
|
|
505
523
|
export const Example = () => {
|
506
|
-
|
524
|
+
const myRef = useRef()
|
507
525
|
|
508
526
|
return (
|
509
527
|
<View
|
@@ -518,11 +536,14 @@ pluginTester({
|
|
518
536
|
)
|
519
537
|
}
|
520
538
|
|
521
|
-
const styles = StyleSheet.create(
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
539
|
+
const styles = StyleSheet.create(
|
540
|
+
{
|
541
|
+
container: {
|
542
|
+
backgroundColor: 'red'
|
543
|
+
}
|
544
|
+
},
|
545
|
+
921918562
|
546
|
+
)
|
526
547
|
`
|
527
548
|
},
|
528
549
|
{
|
@@ -532,7 +553,7 @@ pluginTester({
|
|
532
553
|
import { StyleSheet } from 'react-native-unistyles'
|
533
554
|
|
534
555
|
export const Example = () => {
|
535
|
-
|
556
|
+
const myRef = useRef()
|
536
557
|
|
537
558
|
return (
|
538
559
|
<View
|
@@ -555,7 +576,7 @@ pluginTester({
|
|
555
576
|
import { StyleSheet } from 'react-native-unistyles'
|
556
577
|
|
557
578
|
export const Example = () => {
|
558
|
-
|
579
|
+
const myRef = useRef()
|
559
580
|
|
560
581
|
return (
|
561
582
|
<View ref={myRef} style={[obj1, obj2]}>
|
@@ -564,11 +585,14 @@ pluginTester({
|
|
564
585
|
)
|
565
586
|
}
|
566
587
|
|
567
|
-
const styles = StyleSheet.create(
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
588
|
+
const styles = StyleSheet.create(
|
589
|
+
{
|
590
|
+
container: {
|
591
|
+
backgroundColor: 'red'
|
592
|
+
}
|
593
|
+
},
|
594
|
+
921918562
|
595
|
+
)
|
572
596
|
`
|
573
597
|
},
|
574
598
|
{
|
@@ -578,7 +602,7 @@ pluginTester({
|
|
578
602
|
import { StyleSheet } from 'react-native-unistyles'
|
579
603
|
|
580
604
|
export const Example = () => {
|
581
|
-
|
605
|
+
const myRef = useRef()
|
582
606
|
|
583
607
|
return (
|
584
608
|
<View
|
@@ -607,13 +631,13 @@ pluginTester({
|
|
607
631
|
import { StyleSheet } from 'react-native-unistyles'
|
608
632
|
|
609
633
|
export const Example = () => {
|
610
|
-
|
634
|
+
const myRef = useRef()
|
611
635
|
|
612
636
|
return (
|
613
637
|
<View
|
614
638
|
ref={_ref => {
|
615
|
-
myRef = _ref
|
616
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
639
|
+
myRef.current = _ref
|
640
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
617
641
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
618
642
|
}}
|
619
643
|
style={{
|
@@ -628,11 +652,14 @@ pluginTester({
|
|
628
652
|
)
|
629
653
|
}
|
630
654
|
|
631
|
-
const styles = StyleSheet.create(
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
655
|
+
const styles = StyleSheet.create(
|
656
|
+
{
|
657
|
+
container: {
|
658
|
+
backgroundColor: 'red'
|
659
|
+
}
|
660
|
+
},
|
661
|
+
921918562
|
662
|
+
)
|
636
663
|
`
|
637
664
|
},
|
638
665
|
{
|
@@ -642,7 +669,7 @@ pluginTester({
|
|
642
669
|
import { StyleSheet } from 'react-native-unistyles'
|
643
670
|
|
644
671
|
export const Example = () => {
|
645
|
-
|
672
|
+
const myRef = useRef()
|
646
673
|
|
647
674
|
return (
|
648
675
|
<View
|
@@ -671,13 +698,13 @@ pluginTester({
|
|
671
698
|
import { StyleSheet } from 'react-native-unistyles'
|
672
699
|
|
673
700
|
export const Example = () => {
|
674
|
-
|
701
|
+
const myRef = useRef()
|
675
702
|
|
676
703
|
return (
|
677
704
|
<View
|
678
705
|
ref={_ref => {
|
679
|
-
myRef = _ref
|
680
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
706
|
+
myRef.current = _ref
|
707
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
681
708
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
682
709
|
}}
|
683
710
|
style={[
|
@@ -692,11 +719,14 @@ pluginTester({
|
|
692
719
|
)
|
693
720
|
}
|
694
721
|
|
695
|
-
const styles = StyleSheet.create(
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
722
|
+
const styles = StyleSheet.create(
|
723
|
+
{
|
724
|
+
container: {
|
725
|
+
backgroundColor: 'red'
|
726
|
+
}
|
727
|
+
},
|
728
|
+
921918562
|
729
|
+
)
|
700
730
|
`
|
701
731
|
},
|
702
732
|
{
|
@@ -706,7 +736,7 @@ pluginTester({
|
|
706
736
|
import { StyleSheet } from 'react-native-unistyles'
|
707
737
|
|
708
738
|
export const Example = () => {
|
709
|
-
|
739
|
+
const myRef = useRef()
|
710
740
|
|
711
741
|
return (
|
712
742
|
<View
|
@@ -730,13 +760,13 @@ pluginTester({
|
|
730
760
|
import { StyleSheet } from 'react-native-unistyles'
|
731
761
|
|
732
762
|
export const Example = () => {
|
733
|
-
|
763
|
+
const myRef = useRef()
|
734
764
|
|
735
765
|
return (
|
736
766
|
<View
|
737
767
|
ref={_ref => {
|
738
|
-
myRef = _ref
|
739
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
768
|
+
myRef.current = _ref
|
769
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
740
770
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
741
771
|
}}
|
742
772
|
style={[styles.container]}
|
@@ -746,11 +776,14 @@ pluginTester({
|
|
746
776
|
)
|
747
777
|
}
|
748
778
|
|
749
|
-
const styles = StyleSheet.create(
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
779
|
+
const styles = StyleSheet.create(
|
780
|
+
{
|
781
|
+
container: {
|
782
|
+
backgroundColor: 'red'
|
783
|
+
}
|
784
|
+
},
|
785
|
+
921918562
|
786
|
+
)
|
754
787
|
`
|
755
788
|
},
|
756
789
|
{
|
@@ -760,7 +793,7 @@ pluginTester({
|
|
760
793
|
import { StyleSheet } from 'react-native-unistyles'
|
761
794
|
|
762
795
|
export const Example = () => {
|
763
|
-
|
796
|
+
const myRef = useRef()
|
764
797
|
|
765
798
|
return (
|
766
799
|
<View
|
@@ -786,27 +819,32 @@ pluginTester({
|
|
786
819
|
import { StyleSheet } from 'react-native-unistyles'
|
787
820
|
|
788
821
|
export const Example = () => {
|
789
|
-
|
822
|
+
const myRef = useRef()
|
790
823
|
|
791
824
|
return (
|
792
825
|
<View
|
793
826
|
ref={_ref => {
|
794
|
-
myRef = _ref
|
795
|
-
|
827
|
+
myRef.current = _ref
|
828
|
+
|
829
|
+
styles.container(1, 2, _ref)
|
830
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
796
831
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
797
832
|
}}
|
798
|
-
style={[styles.container(1, 2
|
833
|
+
style={[styles.container(1, 2)]}
|
799
834
|
>
|
800
835
|
<Text>Hello world</Text>
|
801
836
|
</View>
|
802
837
|
)
|
803
838
|
}
|
804
839
|
|
805
|
-
const styles = StyleSheet.create(
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
840
|
+
const styles = StyleSheet.create(
|
841
|
+
{
|
842
|
+
container: () => ({
|
843
|
+
backgroundColor: 'red'
|
844
|
+
})
|
845
|
+
},
|
846
|
+
921918562
|
847
|
+
)
|
810
848
|
`
|
811
849
|
},
|
812
850
|
{
|
@@ -816,7 +854,7 @@ pluginTester({
|
|
816
854
|
import { StyleSheet } from 'react-native-unistyles'
|
817
855
|
|
818
856
|
export const Example = () => {
|
819
|
-
|
857
|
+
const myRef = useRef()
|
820
858
|
|
821
859
|
return (
|
822
860
|
<View
|
@@ -832,9 +870,9 @@ pluginTester({
|
|
832
870
|
}
|
833
871
|
|
834
872
|
const styles = StyleSheet.create({
|
835
|
-
container:
|
873
|
+
container: {
|
836
874
|
backgroundColor: 'red'
|
837
|
-
}
|
875
|
+
}
|
838
876
|
})
|
839
877
|
`,
|
840
878
|
output: `
|
@@ -843,40 +881,46 @@ pluginTester({
|
|
843
881
|
import { StyleSheet } from 'react-native-unistyles'
|
844
882
|
|
845
883
|
export const Example = () => {
|
846
|
-
|
884
|
+
const myRef = useRef()
|
847
885
|
|
848
886
|
return (
|
849
887
|
<View
|
850
888
|
ref={_ref => {
|
851
|
-
myRef = _ref
|
852
|
-
|
889
|
+
myRef.current = _ref
|
890
|
+
|
891
|
+
styles.container(1, 2, _ref)
|
892
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined)
|
853
893
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
854
894
|
}}
|
855
|
-
style={{
|
856
|
-
backgroundColor: 'red',
|
857
|
-
...styles.container(1, 2, 1)
|
858
|
-
}}
|
895
|
+
style={{ backgroundColor: 'red', ...styles.container(1, 2) }}
|
859
896
|
>
|
860
897
|
<Text>Hello world</Text>
|
861
898
|
</View>
|
862
899
|
)
|
863
900
|
}
|
864
901
|
|
865
|
-
const styles = StyleSheet.create(
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
902
|
+
const styles = StyleSheet.create(
|
903
|
+
{
|
904
|
+
container: {
|
905
|
+
backgroundColor: 'red'
|
906
|
+
}
|
907
|
+
},
|
908
|
+
921918562
|
909
|
+
)
|
870
910
|
`
|
871
911
|
},
|
872
912
|
{
|
873
|
-
title: '
|
913
|
+
title: 'It should extract variants and pass them to ShadowReigstry',
|
874
914
|
code: `
|
875
915
|
import { useRef } from 'react'
|
876
916
|
import { StyleSheet } from 'react-native-unistyles'
|
877
917
|
|
878
918
|
export const Example = () => {
|
879
|
-
|
919
|
+
const myRef = useRef()
|
920
|
+
|
921
|
+
styles.useVariants({
|
922
|
+
size: 'default'
|
923
|
+
})
|
880
924
|
|
881
925
|
return (
|
882
926
|
<View
|
@@ -890,7 +934,17 @@ pluginTester({
|
|
890
934
|
|
891
935
|
const uhh = StyleSheet.create({
|
892
936
|
dkk: () => ({
|
893
|
-
backgroundColor: 'red'
|
937
|
+
backgroundColor: 'red',
|
938
|
+
variants: {
|
939
|
+
size: {
|
940
|
+
small: {
|
941
|
+
backgroundColor: 'blue'
|
942
|
+
},
|
943
|
+
default: {
|
944
|
+
backgroundColor: 'green'
|
945
|
+
}
|
946
|
+
}
|
947
|
+
}
|
894
948
|
})
|
895
949
|
})
|
896
950
|
`,
|
@@ -900,52 +954,69 @@ pluginTester({
|
|
900
954
|
import { StyleSheet } from 'react-native-unistyles'
|
901
955
|
|
902
956
|
export const Example = () => {
|
903
|
-
|
957
|
+
const myRef = useRef()
|
958
|
+
const __uni__variants = {
|
959
|
+
size: 'default'
|
960
|
+
}
|
961
|
+
styles.useVariants(__uni__variants)
|
904
962
|
|
905
963
|
return (
|
906
964
|
<View
|
907
965
|
ref={_ref => {
|
908
|
-
myRef = _ref
|
909
|
-
|
966
|
+
myRef.current = _ref
|
967
|
+
uhh.dkk(_ref)
|
968
|
+
UnistylesShadowRegistry.add(_ref, uhh.dkk, __uni__variants)
|
910
969
|
return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
|
911
970
|
}}
|
912
|
-
style={uhh.dkk(
|
971
|
+
style={uhh.dkk()}
|
913
972
|
>
|
914
973
|
<Text>Hello world</Text>
|
915
974
|
</View>
|
916
975
|
)
|
917
976
|
}
|
918
977
|
|
919
|
-
const uhh = StyleSheet.create(
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
978
|
+
const uhh = StyleSheet.create(
|
979
|
+
{
|
980
|
+
dkk: () => ({
|
981
|
+
backgroundColor: 'red',
|
982
|
+
variants: {
|
983
|
+
size: {
|
984
|
+
small: {
|
985
|
+
backgroundColor: 'blue'
|
986
|
+
},
|
987
|
+
default: {
|
988
|
+
backgroundColor: 'green'
|
989
|
+
}
|
990
|
+
}
|
991
|
+
},
|
992
|
+
uni__dependencies: [4]
|
993
|
+
})
|
994
|
+
},
|
995
|
+
921918562
|
996
|
+
)
|
924
997
|
`
|
925
998
|
},
|
926
999
|
{
|
927
|
-
title: 'Should
|
1000
|
+
title: 'Should modify registry names if user changes name of member expression',
|
928
1001
|
code: `
|
929
1002
|
import { useRef } from 'react'
|
930
1003
|
import { StyleSheet } from 'react-native-unistyles'
|
931
1004
|
|
932
1005
|
export const Example = () => {
|
933
|
-
|
1006
|
+
const myRef = useRef()
|
934
1007
|
|
935
1008
|
return (
|
936
1009
|
<View
|
937
1010
|
ref={myRef}
|
938
|
-
style={
|
1011
|
+
style={uhh.dkk()}
|
939
1012
|
>
|
940
|
-
<Text
|
941
|
-
Hello world
|
942
|
-
</Text>
|
1013
|
+
<Text>Hello world</Text>
|
943
1014
|
</View>
|
944
1015
|
)
|
945
1016
|
}
|
946
1017
|
|
947
|
-
const
|
948
|
-
|
1018
|
+
const uhh = StyleSheet.create({
|
1019
|
+
dkk: () => ({
|
949
1020
|
backgroundColor: 'red'
|
950
1021
|
})
|
951
1022
|
})
|
@@ -956,36 +1027,155 @@ pluginTester({
|
|
956
1027
|
import { StyleSheet } from 'react-native-unistyles'
|
957
1028
|
|
958
1029
|
export const Example = () => {
|
959
|
-
|
1030
|
+
const myRef = useRef()
|
960
1031
|
|
961
1032
|
return (
|
962
1033
|
<View
|
963
1034
|
ref={_ref => {
|
964
|
-
myRef = _ref
|
965
|
-
|
966
|
-
|
1035
|
+
myRef.current = _ref
|
1036
|
+
uhh.dkk(_ref)
|
1037
|
+
UnistylesShadowRegistry.add(_ref, uhh.dkk, undefined)
|
1038
|
+
return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
|
967
1039
|
}}
|
968
|
-
style={
|
1040
|
+
style={uhh.dkk()}
|
969
1041
|
>
|
970
|
-
<Text
|
971
|
-
|
1042
|
+
<Text>Hello world</Text>
|
1043
|
+
</View>
|
1044
|
+
)
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
const uhh = StyleSheet.create(
|
1048
|
+
{
|
1049
|
+
dkk: () => ({
|
1050
|
+
backgroundColor: 'red'
|
1051
|
+
})
|
1052
|
+
},
|
1053
|
+
921918562
|
1054
|
+
)
|
1055
|
+
`
|
1056
|
+
},
|
1057
|
+
{
|
1058
|
+
title: 'Should pass ref for dynamic functions to bind it to shadow node',
|
1059
|
+
code: `
|
1060
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1061
|
+
|
1062
|
+
export const Example = () => {
|
1063
|
+
return (
|
1064
|
+
<React.Fragment>
|
1065
|
+
<View style={styles.container(1, 5)} />
|
1066
|
+
<View style={styles.container(2, 6)} />
|
1067
|
+
<View style={styles.container(5, 1)} />
|
1068
|
+
</React.Fragment>
|
1069
|
+
)
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
const styles = StyleSheet.create({
|
1073
|
+
container: (flex, gap) => ({
|
1074
|
+
flex,
|
1075
|
+
gap
|
1076
|
+
})
|
1077
|
+
})
|
1078
|
+
`,
|
1079
|
+
output: `
|
1080
|
+
import { UnistylesShadowRegistry } from 'react-native-unistyles'
|
1081
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1082
|
+
|
1083
|
+
export const Example = () => {
|
1084
|
+
return (
|
1085
|
+
<React.Fragment>
|
1086
|
+
<View
|
1087
|
+
style={styles.container(1, 5)}
|
972
1088
|
ref={ref => {
|
973
|
-
|
1089
|
+
styles.container(1, 5, ref)
|
1090
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
974
1091
|
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
975
1092
|
}}
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
1093
|
+
/>
|
1094
|
+
<View
|
1095
|
+
style={styles.container(2, 6)}
|
1096
|
+
ref={ref => {
|
1097
|
+
styles.container(2, 6, ref)
|
1098
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
1099
|
+
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
1100
|
+
}}
|
1101
|
+
/>
|
1102
|
+
<View
|
1103
|
+
style={styles.container(5, 1)}
|
1104
|
+
ref={ref => {
|
1105
|
+
styles.container(5, 1, ref)
|
1106
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
1107
|
+
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
1108
|
+
}}
|
1109
|
+
/>
|
1110
|
+
</React.Fragment>
|
1111
|
+
)
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
const styles = StyleSheet.create(
|
1115
|
+
{
|
1116
|
+
container: (flex, gap) => ({
|
1117
|
+
flex,
|
1118
|
+
gap
|
1119
|
+
})
|
1120
|
+
},
|
1121
|
+
921918562
|
1122
|
+
)
|
1123
|
+
`
|
1124
|
+
},
|
1125
|
+
{
|
1126
|
+
title: 'Should pass refs for dynamic functions',
|
1127
|
+
code: `
|
1128
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1129
|
+
|
1130
|
+
export const Example = () => {
|
1131
|
+
return (
|
1132
|
+
<React.Fragment>
|
1133
|
+
<View style={[styles.container(1, 5), styles.container2(1, 6)]} />
|
1134
|
+
</React.Fragment>
|
980
1135
|
)
|
981
1136
|
}
|
982
1137
|
|
983
1138
|
const styles = StyleSheet.create({
|
984
|
-
container: () => ({
|
985
|
-
|
1139
|
+
container: (flex, gap) => ({
|
1140
|
+
flex,
|
1141
|
+
gap
|
986
1142
|
})
|
987
1143
|
})
|
1144
|
+
`,
|
1145
|
+
output: `
|
1146
|
+
import { UnistylesShadowRegistry } from 'react-native-unistyles'
|
1147
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1148
|
+
|
1149
|
+
export const Example = () => {
|
1150
|
+
return (
|
1151
|
+
<React.Fragment>
|
1152
|
+
<View
|
1153
|
+
style={[styles.container(1, 5), styles.container2(1, 6)]}
|
1154
|
+
ref={ref => {
|
1155
|
+
styles.container(1, 5, ref)
|
1156
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined)
|
1157
|
+
styles.container2(1, 6, ref)
|
1158
|
+
UnistylesShadowRegistry.add(ref, styles.container2, undefined)
|
1159
|
+
return () => {
|
1160
|
+
;(() => UnistylesShadowRegistry.remove(ref, styles.container))()
|
1161
|
+
UnistylesShadowRegistry.remove(ref, styles.container2)
|
1162
|
+
}
|
1163
|
+
}}
|
1164
|
+
/>
|
1165
|
+
</React.Fragment>
|
1166
|
+
)
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
const styles = StyleSheet.create(
|
1170
|
+
{
|
1171
|
+
container: (flex, gap) => ({
|
1172
|
+
flex,
|
1173
|
+
gap
|
1174
|
+
})
|
1175
|
+
},
|
1176
|
+
921918562
|
1177
|
+
)
|
988
1178
|
`
|
989
|
-
}
|
1179
|
+
}
|
990
1180
|
]
|
991
1181
|
})
|