react-native-css 3.0.0 → 3.0.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.
Files changed (247) hide show
  1. package/dist/commonjs/compiler/declarations.js +51 -0
  2. package/dist/commonjs/compiler/declarations.js.map +1 -1
  3. package/dist/commonjs/compiler/lightningcss-loader.js +12 -2
  4. package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
  5. package/dist/commonjs/compiler/supports.js +3 -1
  6. package/dist/commonjs/compiler/supports.js.map +1 -1
  7. package/dist/commonjs/components/ActivityIndicator.js +4 -4
  8. package/dist/commonjs/components/ActivityIndicator.js.map +1 -1
  9. package/dist/commonjs/components/Button.js +4 -4
  10. package/dist/commonjs/components/Button.js.map +1 -1
  11. package/dist/commonjs/components/FlatList.js +4 -4
  12. package/dist/commonjs/components/FlatList.js.map +1 -1
  13. package/dist/commonjs/components/Image.js +4 -4
  14. package/dist/commonjs/components/Image.js.map +1 -1
  15. package/dist/commonjs/components/ImageBackground.js +4 -4
  16. package/dist/commonjs/components/ImageBackground.js.map +1 -1
  17. package/dist/commonjs/components/KeyboardAvoidingView.js +4 -4
  18. package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
  19. package/dist/commonjs/components/Pressable.js +4 -4
  20. package/dist/commonjs/components/Pressable.js.map +1 -1
  21. package/dist/commonjs/components/ScrollView.js +4 -4
  22. package/dist/commonjs/components/ScrollView.js.map +1 -1
  23. package/dist/commonjs/components/Switch.js +4 -4
  24. package/dist/commonjs/components/Switch.js.map +1 -1
  25. package/dist/commonjs/components/Text.js +4 -4
  26. package/dist/commonjs/components/Text.js.map +1 -1
  27. package/dist/commonjs/components/TextInput.js +4 -4
  28. package/dist/commonjs/components/TextInput.js.map +1 -1
  29. package/dist/commonjs/components/TouchableHighlight.js +4 -4
  30. package/dist/commonjs/components/TouchableHighlight.js.map +1 -1
  31. package/dist/commonjs/components/TouchableOpacity.js +4 -4
  32. package/dist/commonjs/components/TouchableOpacity.js.map +1 -1
  33. package/dist/commonjs/components/TouchableWithoutFeedback.js +4 -4
  34. package/dist/commonjs/components/TouchableWithoutFeedback.js.map +1 -1
  35. package/dist/commonjs/components/View.js +4 -4
  36. package/dist/commonjs/components/View.js.map +1 -1
  37. package/dist/commonjs/components/VirtualizedList.js +4 -4
  38. package/dist/commonjs/components/VirtualizedList.js.map +1 -1
  39. package/dist/commonjs/components/copyComponentProperties.js +19 -0
  40. package/dist/commonjs/components/copyComponentProperties.js.map +1 -0
  41. package/dist/commonjs/components/index.cjs +3 -3
  42. package/dist/commonjs/components/index.cjs.map +1 -1
  43. package/dist/commonjs/metro/resolver.js +5 -3
  44. package/dist/commonjs/metro/resolver.js.map +1 -1
  45. package/dist/commonjs/native/api.js +5 -1
  46. package/dist/commonjs/native/api.js.map +1 -1
  47. package/dist/commonjs/native/react/useNativeCss.js +11 -5
  48. package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
  49. package/dist/commonjs/native/styles/functions/color-mix.js +50 -0
  50. package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -0
  51. package/dist/commonjs/native/styles/functions/index.js +11 -0
  52. package/dist/commonjs/native/styles/functions/index.js.map +1 -1
  53. package/dist/commonjs/native/styles/index.js +249 -19
  54. package/dist/commonjs/native/styles/index.js.map +1 -1
  55. package/dist/commonjs/web/api.js +5 -2
  56. package/dist/commonjs/web/api.js.map +1 -1
  57. package/dist/module/compiler/declarations.js +50 -0
  58. package/dist/module/compiler/declarations.js.map +1 -1
  59. package/dist/module/compiler/lightningcss-loader.js +12 -2
  60. package/dist/module/compiler/lightningcss-loader.js.map +1 -1
  61. package/dist/module/compiler/supports.js +3 -1
  62. package/dist/module/compiler/supports.js.map +1 -1
  63. package/dist/module/components/ActivityIndicator.js +3 -2
  64. package/dist/module/components/ActivityIndicator.js.map +1 -1
  65. package/dist/module/components/Button.js +3 -2
  66. package/dist/module/components/Button.js.map +1 -1
  67. package/dist/module/components/FlatList.js +3 -2
  68. package/dist/module/components/FlatList.js.map +1 -1
  69. package/dist/module/components/Image.js +3 -2
  70. package/dist/module/components/Image.js.map +1 -1
  71. package/dist/module/components/ImageBackground.js +3 -2
  72. package/dist/module/components/ImageBackground.js.map +1 -1
  73. package/dist/module/components/KeyboardAvoidingView.js +3 -2
  74. package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
  75. package/dist/module/components/Pressable.js +3 -2
  76. package/dist/module/components/Pressable.js.map +1 -1
  77. package/dist/module/components/ScrollView.js +3 -2
  78. package/dist/module/components/ScrollView.js.map +1 -1
  79. package/dist/module/components/Switch.js +3 -2
  80. package/dist/module/components/Switch.js.map +1 -1
  81. package/dist/module/components/Text.js +3 -2
  82. package/dist/module/components/Text.js.map +1 -1
  83. package/dist/module/components/TextInput.js +3 -2
  84. package/dist/module/components/TextInput.js.map +1 -1
  85. package/dist/module/components/TouchableHighlight.js +3 -2
  86. package/dist/module/components/TouchableHighlight.js.map +1 -1
  87. package/dist/module/components/TouchableOpacity.js +3 -2
  88. package/dist/module/components/TouchableOpacity.js.map +1 -1
  89. package/dist/module/components/TouchableWithoutFeedback.js +3 -2
  90. package/dist/module/components/TouchableWithoutFeedback.js.map +1 -1
  91. package/dist/module/components/View.js +3 -2
  92. package/dist/module/components/View.js.map +1 -1
  93. package/dist/module/components/VirtualizedList.js +3 -2
  94. package/dist/module/components/VirtualizedList.js.map +1 -1
  95. package/dist/module/components/copyComponentProperties.js +15 -0
  96. package/dist/module/components/copyComponentProperties.js.map +1 -0
  97. package/dist/module/components/index.cjs +3 -3
  98. package/dist/module/components/index.cjs.map +1 -1
  99. package/dist/module/metro/resolver.js +5 -3
  100. package/dist/module/metro/resolver.js.map +1 -1
  101. package/dist/module/native/api.js +4 -1
  102. package/dist/module/native/api.js.map +1 -1
  103. package/dist/module/native/react/useNativeCss.js +11 -5
  104. package/dist/module/native/react/useNativeCss.js.map +1 -1
  105. package/dist/module/native/styles/functions/color-mix.js +45 -0
  106. package/dist/module/native/styles/functions/color-mix.js.map +1 -0
  107. package/dist/module/native/styles/functions/index.js +1 -0
  108. package/dist/module/native/styles/functions/index.js.map +1 -1
  109. package/dist/module/native/styles/index.js +250 -19
  110. package/dist/module/native/styles/index.js.map +1 -1
  111. package/dist/module/web/api.js +5 -2
  112. package/dist/module/web/api.js.map +1 -1
  113. package/dist/typescript/commonjs/.config/eslint.config.d.mts +1 -1
  114. package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -1
  115. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +1 -0
  116. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  117. package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
  118. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +2 -4
  119. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -1
  120. package/dist/typescript/commonjs/src/components/Button.d.ts +2 -4
  121. package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -1
  122. package/dist/typescript/commonjs/src/components/FlatList.d.ts +2 -2
  123. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
  124. package/dist/typescript/commonjs/src/components/Image.d.ts +2 -4
  125. package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -1
  126. package/dist/typescript/commonjs/src/components/ImageBackground.d.ts +2 -4
  127. package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
  128. package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts +2 -4
  129. package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
  130. package/dist/typescript/commonjs/src/components/Pressable.d.ts +2 -4
  131. package/dist/typescript/commonjs/src/components/Pressable.d.ts.map +1 -1
  132. package/dist/typescript/commonjs/src/components/ScrollView.d.ts +2 -4
  133. package/dist/typescript/commonjs/src/components/ScrollView.d.ts.map +1 -1
  134. package/dist/typescript/commonjs/src/components/Switch.d.ts +2 -6
  135. package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -1
  136. package/dist/typescript/commonjs/src/components/Text.d.ts +2 -6
  137. package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -1
  138. package/dist/typescript/commonjs/src/components/TextInput.d.ts +2 -4
  139. package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -1
  140. package/dist/typescript/commonjs/src/components/TouchableHighlight.d.ts +2 -4
  141. package/dist/typescript/commonjs/src/components/TouchableHighlight.d.ts.map +1 -1
  142. package/dist/typescript/commonjs/src/components/TouchableOpacity.d.ts +2 -4
  143. package/dist/typescript/commonjs/src/components/TouchableOpacity.d.ts.map +1 -1
  144. package/dist/typescript/commonjs/src/components/TouchableWithoutFeedback.d.ts +2 -4
  145. package/dist/typescript/commonjs/src/components/TouchableWithoutFeedback.d.ts.map +1 -1
  146. package/dist/typescript/commonjs/src/components/View.d.ts +2 -6
  147. package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -1
  148. package/dist/typescript/commonjs/src/components/VirtualizedList.d.ts +2 -2
  149. package/dist/typescript/commonjs/src/components/VirtualizedList.d.ts.map +1 -1
  150. package/dist/typescript/commonjs/src/components/copyComponentProperties.d.ts +5 -0
  151. package/dist/typescript/commonjs/src/components/copyComponentProperties.d.ts.map +1 -0
  152. package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
  153. package/dist/typescript/commonjs/src/native/api.d.ts +1 -1
  154. package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
  155. package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
  156. package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts +3 -0
  157. package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts.map +1 -0
  158. package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts +1 -0
  159. package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts.map +1 -1
  160. package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
  161. package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +1 -1
  162. package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
  163. package/dist/typescript/commonjs/src/web/api.d.ts +2 -2
  164. package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
  165. package/dist/typescript/module/.config/eslint.config.d.mts +1 -1
  166. package/dist/typescript/module/example/src/App.d.ts.map +1 -1
  167. package/dist/typescript/module/src/compiler/declarations.d.ts +1 -0
  168. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  169. package/dist/typescript/module/src/compiler/lightningcss-loader.d.ts.map +1 -1
  170. package/dist/typescript/module/src/components/ActivityIndicator.d.ts +2 -4
  171. package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -1
  172. package/dist/typescript/module/src/components/Button.d.ts +2 -4
  173. package/dist/typescript/module/src/components/Button.d.ts.map +1 -1
  174. package/dist/typescript/module/src/components/FlatList.d.ts +2 -2
  175. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
  176. package/dist/typescript/module/src/components/Image.d.ts +2 -4
  177. package/dist/typescript/module/src/components/Image.d.ts.map +1 -1
  178. package/dist/typescript/module/src/components/ImageBackground.d.ts +2 -4
  179. package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
  180. package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts +2 -4
  181. package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
  182. package/dist/typescript/module/src/components/Pressable.d.ts +2 -4
  183. package/dist/typescript/module/src/components/Pressable.d.ts.map +1 -1
  184. package/dist/typescript/module/src/components/ScrollView.d.ts +2 -4
  185. package/dist/typescript/module/src/components/ScrollView.d.ts.map +1 -1
  186. package/dist/typescript/module/src/components/Switch.d.ts +2 -6
  187. package/dist/typescript/module/src/components/Switch.d.ts.map +1 -1
  188. package/dist/typescript/module/src/components/Text.d.ts +2 -6
  189. package/dist/typescript/module/src/components/Text.d.ts.map +1 -1
  190. package/dist/typescript/module/src/components/TextInput.d.ts +2 -4
  191. package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -1
  192. package/dist/typescript/module/src/components/TouchableHighlight.d.ts +2 -4
  193. package/dist/typescript/module/src/components/TouchableHighlight.d.ts.map +1 -1
  194. package/dist/typescript/module/src/components/TouchableOpacity.d.ts +2 -4
  195. package/dist/typescript/module/src/components/TouchableOpacity.d.ts.map +1 -1
  196. package/dist/typescript/module/src/components/TouchableWithoutFeedback.d.ts +2 -4
  197. package/dist/typescript/module/src/components/TouchableWithoutFeedback.d.ts.map +1 -1
  198. package/dist/typescript/module/src/components/View.d.ts +2 -6
  199. package/dist/typescript/module/src/components/View.d.ts.map +1 -1
  200. package/dist/typescript/module/src/components/VirtualizedList.d.ts +2 -2
  201. package/dist/typescript/module/src/components/VirtualizedList.d.ts.map +1 -1
  202. package/dist/typescript/module/src/components/copyComponentProperties.d.ts +5 -0
  203. package/dist/typescript/module/src/components/copyComponentProperties.d.ts.map +1 -0
  204. package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
  205. package/dist/typescript/module/src/native/api.d.ts +1 -1
  206. package/dist/typescript/module/src/native/api.d.ts.map +1 -1
  207. package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
  208. package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts +3 -0
  209. package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -0
  210. package/dist/typescript/module/src/native/styles/functions/index.d.ts +1 -0
  211. package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
  212. package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
  213. package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +1 -1
  214. package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
  215. package/dist/typescript/module/src/web/api.d.ts +2 -2
  216. package/dist/typescript/module/src/web/api.d.ts.map +1 -1
  217. package/package.json +4 -3
  218. package/src/compiler/declarations.ts +96 -0
  219. package/src/compiler/lightningcss-loader.ts +20 -1
  220. package/src/compiler/supports.ts +2 -0
  221. package/src/components/ActivityIndicator.tsx +8 -5
  222. package/src/components/Button.tsx +8 -3
  223. package/src/components/FlatList.tsx +13 -4
  224. package/src/components/Image.tsx +8 -3
  225. package/src/components/ImageBackground.tsx +8 -5
  226. package/src/components/KeyboardAvoidingView.tsx +8 -5
  227. package/src/components/Pressable.tsx +8 -3
  228. package/src/components/ScrollView.tsx +8 -5
  229. package/src/components/Switch.tsx +8 -3
  230. package/src/components/Text.tsx +8 -3
  231. package/src/components/TextInput.tsx +8 -3
  232. package/src/components/TouchableHighlight.tsx +8 -5
  233. package/src/components/TouchableOpacity.tsx +8 -5
  234. package/src/components/TouchableWithoutFeedback.tsx +8 -5
  235. package/src/components/View.tsx +8 -3
  236. package/src/components/VirtualizedList.tsx +17 -5
  237. package/src/components/copyComponentProperties.ts +21 -0
  238. package/src/components/index.cts +3 -3
  239. package/src/metro/resolver.ts +10 -3
  240. package/src/native/api.tsx +6 -2
  241. package/src/native/react/useNativeCss.ts +13 -6
  242. package/src/native/styles/functions/color-mix.ts +68 -0
  243. package/src/native/styles/functions/index.ts +1 -0
  244. package/src/native/styles/index.ts +302 -26
  245. package/src/utilities/dot-notation.types.ts +10 -3
  246. package/src/web/api.tsx +9 -4
  247. package/types.d.ts +3 -0
