react-native-unistyles 3.0.0-nightly-20250122 → 3.0.0-nightly-20250129

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 (107) hide show
  1. package/android/src/main/cxx/NativeUnistylesModule.cpp +1 -1
  2. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +1 -2
  3. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +4 -0
  4. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +2 -1
  5. package/android/src/main/java/com/unistyles/UnistylesModule.kt +0 -4
  6. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +6 -6
  7. package/components/native/Animated/package.json +5 -0
  8. package/cxx/core/UnistylesRegistry.cpp +24 -3
  9. package/cxx/core/UnistylesRegistry.h +1 -0
  10. package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -0
  11. package/lib/commonjs/components/native/Animated.js +23 -0
  12. package/lib/commonjs/components/native/Animated.js.map +1 -0
  13. package/lib/commonjs/components/native/ImageBackground.js +3 -1
  14. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  15. package/lib/commonjs/components/native/Pressable.native.js +16 -3
  16. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  17. package/lib/commonjs/core/createUnistylesElement.js +26 -22
  18. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  19. package/lib/commonjs/core/createUnistylesElement.native.js +25 -21
  20. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  21. package/lib/commonjs/core/createUnistylesImageBackground.js +34 -30
  22. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  23. package/lib/commonjs/core/getClassname.js +1 -3
  24. package/lib/commonjs/core/getClassname.js.map +1 -1
  25. package/lib/commonjs/utils.js +16 -1
  26. package/lib/commonjs/utils.js.map +1 -1
  27. package/lib/commonjs/web/utils/unistyle.js +5 -1
  28. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  29. package/lib/module/components/native/Animated.js +19 -0
  30. package/lib/module/components/native/Animated.js.map +1 -0
  31. package/lib/module/components/native/ImageBackground.js +3 -1
  32. package/lib/module/components/native/ImageBackground.js.map +1 -1
  33. package/lib/module/components/native/Pressable.native.js +17 -4
  34. package/lib/module/components/native/Pressable.native.js.map +1 -1
  35. package/lib/module/core/createUnistylesElement.js +26 -22
  36. package/lib/module/core/createUnistylesElement.js.map +1 -1
  37. package/lib/module/core/createUnistylesElement.native.js +26 -22
  38. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  39. package/lib/module/core/createUnistylesImageBackground.js +35 -31
  40. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  41. package/lib/module/core/getClassname.js +2 -4
  42. package/lib/module/core/getClassname.js.map +1 -1
  43. package/lib/module/utils.js +14 -0
  44. package/lib/module/utils.js.map +1 -1
  45. package/lib/module/web/utils/unistyle.js +5 -1
  46. package/lib/module/web/utils/unistyle.js.map +1 -1
  47. package/lib/typescript/src/components/native/ActivityIndicator.d.ts +1 -3
  48. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
  49. package/lib/typescript/src/components/native/Animated.d.ts +39 -0
  50. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -0
  51. package/lib/typescript/src/components/native/FlatList.d.ts +1 -3
  52. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
  53. package/lib/typescript/src/components/native/Image.d.ts +1 -3
  54. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  55. package/lib/typescript/src/components/native/ImageBackground.d.ts +1 -8
  56. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  57. package/lib/typescript/src/components/native/ImageBackground.native.d.ts +1 -2
  58. package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
  59. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +1 -3
  60. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
  61. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  62. package/lib/typescript/src/components/native/RefreshControl.d.ts +1 -3
  63. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
  64. package/lib/typescript/src/components/native/ScrollView.d.ts +1 -3
  65. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
  66. package/lib/typescript/src/components/native/SectionList.d.ts +1 -3
  67. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
  68. package/lib/typescript/src/components/native/Switch.d.ts +1 -3
  69. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
  70. package/lib/typescript/src/components/native/Text.d.ts +1 -3
  71. package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
  72. package/lib/typescript/src/components/native/TextInput.d.ts +1 -3
  73. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
  74. package/lib/typescript/src/components/native/TouchableHighlight.d.ts +1 -3
  75. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
  76. package/lib/typescript/src/components/native/TouchableOpacity.d.ts +1 -3
  77. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
  78. package/lib/typescript/src/components/native/View.d.ts +1 -3
  79. package/lib/typescript/src/components/native/View.d.ts.map +1 -1
  80. package/lib/typescript/src/components/native/VirtualizedList.d.ts +1 -3
  81. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
  82. package/lib/typescript/src/core/createUnistylesElement.d.ts +1 -7
  83. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  84. package/lib/typescript/src/core/createUnistylesElement.native.d.ts +1 -2
  85. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  86. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +2 -3
  87. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  88. package/lib/typescript/src/core/getClassname.d.ts +2 -2
  89. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  90. package/lib/typescript/src/utils.d.ts +1 -0
  91. package/lib/typescript/src/utils.d.ts.map +1 -1
  92. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  93. package/package.json +3 -1
  94. package/plugin/consts.js +43 -0
  95. package/plugin/exotic.js +42 -0
  96. package/plugin/index.d.ts +11 -9
  97. package/plugin/index.js +14 -32
  98. package/plugin/variants.js +1 -1
  99. package/src/components/native/Animated.tsx +17 -0
  100. package/src/components/native/ImageBackground.tsx +4 -1
  101. package/src/components/native/Pressable.native.tsx +22 -4
  102. package/src/core/createUnistylesElement.native.tsx +29 -24
  103. package/src/core/createUnistylesElement.tsx +34 -29
  104. package/src/core/createUnistylesImageBackground.tsx +39 -34
  105. package/src/core/getClassname.ts +5 -4
  106. package/src/utils.ts +17 -0
  107. package/src/web/utils/unistyle.ts +7 -1
