react-native-unistyles 3.0.0-alpha.1 → 3.0.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/Unistyles.podspec +33 -0
- package/cxx/common/Constants.h +1 -0
- package/cxx/common/Helpers.h +92 -0
- package/cxx/core/HostStyle.cpp +18 -12
- package/cxx/core/HostStyle.h +3 -0
- package/cxx/core/StyleSheet.h +0 -1
- package/cxx/core/StyleSheetRegistry.cpp +10 -13
- package/cxx/core/StyleSheetRegistry.h +4 -4
- package/cxx/core/Unistyle.h +0 -6
- package/cxx/core/UnistyleData.h +23 -0
- package/cxx/core/UnistyleWrapper.h +6 -6
- package/cxx/core/UnistylesCommitHook.cpp +8 -7
- package/cxx/core/UnistylesCommitHook.h +6 -1
- package/cxx/core/UnistylesCommitShadowNode.h +13 -0
- package/cxx/core/UnistylesMountHook.cpp +40 -0
- package/cxx/core/UnistylesMountHook.h +30 -0
- package/cxx/core/UnistylesRegistry.cpp +42 -56
- package/cxx/core/UnistylesRegistry.h +10 -8
- package/cxx/core/UnistylesState.cpp +4 -4
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +8 -1
- package/cxx/hybridObjects/HybridStyleSheet.cpp +35 -39
- package/cxx/hybridObjects/HybridStyleSheet.h +9 -6
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +34 -15
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
- package/cxx/parser/Parser.cpp +65 -137
- package/cxx/parser/Parser.h +8 -14
- package/ios/UnistylesModuleOnLoad.h +2 -0
- package/ios/UnistylesModuleOnLoad.mm +8 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/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/NavigtionBar/index.js +1 -1
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +2 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/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 +12 -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 +2 -2
- package/plugin/__tests__/dependencies.spec.js +181 -103
- package/plugin/__tests__/ref.spec.js +335 -156
- package/plugin/__tests__/stylesheet.spec.js +148 -55
- package/plugin/index.js +31 -21
- package/plugin/ref.js +43 -11
- package/plugin/style.js +13 -24
- package/plugin/stylesheet.js +44 -1
- package/plugin/variants.js +33 -0
- package/src/specs/NavigtionBar/index.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +4 -4
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -1
- package/src/specs/UnistylesRuntime/index.ts +1 -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, 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, 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, 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, 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, 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, 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, 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, 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, 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,30 @@ 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
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
827
|
+
myRef.current = _ref
|
828
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined, [1, 2])
|
796
829
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
797
830
|
}}
|
798
|
-
style={[styles.container(1, 2
|
831
|
+
style={[styles.container(1, 2)]}
|
799
832
|
>
|
800
833
|
<Text>Hello world</Text>
|
801
834
|
</View>
|
802
835
|
)
|
803
836
|
}
|
804
837
|
|
805
|
-
const styles = StyleSheet.create(
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
838
|
+
const styles = StyleSheet.create(
|
839
|
+
{
|
840
|
+
container: () => ({
|
841
|
+
backgroundColor: 'red'
|
842
|
+
})
|
843
|
+
},
|
844
|
+
921918562
|
845
|
+
)
|
810
846
|
`
|
811
847
|
},
|
812
848
|
{
|
@@ -816,7 +852,7 @@ pluginTester({
|
|
816
852
|
import { StyleSheet } from 'react-native-unistyles'
|
817
853
|
|
818
854
|
export const Example = () => {
|
819
|
-
|
855
|
+
const myRef = useRef()
|
820
856
|
|
821
857
|
return (
|
822
858
|
<View
|
@@ -832,9 +868,9 @@ pluginTester({
|
|
832
868
|
}
|
833
869
|
|
834
870
|
const styles = StyleSheet.create({
|
835
|
-
container:
|
871
|
+
container: {
|
836
872
|
backgroundColor: 'red'
|
837
|
-
}
|
873
|
+
}
|
838
874
|
})
|
839
875
|
`,
|
840
876
|
output: `
|
@@ -843,40 +879,44 @@ pluginTester({
|
|
843
879
|
import { StyleSheet } from 'react-native-unistyles'
|
844
880
|
|
845
881
|
export const Example = () => {
|
846
|
-
|
882
|
+
const myRef = useRef()
|
847
883
|
|
848
884
|
return (
|
849
885
|
<View
|
850
886
|
ref={_ref => {
|
851
|
-
myRef = _ref
|
852
|
-
UnistylesShadowRegistry.add(_ref, styles.container)
|
887
|
+
myRef.current = _ref
|
888
|
+
UnistylesShadowRegistry.add(_ref, styles.container, undefined, [1, 2])
|
853
889
|
return () => UnistylesShadowRegistry.remove(_ref, styles.container)
|
854
890
|
}}
|
855
|
-
style={{
|
856
|
-
backgroundColor: 'red',
|
857
|
-
...styles.container(1, 2, 1)
|
858
|
-
}}
|
891
|
+
style={{ backgroundColor: 'red', ...styles.container(1, 2) }}
|
859
892
|
>
|
860
893
|
<Text>Hello world</Text>
|
861
894
|
</View>
|
862
895
|
)
|
863
896
|
}
|
864
897
|
|
865
|
-
const styles = StyleSheet.create(
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
898
|
+
const styles = StyleSheet.create(
|
899
|
+
{
|
900
|
+
container: {
|
901
|
+
backgroundColor: 'red'
|
902
|
+
}
|
903
|
+
},
|
904
|
+
921918562
|
905
|
+
)
|
870
906
|
`
|
871
907
|
},
|
872
908
|
{
|
873
|
-
title: '
|
909
|
+
title: 'It should extract variants and pass them to ShadowReigstry',
|
874
910
|
code: `
|
875
911
|
import { useRef } from 'react'
|
876
912
|
import { StyleSheet } from 'react-native-unistyles'
|
877
913
|
|
878
914
|
export const Example = () => {
|
879
|
-
|
915
|
+
const myRef = useRef()
|
916
|
+
|
917
|
+
styles.useVariants({
|
918
|
+
size: 'default'
|
919
|
+
})
|
880
920
|
|
881
921
|
return (
|
882
922
|
<View
|
@@ -890,7 +930,17 @@ pluginTester({
|
|
890
930
|
|
891
931
|
const uhh = StyleSheet.create({
|
892
932
|
dkk: () => ({
|
893
|
-
backgroundColor: 'red'
|
933
|
+
backgroundColor: 'red',
|
934
|
+
variants: {
|
935
|
+
size: {
|
936
|
+
small: {
|
937
|
+
backgroundColor: 'blue'
|
938
|
+
},
|
939
|
+
default: {
|
940
|
+
backgroundColor: 'green'
|
941
|
+
}
|
942
|
+
}
|
943
|
+
}
|
894
944
|
})
|
895
945
|
})
|
896
946
|
`,
|
@@ -900,52 +950,68 @@ pluginTester({
|
|
900
950
|
import { StyleSheet } from 'react-native-unistyles'
|
901
951
|
|
902
952
|
export const Example = () => {
|
903
|
-
|
953
|
+
const myRef = useRef()
|
954
|
+
const __uni__variants = {
|
955
|
+
size: 'default'
|
956
|
+
}
|
957
|
+
styles.useVariants(__uni__variants)
|
904
958
|
|
905
959
|
return (
|
906
960
|
<View
|
907
961
|
ref={_ref => {
|
908
|
-
myRef = _ref
|
909
|
-
UnistylesShadowRegistry.add(_ref, uhh.dkk)
|
962
|
+
myRef.current = _ref
|
963
|
+
UnistylesShadowRegistry.add(_ref, uhh.dkk, __uni__variants, [])
|
910
964
|
return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
|
911
965
|
}}
|
912
|
-
style={uhh.dkk(
|
966
|
+
style={uhh.dkk()}
|
913
967
|
>
|
914
968
|
<Text>Hello world</Text>
|
915
969
|
</View>
|
916
970
|
)
|
917
971
|
}
|
918
972
|
|
919
|
-
const uhh = StyleSheet.create(
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
973
|
+
const uhh = StyleSheet.create(
|
974
|
+
{
|
975
|
+
dkk: () => ({
|
976
|
+
backgroundColor: 'red',
|
977
|
+
variants: {
|
978
|
+
size: {
|
979
|
+
small: {
|
980
|
+
backgroundColor: 'blue'
|
981
|
+
},
|
982
|
+
default: {
|
983
|
+
backgroundColor: 'green'
|
984
|
+
}
|
985
|
+
}
|
986
|
+
},
|
987
|
+
uni__dependencies: [4]
|
988
|
+
})
|
989
|
+
},
|
990
|
+
921918562
|
991
|
+
)
|
924
992
|
`
|
925
993
|
},
|
926
994
|
{
|
927
|
-
title: 'Should
|
995
|
+
title: 'Should modify registry names if user changes name of member expression',
|
928
996
|
code: `
|
929
997
|
import { useRef } from 'react'
|
930
998
|
import { StyleSheet } from 'react-native-unistyles'
|
931
999
|
|
932
1000
|
export const Example = () => {
|
933
|
-
|
1001
|
+
const myRef = useRef()
|
934
1002
|
|
935
1003
|
return (
|
936
1004
|
<View
|
937
1005
|
ref={myRef}
|
938
|
-
style={
|
1006
|
+
style={uhh.dkk()}
|
939
1007
|
>
|
940
|
-
<Text
|
941
|
-
Hello world
|
942
|
-
</Text>
|
1008
|
+
<Text>Hello world</Text>
|
943
1009
|
</View>
|
944
1010
|
)
|
945
1011
|
}
|
946
1012
|
|
947
|
-
const
|
948
|
-
|
1013
|
+
const uhh = StyleSheet.create({
|
1014
|
+
dkk: () => ({
|
949
1015
|
backgroundColor: 'red'
|
950
1016
|
})
|
951
1017
|
})
|
@@ -956,36 +1022,149 @@ pluginTester({
|
|
956
1022
|
import { StyleSheet } from 'react-native-unistyles'
|
957
1023
|
|
958
1024
|
export const Example = () => {
|
959
|
-
|
1025
|
+
const myRef = useRef()
|
960
1026
|
|
961
1027
|
return (
|
962
1028
|
<View
|
963
1029
|
ref={_ref => {
|
964
|
-
myRef = _ref
|
965
|
-
UnistylesShadowRegistry.add(_ref,
|
966
|
-
return () => UnistylesShadowRegistry.remove(_ref,
|
1030
|
+
myRef.current = _ref
|
1031
|
+
UnistylesShadowRegistry.add(_ref, uhh.dkk, undefined, [])
|
1032
|
+
return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
|
967
1033
|
}}
|
968
|
-
style={
|
1034
|
+
style={uhh.dkk()}
|
969
1035
|
>
|
970
|
-
<Text
|
971
|
-
|
1036
|
+
<Text>Hello world</Text>
|
1037
|
+
</View>
|
1038
|
+
)
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
const uhh = StyleSheet.create(
|
1042
|
+
{
|
1043
|
+
dkk: () => ({
|
1044
|
+
backgroundColor: 'red'
|
1045
|
+
})
|
1046
|
+
},
|
1047
|
+
921918562
|
1048
|
+
)
|
1049
|
+
`
|
1050
|
+
},
|
1051
|
+
{
|
1052
|
+
title: 'Should pass ref for dynamic functions to bind it to shadow node',
|
1053
|
+
code: `
|
1054
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1055
|
+
|
1056
|
+
export const Example = () => {
|
1057
|
+
return (
|
1058
|
+
<React.Fragment>
|
1059
|
+
<View style={styles.container(1, 5)} />
|
1060
|
+
<View style={styles.container(2, 6)} />
|
1061
|
+
<View style={styles.container(5, 1)} />
|
1062
|
+
</React.Fragment>
|
1063
|
+
)
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
const styles = StyleSheet.create({
|
1067
|
+
container: (flex, gap) => ({
|
1068
|
+
flex,
|
1069
|
+
gap
|
1070
|
+
})
|
1071
|
+
})
|
1072
|
+
`,
|
1073
|
+
output: `
|
1074
|
+
import { UnistylesShadowRegistry } from 'react-native-unistyles'
|
1075
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1076
|
+
|
1077
|
+
export const Example = () => {
|
1078
|
+
return (
|
1079
|
+
<React.Fragment>
|
1080
|
+
<View
|
1081
|
+
style={styles.container(1, 5)}
|
972
1082
|
ref={ref => {
|
973
|
-
UnistylesShadowRegistry.add(ref, styles.container)
|
1083
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined, [1, 5])
|
974
1084
|
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
975
1085
|
}}
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
1086
|
+
/>
|
1087
|
+
<View
|
1088
|
+
style={styles.container(2, 6)}
|
1089
|
+
ref={ref => {
|
1090
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined, [2, 6])
|
1091
|
+
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
1092
|
+
}}
|
1093
|
+
/>
|
1094
|
+
<View
|
1095
|
+
style={styles.container(5, 1)}
|
1096
|
+
ref={ref => {
|
1097
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined, [5, 1])
|
1098
|
+
return () => UnistylesShadowRegistry.remove(ref, styles.container)
|
1099
|
+
}}
|
1100
|
+
/>
|
1101
|
+
</React.Fragment>
|
1102
|
+
)
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
const styles = StyleSheet.create(
|
1106
|
+
{
|
1107
|
+
container: (flex, gap) => ({
|
1108
|
+
flex,
|
1109
|
+
gap
|
1110
|
+
})
|
1111
|
+
},
|
1112
|
+
921918562
|
1113
|
+
)
|
1114
|
+
`
|
1115
|
+
},
|
1116
|
+
{
|
1117
|
+
title: 'Should pass refs for dynamic functions',
|
1118
|
+
code: `
|
1119
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1120
|
+
|
1121
|
+
export const Example = () => {
|
1122
|
+
return (
|
1123
|
+
<React.Fragment>
|
1124
|
+
<View style={[styles.container(1, 5), styles.container2(1, 6)]} />
|
1125
|
+
</React.Fragment>
|
980
1126
|
)
|
981
1127
|
}
|
982
1128
|
|
983
1129
|
const styles = StyleSheet.create({
|
984
|
-
container: () => ({
|
985
|
-
|
1130
|
+
container: (flex, gap) => ({
|
1131
|
+
flex,
|
1132
|
+
gap
|
986
1133
|
})
|
987
1134
|
})
|
1135
|
+
`,
|
1136
|
+
output: `
|
1137
|
+
import { UnistylesShadowRegistry } from 'react-native-unistyles'
|
1138
|
+
import { StyleSheet } from 'react-native-unistyles'
|
1139
|
+
|
1140
|
+
export const Example = () => {
|
1141
|
+
return (
|
1142
|
+
<React.Fragment>
|
1143
|
+
<View
|
1144
|
+
style={[styles.container(1, 5), styles.container2(1, 6)]}
|
1145
|
+
ref={ref => {
|
1146
|
+
UnistylesShadowRegistry.add(ref, styles.container, undefined, [1, 5])
|
1147
|
+
UnistylesShadowRegistry.add(ref, styles.container2, undefined, [1, 6])
|
1148
|
+
return () => {
|
1149
|
+
;(() => UnistylesShadowRegistry.remove(ref, styles.container))()
|
1150
|
+
UnistylesShadowRegistry.remove(ref, styles.container2)
|
1151
|
+
}
|
1152
|
+
}}
|
1153
|
+
/>
|
1154
|
+
</React.Fragment>
|
1155
|
+
)
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
const styles = StyleSheet.create(
|
1159
|
+
{
|
1160
|
+
container: (flex, gap) => ({
|
1161
|
+
flex,
|
1162
|
+
gap
|
1163
|
+
})
|
1164
|
+
},
|
1165
|
+
921918562
|
1166
|
+
)
|
988
1167
|
`
|
989
|
-
}
|
1168
|
+
}
|
990
1169
|
]
|
991
1170
|
})
|