@@ -9,14 +9,17 @@ import {
9
9
  type StyledProps,
10
10
  } from "react-native-css";
11
11
 
12
+ import { copyComponentProperties } from "./copyComponentProperties";
13
+
12
14
  const mapping: StyledConfiguration<typeof RNTouchableHighlight> = {
13
15
  className: "style",
14
16
  };
15
17
 
16
- export function TouchableHighlight(
17
- props: StyledProps<TouchableHighlightProps, typeof mapping>,
18
- ) {
19
- return useCssElement(RNTouchableHighlight, props, mapping);
20
- }
18
+ export const TouchableHighlight = copyComponentProperties(
19
+ RNTouchableHighlight,
20
+ (props: StyledProps<TouchableHighlightProps, typeof mapping>) => {
21
+ return useCssElement(RNTouchableHighlight, props, mapping);
22
+ },
23
+ );
21
24
 
22
25
  export default TouchableHighlight;
@@ -9,14 +9,17 @@ import {
9
9
  type StyledProps,
10
10
  } from "react-native-css";
11
11
 
12
+ import { copyComponentProperties } from "./copyComponentProperties";
13
+
12
14
  const mapping: StyledConfiguration<typeof RNTouchableOpacity> = {
13
15
  className: "style",
14
16
  };
15
17
 