@@ -1,3 +1,2 @@
1
- import { ImageBackground as NativeImageBackground } from 'react-native';
2
- export declare const ImageBackground: import("react").ForwardRefExoticComponent<import("react-native").ImageBackgroundProps & import("react").RefAttributes<NativeImageBackground>>;
1
+ export declare const ImageBackground: any;
3
2
  //# sourceMappingURL=ImageBackground.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageBackground.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ImageBackground.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAGvE,eAAO,MAAM,eAAe,+IAAwD,CAAA"}
1
+ {"version":3,"file":"ImageBackground.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ImageBackground.native.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,KAAwD,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const KeyboardAvoidingView: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const KeyboardAvoidingView: any;
4
2
  //# sourceMappingURL=KeyboardAvoidingView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardAvoidingView.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;;2CAAqD,CAAA"}
1
+ {"version":3,"file":"KeyboardAvoidingView.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,KAAqD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pressable.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAQjE,eAAO,MAAM,SAAS;eAHP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BAgD7C,CAAA"}
1
+ {"version":3,"file":"Pressable.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Pressable.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAwBjE,eAAO,MAAM,SAAS;eAnBP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BAkE7C,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const RefreshControl: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const RefreshControl: any;
4
2
  //# sourceMappingURL=RefreshControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshControl.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/RefreshControl.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc;;2CAA+C,CAAA"}
1
+ {"version":3,"file":"RefreshControl.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/RefreshControl.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,KAA+C,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const ScrollView: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const ScrollView: any;
4
2
  //# sourceMappingURL=ScrollView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ScrollView.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU;;2CAA2C,CAAA"}
1
+ {"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/ScrollView.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,KAA2C,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const SectionList: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const SectionList: any;
4
2
  //# sourceMappingURL=SectionList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionList.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/SectionList.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;;2CAA4C,CAAA"}
1
+ {"version":3,"file":"SectionList.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/SectionList.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,KAA4C,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const Switch: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const Switch: any;
4
2
  //# sourceMappingURL=Switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Switch.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;2CAAuC,CAAA"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Switch.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,KAAuC,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const Text: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const Text: any;
4
2
  //# sourceMappingURL=Text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Text.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;;2CAAqC,CAAA"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/Text.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,KAAqC,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const TextInput: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const TextInput: any;
4
2
  //# sourceMappingURL=TextInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TextInput.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;2CAA0C,CAAA"}
1
+ {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TextInput.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,KAA0C,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const TouchableHighlight: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const TouchableHighlight: any;
4
2
  //# sourceMappingURL=TouchableHighlight.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TouchableHighlight.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TouchableHighlight.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;2CAAmD,CAAA"}
1
+ {"version":3,"file":"TouchableHighlight.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TouchableHighlight.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,KAAmD,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const TouchableOpacity: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const TouchableOpacity: any;
4
2
  //# sourceMappingURL=TouchableOpacity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TouchableOpacity.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TouchableOpacity.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;2CAAiD,CAAA"}
1
+ {"version":3,"file":"TouchableOpacity.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/TouchableOpacity.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,KAAiD,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const View: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const View: any;
4
2
  //# sourceMappingURL=View.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/View.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;;2CAAqC,CAAA"}
1
+ {"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/View.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,KAAqC,CAAA"}
@@ -1,4 +1,2 @@
1
- export declare const VirtualizedList: import("react").ForwardRefExoticComponent<{
2
- style?: import("../../types").UnistylesValues | Array<import("../../types").UnistylesValues>;
3
- } & import("react").RefAttributes<unknown>>;
1
+ export declare const VirtualizedList: any;
4
2
  //# sourceMappingURL=VirtualizedList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedList.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/VirtualizedList.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;2CAAgD,CAAA"}
1
+ {"version":3,"file":"VirtualizedList.d.ts","sourceRoot":"","sources":["../../../../../src/components/native/VirtualizedList.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,KAAgD,CAAA"}
@@ -1,8 +1,2 @@
1
- import React from 'react';
2
- import type { UnistylesValues } from '../types';
3
- type ComponentProps = {
4
- style?: UnistylesValues | Array<UnistylesValues>;
5
- };
6
- export declare const createUnistylesElement: (Component: any) => React.ForwardRefExoticComponent<ComponentProps & React.RefAttributes<unknown>>;
7
- export {};
1
+ export declare const createUnistylesElement: (Component: any) => any;
8
2
  //# sourceMappingURL=createUnistylesElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistylesElement.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAM/C,KAAK,cAAc,GAAG;IAClB,KAAK,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,sBAAsB,cAAe,GAAG,mFA+BnD,CAAA"}
1
+ {"version":3,"file":"createUnistylesElement.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesElement.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,sBAAsB,cAAe,GAAG,QAmCpD,CAAA"}
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- export declare const createUnistylesElement: (Component: any) => React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
1
+ export declare const createUnistylesElement: (Component: any) => any;
3
2
  //# sourceMappingURL=createUnistylesElement.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistylesElement.native.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesElement.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAkBhD,eAAO,MAAM,sBAAsB,cAAe,GAAG,kEA2BnD,CAAA"}
1
+ {"version":3,"file":"createUnistylesElement.native.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesElement.native.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sBAAsB,cAAe,GAAG,QA+BpD,CAAA"}
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
- import type { ImageBackground, ImageBackgroundProps } from 'react-native';
3
- export declare const createUnistylesImageBackground: (Component: typeof ImageBackground) => React.ForwardRefExoticComponent<ImageBackgroundProps & React.RefAttributes<ImageBackground>>;
1
+ import type { ImageBackground } from 'react-native';
2
+ export declare const createUnistylesImageBackground: (Component: typeof ImageBackground) => any;
4
3
  //# sourceMappingURL=createUnistylesImageBackground.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistylesImageBackground.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesImageBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAS,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAKhF,eAAO,MAAM,8BAA8B,cAAe,OAAO,eAAe,iGAsC9E,CAAA"}
1
+ {"version":3,"file":"createUnistylesImageBackground.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesImageBackground.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,eAAe,EAAwB,MAAM,cAAc,CAAA;AAMhF,eAAO,MAAM,8BAA8B,cAAe,OAAO,eAAe,QA0C/E,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import type { UnistylesValues } from '../types';
2
2
  export declare const getClassName: (unistyle: UnistylesValues | undefined | Array<UnistylesValues>) => {
3
3
  $$css: boolean;
4
- hash: any;
5
- injectedClassName: any;
4
+ hash: string;
5
+ injectedClassName: string;
6
6
  } | undefined;
7
7
  //# sourceMappingURL=getClassname.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getClassname.d.ts","sourceRoot":"","sources":["../../../../src/core/getClassname.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,eAAO,MAAM,YAAY,aAAc,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC;;;;aAS1F,CAAA"}
1
+ {"version":3,"file":"getClassname.d.ts","sourceRoot":"","sources":["../../../../src/core/getClassname.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,YAAY,aAAc,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC;;;;aAU1F,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export declare const isDefined: <T>(value: T) => value is NonNullable<T>;
2
2
  export declare const deepMergeObjects: <T extends Record<PropertyKey, any>>(...sources: Array<T>) => T;
3
+ export declare const copyComponentProperties: (Component: any, UnistylesComponent: any) => any;
3
4
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAA0C,CAAA;AAExG,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,MAuBxF,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAA0C,CAAA;AAExG,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,MAuBxF,CAAA;AAED,eAAO,MAAM,uBAAuB,cAAe,GAAG,sBAAsB,GAAG,QAe9E,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAMpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;CAC/D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAanE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG;;aAYzC,CAAA;AAED,eAAO,MAAM,kBAAkB,WAAY,eAAe,OAUzD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA;AAErF,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,KAAK,CAAC,MAAM,CAAC,WA6BzE,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA"}
1
+ {"version":3,"file":"unistyle.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/unistyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAMpG,eAAO,MAAM,aAAa,WAAY,WAAW,qBAQhD,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;CAC/D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAanE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG;;aAkBzC,CAAA;AAED,eAAO,MAAM,kBAAkB,WAAY,eAAe,OAUzD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA;AAErF,eAAO,MAAM,aAAa,UAAW,MAAM,kBAAkB,KAAK,CAAC,MAAM,CAAC,WA6BzE,CAAA;AAED,eAAO,MAAM,2BAA2B,UAAW,GAAG,yBAQrD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-nightly-20250122",
3
+ "version": "3.0.0-nightly-20250129",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -82,6 +82,8 @@
82
82
  },
83
83
  "devDependencies": {
84
84
  "@babel/plugin-syntax-jsx": "7.25.9",
85
+ "@babel/preset-flow": "7.25.9",
86
+ "@babel/preset-typescript": "7.26.0",
85
87
  "@biomejs/biome": "1.9.4",
86
88
  "@commitlint/config-conventional": "19.6.0",
87
89
  "@react-native/normalize-colors": "0.77.0",
@@ -0,0 +1,43 @@
1
+ const REACT_NATIVE_COMPONENT_NAMES = [
2
+ 'ActivityIndicator',
3
+ 'View',
4
+ 'Text',
5
+ 'Image',
6
+ 'ImageBackground',
7
+ 'KeyboardAvoidingView',
8
+ 'Pressable',
9
+ 'ScrollView',
10
+ 'FlatList',
11
+ 'SectionList',
12
+ 'Switch',
13
+ 'TextInput',
14
+ 'RefreshControl',
15
+ 'TouchableHighlight',
16
+ 'TouchableOpacity',
17
+ 'VirtualizedList',
18
+ 'Animated'
19
+ // Modal - there is no exposed native handle
20
+ // TouchableWithoutFeedback - can't accept a ref
21
+ ]
22
+
23
+ // auto replace RN imports to Unistyles imports under these paths
24
+ // our implementation simply borrows 'ref' to register it in ShadowRegistry
25
+ // so we won't affect anyone's implementation
26
+ const REPLACE_WITH_UNISTYLES_PATHS = [
27
+ 'react-native-reanimated/src/component',
28
+ 'react-native-gesture-handler/src/components'
29
+ ]
30
+
31
+ // this is more powerful API as it allows to convert unmatched imports to Unistyles
32
+ // { path: string, imports: Array<{ name: string, isDefault: boolean, path: string, mapTo: string }> }
33
+ // name <- target import name
34
+ // isDefault <- is the import default?
35
+ // path <- path to the target import
36
+ // mapTo <- name of the Unistyles component
37
+ const REPLACE_WITH_UNISTYLES_EXOTIC_PATHS = []
38
+
39
+ module.exports = {
40
+ REACT_NATIVE_COMPONENT_NAMES,
41
+ REPLACE_WITH_UNISTYLES_PATHS,
42
+ REPLACE_WITH_UNISTYLES_EXOTIC_PATHS
43
+ }
@@ -0,0 +1,42 @@
1
+ function handleExoticImport(t, path, state, exoticImport) {
2
+ const specifiers = path.node.specifiers
3
+ const source = path.node.source
4
+
5
+ if (path.node.importKind !== 'value') {
6
+ return
7
+ }
8
+
9
+ specifiers.forEach(specifier => {
10
+ for (const rule of exoticImport.imports) {
11
+ const hasMatchingImportType = !rule.isDefault || t.isImportDefaultSpecifier(specifier)
12
+ const hasMatchingImportName = rule.name === specifier.local.name
13
+ const hasMatchingPath = rule.path === source.value
14
+
15
+ if (!hasMatchingImportType || !hasMatchingImportName || !hasMatchingPath) {
16
+ continue
17
+ }
18
+
19
+ const newImport = t.importDeclaration(
20
+ [t.importSpecifier(t.identifier(rule.mapTo), t.identifier(rule.mapTo))],
21
+ t.stringLiteral(state.opts.isLocal
22
+ ? state.file.opts.filename.split('react-native-unistyles').at(0).concat(`react-native-unistyles/components/native/${rule.mapTo}`)
23
+ : `react-native-unistyles/components/native/${rule.mapTo}`
24
+ )
25
+ )
26
+
27
+ // remove old import
28
+ if (t.isImportDefaultSpecifier(specifier)) {
29
+ path.replaceWith(newImport)
30
+ } else {
31
+ path.node.specifiers = specifiers.filter(s => s !== specifier)
32
+ path.unshift(newImport)
33
+ }
34
+
35
+ return
36
+ }
37
+ })
38
+ }
39
+
40
+ module.exports = {
41
+ handleExoticImport
42
+ }
package/plugin/index.d.ts CHANGED
@@ -1,18 +1,20 @@
1
1
  export interface UnistylesPluginOptions {
2
+ /**
3
+ * Example: "src" or "apps/mobile"
4
+ * Add this option if some of your components don't have `react-native-unistyles` import.
5
+ * Babel plugin will automatically process all files under this root.
6
+ */
7
+ autoProcessRoot?: string
8
+
2
9
  /**
3
- * By default babel plugin will look for any `react-native-unistyles` import to start processing your file.
4
- * However, in some cases you might want to process files that miss such import:
5
- * - ui-kits that aggregates Unistyles components
6
- * - monorepos that use Unistyles under absolute path like `@codemask/styles`
7
- *
8
- * If that's your case, you can configure the Babel plugin to process them.
10
+ * Example: ['@codemask/styles']
11
+ * Enable this option if you want to process only files containing specific imports.
9
12
  */
10
13
  autoProcessImports?: string[]
11
14
 
12
15
  /**
13
- * By default babel plugin will ignore `node_modules`.
14
- * However similar to `autoProcessImports`, you can configure it to process extra paths.
15
- *
16
+ * Example: ['external-library/components']
17
+ * Enable this option to process some 3rd party components under `node_modules`.
16
18
  * Under these paths we will replace `react-native` imports with `react-native-unistyles` factories that will borrow components refs [read more](https://www.unistyl.es/v3/other/babel-plugin#3-component-factory-borrowing-ref).
17
19
  *
18
20
  * Defaults to:
package/plugin/index.js CHANGED
@@ -2,35 +2,8 @@ const { addUnistylesImport, isInsideNodeModules } = require('./import')
2
2
  const { hasStringRef } = require('./ref')
3
3
  const { isUnistylesStyleSheet, analyzeDependencies, addStyleSheetTag, getUnistyles, isKindOfStyleSheet } = require('./stylesheet')
4
4
  const { extractVariants } = require('./variants')
5
-
6
- const reactNativeComponentNames = [
7
- 'ActivityIndicator',
8
- 'View',
9
- 'Text',
10
- 'Image',
11
- 'ImageBackground',
12
- 'KeyboardAvoidingView',
13
- 'Pressable',
14
- 'ScrollView',
15
- 'FlatList',
16
- 'SectionList',
17
- 'Switch',
18
- 'TextInput',
19
- 'RefreshControl',
20
- 'TouchableHighlight',
21
- 'TouchableOpacity',
22
- 'VirtualizedList',
23
- // Modal - there is no exposed native handle
24
- // TouchableWithoutFeedback - can't accept a ref
25
- ]
26
-
27
- // auto replace RN imports to Unistyles imports under these paths
28
- // our implementation simply borrows 'ref' to register it in ShadowRegistry
29
- // so we won't affect anyone's implementation
30
- const REPLACE_WITH_UNISTYLES_PATHS = [
31
- 'react-native-reanimated/src/component',
32
- 'react-native-gesture-handler/src/components'
33
- ]
5
+ const { REACT_NATIVE_COMPONENT_NAMES, REPLACE_WITH_UNISTYLES_PATHS, REPLACE_WITH_UNISTYLES_EXOTIC_PATHS } = require('./consts')
6
+ const { handleExoticImport } = require('./exotic')
34
7
 
35
8
  module.exports = function ({ types: t }) {
36
9
  return {
@@ -48,14 +21,16 @@ module.exports = function ({ types: t }) {
48
21
  state.file.styleSheetLocalName = ''
49
22
  state.file.tagNumber = 0
50
23
  state.reactNativeImports = {}
51
- state.file.forceProcessing = false
24
+ state.file.forceProcessing = state.opts.autoProcessRoot
25
+ ? state.filename.includes(`${state.file.opts.root}/${state.opts.autoProcessRoot}/`)
26
+ : false
52
27
  },
53
28
  exit(path, state) {
54
29
  if (isInsideNodeModules(state) && !state.file.replaceWithUnistyles) {
55
30
  return
56
31
  }
57
32
 
58
- if (state.file.hasAnyUnistyle || state.file.hasVariants || state.file.replaceWithUnistyles) {
33
+ if (state.file.hasAnyUnistyle || state.file.hasVariants || state.file.replaceWithUnistyles || state.file.forceProcessing) {
59
34
  addUnistylesImport(t, path, state)
60
35
  }
61
36
  }
@@ -105,6 +80,13 @@ module.exports = function ({ types: t }) {
105
80
  },
106
81
  /** @param {import('./index').UnistylesPluginPass} state */
107
82
  ImportDeclaration(path, state) {
83
+ const exoticImport = REPLACE_WITH_UNISTYLES_EXOTIC_PATHS
84
+ .find(exotic => state.filename.includes(exotic.path))
85
+
86
+ if (exoticImport) {
87
+ return handleExoticImport(t, path, state, exoticImport)
88
+ }
89
+
108
90
  if (isInsideNodeModules(state) && !state.file.replaceWithUnistyles) {
109
91
  return
110
92
  }
@@ -121,7 +103,7 @@ module.exports = function ({ types: t }) {
121
103
 
122
104
  if (importSource === 'react-native') {
123
105
  path.node.specifiers.forEach(specifier => {
124
- if (specifier.imported && reactNativeComponentNames.includes(specifier.imported.name)) {
106
+ if (specifier.imported && REACT_NATIVE_COMPONENT_NAMES.includes(specifier.imported.name)) {
125
107
  state.reactNativeImports[specifier.local.name] = specifier.imported.name
126
108
  }
127
109
  })
@@ -15,7 +15,7 @@ function extractVariants(t, path, state) {
15
15
  return (
16
16
  t.isIdentifier(variant.expression.callee.object, { name: calleeName }) &&
17
17
  t.isIdentifier(variant.expression.callee.property, { name: 'useVariants' }) &&
18
- t.isObjectExpression(variant.expression.arguments[0])
18
+ variant.expression.arguments.length === 1
19
19
  )
20
20
  })
21
21
 
@@ -0,0 +1,17 @@
1
+ import { Animated as RNAnimated } from 'react-native'
2
+ import { View } from './View'
3
+ import { Text } from './Text'
4
+ import { FlatList } from './FlatList'
5
+ import { Image } from './Image'
6
+ import { ScrollView } from './ScrollView'
7
+ import { SectionList } from './SectionList'
8
+
9
+ export const Animated = {
10
+ ...RNAnimated,
11
+ View: RNAnimated.createAnimatedComponent(View),
12
+ Text: RNAnimated.createAnimatedComponent(Text),
13
+ FlatList: RNAnimated.createAnimatedComponent(FlatList),
14
+ Image: RNAnimated.createAnimatedComponent(Image),
15
+ ScrollView: RNAnimated.createAnimatedComponent(ScrollView),
16
+ SectionList: RNAnimated.createAnimatedComponent(SectionList)
17
+ }
@@ -5,13 +5,14 @@ import type { UnistylesValues } from '../../types'
5
5
  import { getClassName } from '../../core'
6
6
  import { isServer } from '../../web/utils'
7
7
  import { UnistylesShadowRegistry } from '../../web'
8
+ import { copyComponentProperties } from '../../utils'
8
9
 
9
10
  type Props = {
10
11
  style?: UnistylesValues
11
12
  imageStyle?: UnistylesValues
12
13
  }
13
14
 
14
- export const ImageBackground = forwardRef<unknown, Props>((props, forwardedRef) => {
15
+ const UnistylesImageBackground = forwardRef<unknown, Props>((props, forwardedRef) => {
15
16
  let storedRef: NativeImageBackground | null = null
16
17
  let storedImageRef: NativeImageBackground | null = null
17
18
  const styleClassNames = getClassName(props.style)
@@ -54,3 +55,5 @@ export const ImageBackground = forwardRef<unknown, Props>((props, forwardedRef)
54
55
  />
55
56
  )
56
57
  })
58
+
59
+ export const ImageBackground = copyComponentProperties(NativeImageBackground, UnistylesImageBackground)
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, useEffect, useRef } from 'react'
1
+ import React, { forwardRef, useLayoutEffect, useRef } from 'react'
2
2
  import { Pressable as NativePressableReactNative } from 'react-native'
3
3
  import type { PressableProps as Props, View } from 'react-native'
4
4
  import { UnistylesShadowRegistry } from '../../specs'
@@ -8,10 +8,26 @@ type PressableProps = Props & {
8
8
  variants?: Record<string, string | boolean>
9
9
  }
10
10
 
11
+ const getStyles = (styleProps: Record<string, any> = {}) => {
12
+ const unistyleKey = Object
13
+ .keys(styleProps)
14
+ .find(key => key.startsWith('unistyles-'))
15
+
16
+ if (!unistyleKey) {
17
+ return styleProps
18
+ }
19
+
20
+ return {
21
+ // styles without C++ state
22
+ ...styleProps[unistyleKey].uni__getStyles(),
23
+ [unistyleKey]: styleProps[unistyleKey].uni__getStyles()
24
+ }
25
+ }
26
+
11
27
  export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ...props }, forwardedRef) => {
12
28
  const storedRef = useRef<View | null>()
13
29
 
14
- useEffect(() => {
30
+ useLayoutEffect(() => {
15
31
  return () => {
16
32
  if (storedRef.current) {
17
33
  // @ts-expect-error - this is hidden from TS
@@ -28,7 +44,7 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
28
44
  ? style({ pressed: false })
29
45
  : style
30
46
 
31
- // @ts-expect-error web types are not compatible with RN styles
47
+ // @ts-expect-error - this is hidden from TS
32
48
  UnistylesShadowRegistry.add(ref, unistyles)
33
49
 
34
50
  if (ref) {
@@ -40,12 +56,14 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
40
56
  style={state => {
41
57
  const unistyles = typeof style === 'function'
42
58
  ? style(state)
43
- : style
59
+ : getStyles(style as unknown as Record<string, any>)
44
60
 
45
61
  if (!storedRef.current) {
46
62
  return unistyles
47
63
  }
48
64
 
65
+ // @ts-expect-error - this is hidden from TS
66
+ UnistylesShadowRegistry.remove(storedRef.current)
49
67
  // @ts-expect-error - this is hidden from TS
50
68
  UnistylesShadowRegistry.add(storedRef.current, unistyles)
51
69