rn-css 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +52 -0
- package/dist/styleComponent.d.ts +1 -0
- package/dist/styleComponent.js +1 -1
- package/dist/useTheme.d.ts +10 -0
- package/dist/useTheme.js +10 -0
- package/package.json +1 -1
- package/src/styleComponent.tsx +2 -2
- package/src/useTheme.tsx +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare const styled: {
|
|
|
9
9
|
<S>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S & T & {
|
|
10
10
|
rnCSS?: string | undefined;
|
|
11
11
|
shared: unknown;
|
|
12
|
+
theme: unknown;
|
|
12
13
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<T & S & {
|
|
13
14
|
rnCSS?: `${string};` | undefined;
|
|
14
15
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -22,6 +23,7 @@ declare const styled: {
|
|
|
22
23
|
attrs<S_1>(opts: Partial<S_1 & T> | ((props: S_1 & T) => Partial<S_1 & T>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_1 & T & {
|
|
23
24
|
rnCSS?: string | undefined;
|
|
24
25
|
shared: unknown;
|
|
26
|
+
theme: unknown;
|
|
25
27
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(T | S_1) & {
|
|
26
28
|
rnCSS?: `${string};` | undefined;
|
|
27
29
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -37,6 +39,7 @@ declare const styled: {
|
|
|
37
39
|
<S_2>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_2 & RN.ActivityIndicatorProps & {
|
|
38
40
|
rnCSS?: string | undefined;
|
|
39
41
|
shared: unknown;
|
|
42
|
+
theme: unknown;
|
|
40
43
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ActivityIndicatorProps & S_2 & {
|
|
41
44
|
rnCSS?: `${string};` | undefined;
|
|
42
45
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -50,6 +53,7 @@ declare const styled: {
|
|
|
50
53
|
attrs<S_3>(opts: Partial<S_3 & RN.ActivityIndicatorProps> | ((props: S_3 & RN.ActivityIndicatorProps) => Partial<S_3 & RN.ActivityIndicatorProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_3 & RN.ActivityIndicatorProps & {
|
|
51
54
|
rnCSS?: string | undefined;
|
|
52
55
|
shared: unknown;
|
|
56
|
+
theme: unknown;
|
|
53
57
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ActivityIndicatorProps | S_3) & {
|
|
54
58
|
rnCSS?: `${string};` | undefined;
|
|
55
59
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -65,6 +69,7 @@ declare const styled: {
|
|
|
65
69
|
<S_4>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_4 & RN.ButtonProps & {
|
|
66
70
|
rnCSS?: string | undefined;
|
|
67
71
|
shared: unknown;
|
|
72
|
+
theme: unknown;
|
|
68
73
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ButtonProps & S_4 & {
|
|
69
74
|
rnCSS?: `${string};` | undefined;
|
|
70
75
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -78,6 +83,7 @@ declare const styled: {
|
|
|
78
83
|
attrs<S_5>(opts: Partial<S_5 & RN.ButtonProps> | ((props: S_5 & RN.ButtonProps) => Partial<S_5 & RN.ButtonProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_5 & RN.ButtonProps & {
|
|
79
84
|
rnCSS?: string | undefined;
|
|
80
85
|
shared: unknown;
|
|
86
|
+
theme: unknown;
|
|
81
87
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ButtonProps | S_5) & {
|
|
82
88
|
rnCSS?: `${string};` | undefined;
|
|
83
89
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -93,6 +99,7 @@ declare const styled: {
|
|
|
93
99
|
<S_6>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_6 & RN.DrawerLayoutAndroidProps & {
|
|
94
100
|
rnCSS?: string | undefined;
|
|
95
101
|
shared: unknown;
|
|
102
|
+
theme: unknown;
|
|
96
103
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.DrawerLayoutAndroidProps & S_6 & {
|
|
97
104
|
rnCSS?: `${string};` | undefined;
|
|
98
105
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -106,6 +113,7 @@ declare const styled: {
|
|
|
106
113
|
attrs<S_7>(opts: Partial<S_7 & RN.DrawerLayoutAndroidProps> | ((props: S_7 & RN.DrawerLayoutAndroidProps) => Partial<S_7 & RN.DrawerLayoutAndroidProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_7 & RN.DrawerLayoutAndroidProps & {
|
|
107
114
|
rnCSS?: string | undefined;
|
|
108
115
|
shared: unknown;
|
|
116
|
+
theme: unknown;
|
|
109
117
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.DrawerLayoutAndroidProps | S_7) & {
|
|
110
118
|
rnCSS?: `${string};` | undefined;
|
|
111
119
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -121,6 +129,7 @@ declare const styled: {
|
|
|
121
129
|
<S_8>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_8 & RN.ImageProps & {
|
|
122
130
|
rnCSS?: string | undefined;
|
|
123
131
|
shared: unknown;
|
|
132
|
+
theme: unknown;
|
|
124
133
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ImageProps & S_8 & {
|
|
125
134
|
rnCSS?: `${string};` | undefined;
|
|
126
135
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -134,6 +143,7 @@ declare const styled: {
|
|
|
134
143
|
attrs<S_9>(opts: Partial<S_9 & RN.ImageProps> | ((props: S_9 & RN.ImageProps) => Partial<S_9 & RN.ImageProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_9 & RN.ImageProps & {
|
|
135
144
|
rnCSS?: string | undefined;
|
|
136
145
|
shared: unknown;
|
|
146
|
+
theme: unknown;
|
|
137
147
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ImageProps | S_9) & {
|
|
138
148
|
rnCSS?: `${string};` | undefined;
|
|
139
149
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -149,6 +159,7 @@ declare const styled: {
|
|
|
149
159
|
<S_10>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_10 & RN.ImageBackgroundProps & {
|
|
150
160
|
rnCSS?: string | undefined;
|
|
151
161
|
shared: unknown;
|
|
162
|
+
theme: unknown;
|
|
152
163
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ImageBackgroundProps & S_10 & {
|
|
153
164
|
rnCSS?: `${string};` | undefined;
|
|
154
165
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -162,6 +173,7 @@ declare const styled: {
|
|
|
162
173
|
attrs<S_11>(opts: Partial<S_11 & RN.ImageBackgroundProps> | ((props: S_11 & RN.ImageBackgroundProps) => Partial<S_11 & RN.ImageBackgroundProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_11 & RN.ImageBackgroundProps & {
|
|
163
174
|
rnCSS?: string | undefined;
|
|
164
175
|
shared: unknown;
|
|
176
|
+
theme: unknown;
|
|
165
177
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ImageBackgroundProps | S_11) & {
|
|
166
178
|
rnCSS?: `${string};` | undefined;
|
|
167
179
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -177,6 +189,7 @@ declare const styled: {
|
|
|
177
189
|
<S_12>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_12 & RN.KeyboardAvoidingViewProps & {
|
|
178
190
|
rnCSS?: string | undefined;
|
|
179
191
|
shared: unknown;
|
|
192
|
+
theme: unknown;
|
|
180
193
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.KeyboardAvoidingViewProps & S_12 & {
|
|
181
194
|
rnCSS?: `${string};` | undefined;
|
|
182
195
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -190,6 +203,7 @@ declare const styled: {
|
|
|
190
203
|
attrs<S_13>(opts: Partial<S_13 & RN.KeyboardAvoidingViewProps> | ((props: S_13 & RN.KeyboardAvoidingViewProps) => Partial<S_13 & RN.KeyboardAvoidingViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_13 & RN.KeyboardAvoidingViewProps & {
|
|
191
204
|
rnCSS?: string | undefined;
|
|
192
205
|
shared: unknown;
|
|
206
|
+
theme: unknown;
|
|
193
207
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.KeyboardAvoidingViewProps | S_13) & {
|
|
194
208
|
rnCSS?: `${string};` | undefined;
|
|
195
209
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -205,6 +219,7 @@ declare const styled: {
|
|
|
205
219
|
<S_14>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_14 & RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps & {
|
|
206
220
|
rnCSS?: string | undefined;
|
|
207
221
|
shared: unknown;
|
|
222
|
+
theme: unknown;
|
|
208
223
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps & S_14 & {
|
|
209
224
|
rnCSS?: `${string};` | undefined;
|
|
210
225
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -218,6 +233,7 @@ declare const styled: {
|
|
|
218
233
|
attrs<S_15>(opts: Partial<S_15 & RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps> | ((props: S_15 & RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps) => Partial<S_15 & RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_15 & RN.ModalBaseProps & RN.ModalPropsIOS & RN.ModalPropsAndroid & RN.ViewProps & {
|
|
219
234
|
rnCSS?: string | undefined;
|
|
220
235
|
shared: unknown;
|
|
236
|
+
theme: unknown;
|
|
221
237
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ModalProps | S_15) & {
|
|
222
238
|
rnCSS?: `${string};` | undefined;
|
|
223
239
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -233,6 +249,7 @@ declare const styled: {
|
|
|
233
249
|
<S_16>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_16 & RN.NavigatorIOSProps & {
|
|
234
250
|
rnCSS?: string | undefined;
|
|
235
251
|
shared: unknown;
|
|
252
|
+
theme: unknown;
|
|
236
253
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.NavigatorIOSProps & S_16 & {
|
|
237
254
|
rnCSS?: `${string};` | undefined;
|
|
238
255
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -246,6 +263,7 @@ declare const styled: {
|
|
|
246
263
|
attrs<S_17>(opts: Partial<S_17 & RN.NavigatorIOSProps> | ((props: S_17 & RN.NavigatorIOSProps) => Partial<S_17 & RN.NavigatorIOSProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_17 & RN.NavigatorIOSProps & {
|
|
247
264
|
rnCSS?: string | undefined;
|
|
248
265
|
shared: unknown;
|
|
266
|
+
theme: unknown;
|
|
249
267
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.NavigatorIOSProps | S_17) & {
|
|
250
268
|
rnCSS?: `${string};` | undefined;
|
|
251
269
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -261,6 +279,7 @@ declare const styled: {
|
|
|
261
279
|
<S_18>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_18 & RN.ScrollViewProps & {
|
|
262
280
|
rnCSS?: string | undefined;
|
|
263
281
|
shared: unknown;
|
|
282
|
+
theme: unknown;
|
|
264
283
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ScrollViewProps & S_18 & {
|
|
265
284
|
rnCSS?: `${string};` | undefined;
|
|
266
285
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -274,6 +293,7 @@ declare const styled: {
|
|
|
274
293
|
attrs<S_19>(opts: Partial<S_19 & RN.ScrollViewProps> | ((props: S_19 & RN.ScrollViewProps) => Partial<S_19 & RN.ScrollViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_19 & RN.ScrollViewProps & {
|
|
275
294
|
rnCSS?: string | undefined;
|
|
276
295
|
shared: unknown;
|
|
296
|
+
theme: unknown;
|
|
277
297
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ScrollViewProps | S_19) & {
|
|
278
298
|
rnCSS?: `${string};` | undefined;
|
|
279
299
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -289,6 +309,7 @@ declare const styled: {
|
|
|
289
309
|
<S_20>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_20 & RN.SnapshotViewIOSProps & {
|
|
290
310
|
rnCSS?: string | undefined;
|
|
291
311
|
shared: unknown;
|
|
312
|
+
theme: unknown;
|
|
292
313
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.SnapshotViewIOSProps & S_20 & {
|
|
293
314
|
rnCSS?: `${string};` | undefined;
|
|
294
315
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -302,6 +323,7 @@ declare const styled: {
|
|
|
302
323
|
attrs<S_21>(opts: Partial<S_21 & RN.SnapshotViewIOSProps> | ((props: S_21 & RN.SnapshotViewIOSProps) => Partial<S_21 & RN.SnapshotViewIOSProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_21 & RN.SnapshotViewIOSProps & {
|
|
303
324
|
rnCSS?: string | undefined;
|
|
304
325
|
shared: unknown;
|
|
326
|
+
theme: unknown;
|
|
305
327
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.SnapshotViewIOSProps | S_21) & {
|
|
306
328
|
rnCSS?: `${string};` | undefined;
|
|
307
329
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -317,6 +339,7 @@ declare const styled: {
|
|
|
317
339
|
<S_22>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_22 & RN.SwitchProps & {
|
|
318
340
|
rnCSS?: string | undefined;
|
|
319
341
|
shared: unknown;
|
|
342
|
+
theme: unknown;
|
|
320
343
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.SwitchProps & S_22 & {
|
|
321
344
|
rnCSS?: `${string};` | undefined;
|
|
322
345
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -330,6 +353,7 @@ declare const styled: {
|
|
|
330
353
|
attrs<S_23>(opts: Partial<S_23 & RN.SwitchProps> | ((props: S_23 & RN.SwitchProps) => Partial<S_23 & RN.SwitchProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_23 & RN.SwitchProps & {
|
|
331
354
|
rnCSS?: string | undefined;
|
|
332
355
|
shared: unknown;
|
|
356
|
+
theme: unknown;
|
|
333
357
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.SwitchProps | S_23) & {
|
|
334
358
|
rnCSS?: `${string};` | undefined;
|
|
335
359
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -345,6 +369,7 @@ declare const styled: {
|
|
|
345
369
|
<S_24>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_24 & RN.RecyclerViewBackedScrollViewProps & {
|
|
346
370
|
rnCSS?: string | undefined;
|
|
347
371
|
shared: unknown;
|
|
372
|
+
theme: unknown;
|
|
348
373
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.RecyclerViewBackedScrollViewProps & S_24 & {
|
|
349
374
|
rnCSS?: `${string};` | undefined;
|
|
350
375
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -358,6 +383,7 @@ declare const styled: {
|
|
|
358
383
|
attrs<S_25>(opts: Partial<S_25 & RN.RecyclerViewBackedScrollViewProps> | ((props: S_25 & RN.RecyclerViewBackedScrollViewProps) => Partial<S_25 & RN.RecyclerViewBackedScrollViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_25 & RN.RecyclerViewBackedScrollViewProps & {
|
|
359
384
|
rnCSS?: string | undefined;
|
|
360
385
|
shared: unknown;
|
|
386
|
+
theme: unknown;
|
|
361
387
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.RecyclerViewBackedScrollViewProps | S_25) & {
|
|
362
388
|
rnCSS?: `${string};` | undefined;
|
|
363
389
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -373,6 +399,7 @@ declare const styled: {
|
|
|
373
399
|
<S_26>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_26 & RN.RefreshControlProps & {
|
|
374
400
|
rnCSS?: string | undefined;
|
|
375
401
|
shared: unknown;
|
|
402
|
+
theme: unknown;
|
|
376
403
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.RefreshControlProps & S_26 & {
|
|
377
404
|
rnCSS?: `${string};` | undefined;
|
|
378
405
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -386,6 +413,7 @@ declare const styled: {
|
|
|
386
413
|
attrs<S_27>(opts: Partial<S_27 & RN.RefreshControlProps> | ((props: S_27 & RN.RefreshControlProps) => Partial<S_27 & RN.RefreshControlProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_27 & RN.RefreshControlProps & {
|
|
387
414
|
rnCSS?: string | undefined;
|
|
388
415
|
shared: unknown;
|
|
416
|
+
theme: unknown;
|
|
389
417
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.RefreshControlProps | S_27) & {
|
|
390
418
|
rnCSS?: `${string};` | undefined;
|
|
391
419
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -401,6 +429,7 @@ declare const styled: {
|
|
|
401
429
|
<S_28>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_28 & RN.ViewProps & {
|
|
402
430
|
rnCSS?: string | undefined;
|
|
403
431
|
shared: unknown;
|
|
432
|
+
theme: unknown;
|
|
404
433
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ViewProps & S_28 & {
|
|
405
434
|
rnCSS?: `${string};` | undefined;
|
|
406
435
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -414,6 +443,7 @@ declare const styled: {
|
|
|
414
443
|
attrs<S_29>(opts: Partial<S_29 & RN.ViewProps> | ((props: S_29 & RN.ViewProps) => Partial<S_29 & RN.ViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_29 & RN.ViewProps & {
|
|
415
444
|
rnCSS?: string | undefined;
|
|
416
445
|
shared: unknown;
|
|
446
|
+
theme: unknown;
|
|
417
447
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ViewProps | S_29) & {
|
|
418
448
|
rnCSS?: `${string};` | undefined;
|
|
419
449
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -429,6 +459,7 @@ declare const styled: {
|
|
|
429
459
|
<S_30>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_30 & RN.StatusBarProps & {
|
|
430
460
|
rnCSS?: string | undefined;
|
|
431
461
|
shared: unknown;
|
|
462
|
+
theme: unknown;
|
|
432
463
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.StatusBarProps & S_30 & {
|
|
433
464
|
rnCSS?: `${string};` | undefined;
|
|
434
465
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -442,6 +473,7 @@ declare const styled: {
|
|
|
442
473
|
attrs<S_31>(opts: Partial<S_31 & RN.StatusBarProps> | ((props: S_31 & RN.StatusBarProps) => Partial<S_31 & RN.StatusBarProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_31 & RN.StatusBarProps & {
|
|
443
474
|
rnCSS?: string | undefined;
|
|
444
475
|
shared: unknown;
|
|
476
|
+
theme: unknown;
|
|
445
477
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.StatusBarProps | S_31) & {
|
|
446
478
|
rnCSS?: `${string};` | undefined;
|
|
447
479
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -457,6 +489,7 @@ declare const styled: {
|
|
|
457
489
|
<S_32>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_32 & RN.TextProps & {
|
|
458
490
|
rnCSS?: string | undefined;
|
|
459
491
|
shared: unknown;
|
|
492
|
+
theme: unknown;
|
|
460
493
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TextProps & S_32 & {
|
|
461
494
|
rnCSS?: `${string};` | undefined;
|
|
462
495
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -470,6 +503,7 @@ declare const styled: {
|
|
|
470
503
|
attrs<S_33>(opts: Partial<S_33 & RN.TextProps> | ((props: S_33 & RN.TextProps) => Partial<S_33 & RN.TextProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_33 & RN.TextProps & {
|
|
471
504
|
rnCSS?: string | undefined;
|
|
472
505
|
shared: unknown;
|
|
506
|
+
theme: unknown;
|
|
473
507
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TextProps | S_33) & {
|
|
474
508
|
rnCSS?: `${string};` | undefined;
|
|
475
509
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -485,6 +519,7 @@ declare const styled: {
|
|
|
485
519
|
<S_34>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_34 & RN.TextInputProps & {
|
|
486
520
|
rnCSS?: string | undefined;
|
|
487
521
|
shared: unknown;
|
|
522
|
+
theme: unknown;
|
|
488
523
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TextInputProps & S_34 & {
|
|
489
524
|
rnCSS?: `${string};` | undefined;
|
|
490
525
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -498,6 +533,7 @@ declare const styled: {
|
|
|
498
533
|
attrs<S_35>(opts: Partial<S_35 & RN.TextInputProps> | ((props: S_35 & RN.TextInputProps) => Partial<S_35 & RN.TextInputProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_35 & RN.TextInputProps & {
|
|
499
534
|
rnCSS?: string | undefined;
|
|
500
535
|
shared: unknown;
|
|
536
|
+
theme: unknown;
|
|
501
537
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TextInputProps | S_35) & {
|
|
502
538
|
rnCSS?: `${string};` | undefined;
|
|
503
539
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -513,6 +549,7 @@ declare const styled: {
|
|
|
513
549
|
<S_36>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_36 & RN.TouchableHighlightProps & {
|
|
514
550
|
rnCSS?: string | undefined;
|
|
515
551
|
shared: unknown;
|
|
552
|
+
theme: unknown;
|
|
516
553
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TouchableHighlightProps & S_36 & {
|
|
517
554
|
rnCSS?: `${string};` | undefined;
|
|
518
555
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -526,6 +563,7 @@ declare const styled: {
|
|
|
526
563
|
attrs<S_37>(opts: Partial<S_37 & RN.TouchableHighlightProps> | ((props: S_37 & RN.TouchableHighlightProps) => Partial<S_37 & RN.TouchableHighlightProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_37 & RN.TouchableHighlightProps & {
|
|
527
564
|
rnCSS?: string | undefined;
|
|
528
565
|
shared: unknown;
|
|
566
|
+
theme: unknown;
|
|
529
567
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TouchableHighlightProps | S_37) & {
|
|
530
568
|
rnCSS?: `${string};` | undefined;
|
|
531
569
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -541,6 +579,7 @@ declare const styled: {
|
|
|
541
579
|
<S_38>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_38 & RN.TouchableNativeFeedbackProps & {
|
|
542
580
|
rnCSS?: string | undefined;
|
|
543
581
|
shared: unknown;
|
|
582
|
+
theme: unknown;
|
|
544
583
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TouchableNativeFeedbackProps & S_38 & {
|
|
545
584
|
rnCSS?: `${string};` | undefined;
|
|
546
585
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -554,6 +593,7 @@ declare const styled: {
|
|
|
554
593
|
attrs<S_39>(opts: Partial<S_39 & RN.TouchableNativeFeedbackProps> | ((props: S_39 & RN.TouchableNativeFeedbackProps) => Partial<S_39 & RN.TouchableNativeFeedbackProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_39 & RN.TouchableNativeFeedbackProps & {
|
|
555
594
|
rnCSS?: string | undefined;
|
|
556
595
|
shared: unknown;
|
|
596
|
+
theme: unknown;
|
|
557
597
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TouchableNativeFeedbackProps | S_39) & {
|
|
558
598
|
rnCSS?: `${string};` | undefined;
|
|
559
599
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -569,6 +609,7 @@ declare const styled: {
|
|
|
569
609
|
<S_40>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_40 & RN.TouchableOpacityProps & {
|
|
570
610
|
rnCSS?: string | undefined;
|
|
571
611
|
shared: unknown;
|
|
612
|
+
theme: unknown;
|
|
572
613
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TouchableOpacityProps & S_40 & {
|
|
573
614
|
rnCSS?: `${string};` | undefined;
|
|
574
615
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -582,6 +623,7 @@ declare const styled: {
|
|
|
582
623
|
attrs<S_41>(opts: Partial<S_41 & RN.TouchableOpacityProps> | ((props: S_41 & RN.TouchableOpacityProps) => Partial<S_41 & RN.TouchableOpacityProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_41 & RN.TouchableOpacityProps & {
|
|
583
624
|
rnCSS?: string | undefined;
|
|
584
625
|
shared: unknown;
|
|
626
|
+
theme: unknown;
|
|
585
627
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TouchableOpacityProps | S_41) & {
|
|
586
628
|
rnCSS?: `${string};` | undefined;
|
|
587
629
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -597,6 +639,7 @@ declare const styled: {
|
|
|
597
639
|
<S_42>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_42 & RN.TouchableWithoutFeedbackProps & {
|
|
598
640
|
rnCSS?: string | undefined;
|
|
599
641
|
shared: unknown;
|
|
642
|
+
theme: unknown;
|
|
600
643
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.TouchableWithoutFeedbackProps & S_42 & {
|
|
601
644
|
rnCSS?: `${string};` | undefined;
|
|
602
645
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -610,6 +653,7 @@ declare const styled: {
|
|
|
610
653
|
attrs<S_43>(opts: Partial<S_43 & RN.TouchableWithoutFeedbackProps> | ((props: S_43 & RN.TouchableWithoutFeedbackProps) => Partial<S_43 & RN.TouchableWithoutFeedbackProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_43 & RN.TouchableWithoutFeedbackProps & {
|
|
611
654
|
rnCSS?: string | undefined;
|
|
612
655
|
shared: unknown;
|
|
656
|
+
theme: unknown;
|
|
613
657
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.TouchableWithoutFeedbackProps | S_43) & {
|
|
614
658
|
rnCSS?: `${string};` | undefined;
|
|
615
659
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -625,6 +669,7 @@ declare const styled: {
|
|
|
625
669
|
<S_28>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_28 & RN.ViewProps & {
|
|
626
670
|
rnCSS?: string | undefined;
|
|
627
671
|
shared: unknown;
|
|
672
|
+
theme: unknown;
|
|
628
673
|
}) => string | number | boolean | null | undefined))[]): React.ForwardRefExoticComponent<RN.ViewProps & S_28 & {
|
|
629
674
|
rnCSS?: `${string};` | undefined;
|
|
630
675
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -638,6 +683,7 @@ declare const styled: {
|
|
|
638
683
|
attrs<S_29>(opts: Partial<S_29 & RN.ViewProps> | ((props: S_29 & RN.ViewProps) => Partial<S_29 & RN.ViewProps>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_29 & RN.ViewProps & {
|
|
639
684
|
rnCSS?: string | undefined;
|
|
640
685
|
shared: unknown;
|
|
686
|
+
theme: unknown;
|
|
641
687
|
}) => string | number | boolean | null | undefined))[]) => React.ForwardRefExoticComponent<(RN.ViewProps | S_29) & {
|
|
642
688
|
rnCSS?: `${string};` | undefined;
|
|
643
689
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -653,6 +699,7 @@ declare const styled: {
|
|
|
653
699
|
<S_44>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_44 & {
|
|
654
700
|
rnCSS?: string | undefined;
|
|
655
701
|
shared: unknown;
|
|
702
|
+
theme: unknown;
|
|
656
703
|
}) => string | number | boolean | null | undefined))[]): <Type>(props: S_44 & RN.FlatListProps<Type> & {
|
|
657
704
|
rnCSS?: `${string};` | undefined;
|
|
658
705
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -664,6 +711,7 @@ declare const styled: {
|
|
|
664
711
|
attrs<S_45>(opts: Partial<S_45 & RN.FlatListProps<any>> | ((props: S_45 & RN.FlatListProps<any>) => Partial<S_45 & RN.FlatListProps<any>>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_45 & RN.FlatListProps<any> & {
|
|
665
712
|
rnCSS?: string | undefined;
|
|
666
713
|
shared: unknown;
|
|
714
|
+
theme: unknown;
|
|
667
715
|
}) => string | number | boolean | null | undefined))[]) => <Props>(componentProps: S_45 & RN.FlatListProps<Props> & {
|
|
668
716
|
rnCSS?: `${string};` | undefined;
|
|
669
717
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -677,6 +725,7 @@ declare const styled: {
|
|
|
677
725
|
<S_46>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_46 & {
|
|
678
726
|
rnCSS?: string | undefined;
|
|
679
727
|
shared: unknown;
|
|
728
|
+
theme: unknown;
|
|
680
729
|
}) => string | number | boolean | null | undefined))[]): <Type_1>(props: S_46 & RN.SectionListProps<Type_1, RN.DefaultSectionT> & {
|
|
681
730
|
rnCSS?: `${string};` | undefined;
|
|
682
731
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -688,6 +737,7 @@ declare const styled: {
|
|
|
688
737
|
attrs<S_47>(opts: Partial<S_47 & RN.SectionListProps<any, RN.DefaultSectionT>> | ((props: S_47 & RN.SectionListProps<any, RN.DefaultSectionT>) => Partial<S_47 & RN.SectionListProps<any, RN.DefaultSectionT>>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_47 & RN.SectionListProps<any, RN.DefaultSectionT> & {
|
|
689
738
|
rnCSS?: string | undefined;
|
|
690
739
|
shared: unknown;
|
|
740
|
+
theme: unknown;
|
|
691
741
|
}) => string | number | boolean | null | undefined))[]) => <Props_1>(componentProps: S_47 & RN.SectionListProps<Props_1, RN.DefaultSectionT> & {
|
|
692
742
|
rnCSS?: `${string};` | undefined;
|
|
693
743
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -701,6 +751,7 @@ declare const styled: {
|
|
|
701
751
|
<S_48>(chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_48 & {
|
|
702
752
|
rnCSS?: string | undefined;
|
|
703
753
|
shared: unknown;
|
|
754
|
+
theme: unknown;
|
|
704
755
|
}) => string | number | boolean | null | undefined))[]): <Type_2>(props: S_48 & RN.VirtualizedListProps<Type_2> & {
|
|
705
756
|
rnCSS?: `${string};` | undefined;
|
|
706
757
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
@@ -712,6 +763,7 @@ declare const styled: {
|
|
|
712
763
|
attrs<S_49>(opts: Partial<S_49 & RN.VirtualizedListProps<any>> | ((props: S_49 & RN.VirtualizedListProps<any>) => Partial<S_49 & RN.VirtualizedListProps<any>>)): (chunks: TemplateStringsArray, ...functs: ((string | number | boolean | null | undefined) | ((arg: S_49 & RN.VirtualizedListProps<any> & {
|
|
713
764
|
rnCSS?: string | undefined;
|
|
714
765
|
shared: unknown;
|
|
766
|
+
theme: unknown;
|
|
715
767
|
}) => string | number | boolean | null | undefined))[]) => <Props_2>(componentProps: S_49 & RN.VirtualizedListProps<Props_2> & {
|
|
716
768
|
rnCSS?: `${string};` | undefined;
|
|
717
769
|
onMouseEnter?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
package/dist/styleComponent.d.ts
CHANGED
package/dist/styleComponent.js
CHANGED
|
@@ -17,7 +17,7 @@ const styleMap = {};
|
|
|
17
17
|
// We use this to share value within the component (Theme, Translation, whatever)
|
|
18
18
|
exports.SharedValue = react_1.default.createContext(undefined);
|
|
19
19
|
function buildCSSString(chunks, functs, props, shared) {
|
|
20
|
-
let computedString = chunks.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? functs[i]({ ...props, shared }) : functs[i]])).flat().join('');
|
|
20
|
+
let computedString = chunks.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? functs[i]({ ...props, shared, theme: shared }) : functs[i]])).flat().join('');
|
|
21
21
|
if (props.rnCSS)
|
|
22
22
|
computedString += props.rnCSS.replace(/=/gm, ':') + ';';
|
|
23
23
|
return computedString;
|
package/dist/useTheme.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/** Provider for the theme. */
|
|
2
3
|
export declare const ThemeProvider: ({ theme, children }: {
|
|
3
4
|
theme: unknown;
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
}) => JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the Theme
|
|
9
|
+
* @returns The Theme object
|
|
10
|
+
*/
|
|
6
11
|
export declare const useTheme: () => unknown;
|
|
12
|
+
/**
|
|
13
|
+
* Adds the theme prop to a non rn-css component
|
|
14
|
+
* @param Component A non rn-css component
|
|
15
|
+
* @returns A component with the theme prop
|
|
16
|
+
*/
|
|
7
17
|
export declare const withTheme: <T>(Component: React.ComponentType<T>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<React.Component<{}, {}, any>>>;
|
package/dist/useTheme.js
CHANGED
|
@@ -6,12 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.withTheme = exports.useTheme = exports.ThemeProvider = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styleComponent_1 = require("./styleComponent");
|
|
9
|
+
/** Provider for the theme. */
|
|
9
10
|
const ThemeProvider = ({ theme, children }) => {
|
|
10
11
|
return react_1.default.createElement(styleComponent_1.SharedValue.Provider, { value: theme }, children);
|
|
11
12
|
};
|
|
12
13
|
exports.ThemeProvider = ThemeProvider;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the Theme
|
|
16
|
+
* @returns The Theme object
|
|
17
|
+
*/
|
|
13
18
|
const useTheme = () => react_1.default.useContext(styleComponent_1.SharedValue);
|
|
14
19
|
exports.useTheme = useTheme;
|
|
20
|
+
/**
|
|
21
|
+
* Adds the theme prop to a non rn-css component
|
|
22
|
+
* @param Component A non rn-css component
|
|
23
|
+
* @returns A component with the theme prop
|
|
24
|
+
*/
|
|
15
25
|
const withTheme = (Component) => {
|
|
16
26
|
const theme = (0, exports.useTheme)();
|
|
17
27
|
const ThemedComponent = react_1.default.forwardRef((props, ref) => react_1.default.createElement(Component, { ref: ref, theme: theme, ...props }));
|
package/package.json
CHANGED
package/src/styleComponent.tsx
CHANGED
|
@@ -15,7 +15,7 @@ const styleMap: StyleMap = {}
|
|
|
15
15
|
export const SharedValue = React.createContext<unknown>(undefined)
|
|
16
16
|
|
|
17
17
|
type Primitive = number | string | null | undefined | boolean
|
|
18
|
-
type Functs<T> = (arg: T & { rnCSS?: string; shared: unknown }) => Primitive
|
|
18
|
+
type Functs<T> = (arg: T & { rnCSS?: string; shared: unknown, theme: unknown }) => Primitive
|
|
19
19
|
type OptionalProps = {
|
|
20
20
|
rnCSS?: `${string};`;
|
|
21
21
|
onMouseEnter?: (event: MouseEvent) => void;
|
|
@@ -25,7 +25,7 @@ type OptionalProps = {
|
|
|
25
25
|
style?: StyleProp<any>;
|
|
26
26
|
}
|
|
27
27
|
function buildCSSString<T extends { rnCSS?: string }> (chunks: TemplateStringsArray, functs: (Primitive | Functs<T>)[], props: T, shared: unknown) {
|
|
28
|
-
let computedString = chunks.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? (functs[i] as Functs<T>)({ ...props, shared }) : functs[i]])).flat().join('')
|
|
28
|
+
let computedString = chunks.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? (functs[i] as Functs<T>)({ ...props, shared, theme: shared }) : functs[i]])).flat().join('')
|
|
29
29
|
if (props.rnCSS) computedString += props.rnCSS.replace(/=/gm, ':') + ';'
|
|
30
30
|
return computedString
|
|
31
31
|
}
|
package/src/useTheme.tsx
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { SharedValue } from './styleComponent'
|
|
3
3
|
|
|
4
|
+
/** Provider for the theme. */
|
|
4
5
|
export const ThemeProvider = ({ theme, children }: { theme: unknown; children: React.ReactNode }) => {
|
|
5
6
|
return <SharedValue.Provider value={theme}>
|
|
6
7
|
{children}
|
|
7
8
|
</SharedValue.Provider>
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Returns the Theme
|
|
13
|
+
* @returns The Theme object
|
|
14
|
+
*/
|
|
10
15
|
export const useTheme = () => React.useContext(SharedValue)
|
|
11
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Adds the theme prop to a non rn-css component
|
|
19
|
+
* @param Component A non rn-css component
|
|
20
|
+
* @returns A component with the theme prop
|
|
21
|
+
*/
|
|
12
22
|
export const withTheme = <T, >(Component: React.ComponentType<T>) => {
|
|
13
23
|
const theme = useTheme()
|
|
14
24
|
const ThemedComponent = React.forwardRef<React.Component, T>((props: T, ref) => <Component ref={ref} theme={theme} {...props} />)
|