16
- export function TouchableOpacity(
17
- props: StyledProps<TouchableOpacityProps, typeof mapping>,
18
- ) {
19
- return useCssElement(RNTouchableOpacity, props, mapping);
20
- }
18
+ export const TouchableOpacity = copyComponentProperties(
19
+ RNTouchableOpacity,
20
+ (props: StyledProps<TouchableOpacityProps, typeof mapping>) => {
21
+ return useCssElement(RNTouchableOpacity, props, mapping);
22
+ },
23
+ );
21
24
 
22
25
  export default TouchableOpacity;
@@ -9,14 +9,17 @@ import {
9
9
  type StyledProps,
10
10
  } from "react-native-css";
11
11
 
12
+ import { copyComponentProperties } from "./copyComponentProperties";
13
+
12
14
  const mapping: StyledConfiguration<typeof RNTouchableWithoutFeedback> = {
13
15
  className: "style",
14
16
  };
15
17
 
16
- export function TouchableWithoutFeedback(
17
- props: StyledProps<TouchableWithoutFeedbackProps, typeof mapping>,
18
- ) {
19
- return useCssElement(RNTouchableWithoutFeedback, props, mapping);
20
- }
18
+ export const TouchableWithoutFeedback = copyComponentProperties(
19
+ RNTouchableWithoutFeedback,
20
+ (props: StyledProps<TouchableWithoutFeedbackProps, typeof mapping>) => {
21
+ return useCssElement(RNTouchableWithoutFeedback, props, mapping);
22
+ },
23
+ );
21
24
 
22
25
  export default TouchableWithoutFeedback;
@@ -6,12 +6,17 @@ import {
6
6
  type StyledProps,
7
7
  } from "react-native-css";
8
8
 
9
+ import { copyComponentProperties } from "./copyComponentProperties";
10
+
9
11
  const mapping = {
10
12
  className: "style",
11
13
  } satisfies StyledConfiguration<typeof RNView>;
12
14
 
13
- export function View(props: StyledProps<ViewProps, typeof mapping>) {
14
- return useCssElement(RNView, props, mapping);
15
- }
15
+ export const View = copyComponentProperties(
16
+ RNView,
17
+ (props: StyledProps<ViewProps, typeof mapping>) => {
18
+ return useCssElement(RNView, props, mapping);
19
+ },
20
+ );
16
21
 
17
22
  export default View;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  import {
2
3
  VirtualizedList as RNVirtualizedList,
3
4
  type VirtualizedListProps,
@@ -9,6 +10,8 @@ import {
9
10
  type StyledProps,
10
11
  } from "react-native-css";
11
12
 
13
+ import { copyComponentProperties } from "./copyComponentProperties";
14
+
12
15
  const mapping: StyledConfiguration<typeof RNVirtualizedList> = {
13
16
  className: "style",
14
17
  ListFooterComponentClassName: "ListFooterComponentStyle",
@@ -16,10 +19,19 @@ const mapping: StyledConfiguration<typeof RNVirtualizedList> = {
16
19
  contentContainerClassName: "contentContainerStyle",
17
20
  };
18
21
 
19
- export function VirtualizedList<ItemT>(
20
- props: StyledProps<VirtualizedListProps<ItemT>, typeof mapping>,
21
- ) {
22
- return useCssElement(RNVirtualizedList, props, mapping);
23
- }
22
+ export const VirtualizedList = copyComponentProperties(
23
+ RNVirtualizedList,
24
+ function <ItemT>(
25
+ props: StyledProps<VirtualizedListProps<ItemT>, typeof mapping>,
26
+ ) {
27
+ return useCssElement(RNVirtualizedList, props, mapping);
28
+ },
29
+ ) as unknown as typeof RNVirtualizedList &
30
+ (<ItemT>(
31
+ props: StyledProps<
32
+ VirtualizedListProps<ItemT>,
33
+ StyledConfiguration<typeof RNVirtualizedList>
34
+ >,
35
+ ) => ReactNode);
24
36
 
25
37
  export default VirtualizedList;
@@ -0,0 +1,21 @@
1
+ import type { ComponentType } from "react";
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ type AnyComponent = ComponentType<any>;
5
+
6
+ export function copyComponentProperties<T extends AnyComponent>(
7
+ BaseComponent: T,
8
+ Component: AnyComponent,
9
+ ) {
10
+ for (const [key, value] of Object.entries(BaseComponent)) {
11
+ if (key === "$$typeof" || key === "render" || key === "contextType") {
12
+ continue;
13
+ }
14
+
15
+ (Component as unknown as Record<string, unknown>)[key] = value;
16
+ }
17
+
18
+ Component.displayName = BaseComponent.displayName;
19
+
20
+ return Component as unknown as T;
21
+ }
@@ -25,6 +25,9 @@ module.exports = {
25
25
  get Pressable() {
26
26
  return require("./Pressable").Pressable;
27
27
  },
28
+ get ScrollView() {
29
+ return require("./ScrollView").ScrollView;
30
+ },
28
31
  get Switch() {
29
32
  return require("./Switch").Switch;
30
33
  },
@@ -71,9 +74,6 @@ module.exports = {
71
74
  get SafeAreaView() {
72
75
  return require("react-native").SafeAreaView;
73
76
  },
74
- get ScrollView() {
75
- return require("react-native").ScrollView;
76
- },
77
77
  get SectionList() {
78
78
  return require("react-native").SectionList;
79
79
  },
@@ -26,7 +26,7 @@ export function nativeResolver(
26
26
  const resolution = resolver(context, moduleName, platform);
27
27
  const isInternal = isFromThisModule(context.originModulePath);
28
28
  const isReactNativeIndex = context.originModulePath.endsWith(
29
- `react-native${sep}index.js`,
29
+ `${sep}react-native${sep}index.js`,
30
30
  );
31
31
 
32
32
  if (isInternal || resolution.type !== "sourceFile" || isReactNativeIndex) {
@@ -73,7 +73,9 @@ export function webResolver(
73
73
  // Only operate on source files
74
74
  resolution.type !== "sourceFile" ||
75
75
  // Skip anything that isn't importing from `react-native-web`
76
- !resolution.filePath.includes(`${sep}react-native-web${sep}`)
76
+ !resolution.filePath.includes(`${sep}react-native-web${sep}`) ||
77
+ // Skip internal react-native-web files
78
+ resolution.filePath.includes(`${sep}react-native-web${sep}dist${sep}vendor`)
77
79
  ) {
78
80
  return resolution;
79
81
  }
@@ -83,7 +85,12 @@ export function webResolver(
83
85
  const isIndex = segments.at(-1)?.startsWith("index.");
84
86
  const module = segments.at(-2);
85
87
 
86
- if (!isIndex || !module || !allowedModules.has(module)) {
88
+ if (
89
+ !isIndex ||
90
+ !module ||
91
+ !allowedModules.has(module) ||
92
+ module === "VirtualizedList"
93
+ ) {
87
94
  return resolution;
88
95
  }
89
96
 
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- import { useContext, useState } from "react";
2
+ import { useContext, useState, type ComponentType } from "react";
3
3
  import { Appearance } from "react-native";
4
4
 
5
5
  import type { StyleDescriptor } from "react-native-css/compiler";
@@ -30,6 +30,10 @@ export {
30
30
 
31
31
  export { useNativeCss };
32
32
 
33
+ const defaultMapping: StyledConfiguration<ComponentType<{ style: unknown }>> = {
34
+ className: "style",
35
+ };
36
+
33
37
  /**
34
38
  * Generates a new Higher-Order component the wraps the base component and applies the styles.
35
39
  * This is added to the `interopComponents` map so that it can be used in the `wrapJSX` function
@@ -41,7 +45,7 @@ export const styled = <
41
45
  const M extends StyledConfiguration<C>,
42
46
  >(
43
47
  baseComponent: C,
44
- mapping: M,
48
+ mapping: M = defaultMapping as M,
45
49
  options?: StyledOptions,
46
50
  ) => {
47
51
  let component: any;
@@ -172,29 +172,36 @@ export function useNativeCss(
172
172
  export function mappingToConfig(mapping: StyledConfiguration<any>) {
173
173
  return Object.entries(mapping).flatMap(([key, value]): Config => {
174
174
  if (value === true) {
175
- return { source: key, target: key };
175
+ return {
176
+ source: key,
177
+ target: key,
178
+ };
176
179
  } else if (value === false) {
177
180
  return { source: key, target: false };
178
181
  } else if (typeof value === "string") {
179
182
  return { source: key, target: value.split(".") };
180
183
  } else if (typeof value === "object") {
184
+ const nativeStyleMapping = value.nativeStyleMapping as
185
+ | Record<string, string>
186
+ | undefined;
187
+
181
188
  if (Array.isArray(value)) {
182
- return { source: key, target: value };
189
+ return { source: key, target: value, nativeStyleMapping };
183
190
  }
184
191
 
185
192
  if ("target" in value) {
186
193
  if (value.target === false) {
187
- return { source: key, target: false };
194
+ return { source: key, target: false, nativeStyleMapping };
188
195
  } else if (typeof value.target === "string") {
189
196
  const target = value.target.split(".");
190
197
 
191
198
  if (target.length === 1) {
192
- return { source: key, target: target[0]! };
199
+ return { source: key, target: target[0]!, nativeStyleMapping };
193
200
  } else {
194
- return { source: key, target };
201
+ return { source: key, target, nativeStyleMapping };
195
202
  }
196
203
  } else if (Array.isArray(value.target)) {
197
- return { source: key, target: value.target };
204
+ return { source: key, target: value.target, nativeStyleMapping };
198
205
  }
199
206
  }
200
207
  }
@@ -0,0 +1,68 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
+ import type { PlainColorObject } from "colorjs.io";
3
+ import {
4
+ ColorSpace,
5
+ to as convert,
6
+ mix,
7
+ OKLab,
8
+ P3,
9
+ parse,
10
+ sRGB,
11
+ type ColorConstructor,
12
+ } from "colorjs.io/fn";
13
+
14
+ import type { StyleFunctionResolver } from "../resolve";
15
+
16
+ ColorSpace.register(sRGB);
17
+ ColorSpace.register(P3);
18
+ ColorSpace.register(OKLab);
19
+
20
+ export const colorMix: StyleFunctionResolver = (resolveValue, value) => {
21
+ const args = resolveValue(value[2]);
22
+
23
+ if (!Array.isArray(args) || args.length < 3) {
24
+ return;
25
+ }
26
+
27
+ try {
28
+ const space = args.shift();
29
+
30
+ let left: ColorConstructor | PlainColorObject = parse(
31
+ args.shift() as string,
32
+ );
33
+
34
+ let next = args.shift();
35
+
36
+ if (typeof next === "string" && next.endsWith("%")) {
37
+ left.alpha = parseFloat(next) / 100;
38
+ next = args.shift();
39
+ }
40
+
41
+ if (next === undefined) {
42
+ if (left.spaceId !== "srgb") {
43
+ left = convert(left, "srgb");
44
+ }
45
+
46
+ return `rgba(${(left.coords[0] ?? 0) * 255}, ${(left.coords[1] ?? 0) * 255}, ${(left.coords[2] ?? 0) * 255}, ${left.alpha})`;
47
+ }
48
+
49
+ if (typeof next !== "string") {
50
+ return;
51
+ }
52
+ const right = parse(next);
53
+
54
+ next = args.shift();
55
+ if (next && typeof next === "string" && next.endsWith("%")) {
56
+ right.alpha = parseFloat(next) / 100;
57
+ }
58
+
59
+ const result = mix(left, right, {
60
+ space,
61
+ outputSpace: "srgb",
62
+ });
63
+
64
+ return `rgba(${(result.coords[0] ?? 0) * 255}, ${(result.coords[1] ?? 0) * 255}, ${(result.coords[2] ?? 0) * 255}, ${result.alpha})`;
65
+ } catch {
66
+ return;
67
+ }
68
+ };
@@ -5,3 +5,4 @@ export * from "./numeric-functions";
5
5
  export * from "./platform-functions";
6
6
  export * from "./string-functions";
7
7
  export * from "./transform-functions";
8
+ export * from "./color-mix";