react-native-unistyles 3.0.0-beta.7 → 3.0.0-experimental-2025051401
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/README.md +41 -19
- package/Unistyles.podspec +1 -0
- package/android/CMakeLists.txt +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
- package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -1
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +11 -4
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +1 -1
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
- package/components/native/ActivityIndicator/package.json +1 -0
- package/components/native/Animated/package.json +1 -0
- package/components/native/FlatList/package.json +1 -0
- package/components/native/Image/package.json +2 -1
- package/components/native/ImageBackground/package.json +1 -0
- package/components/native/KeyboardAvoidingView/package.json +1 -0
- package/components/native/NativeText/package.json +1 -0
- package/components/native/NativeView/package.json +1 -0
- package/components/native/Pressable/package.json +1 -0
- package/components/native/RefreshControl/package.json +1 -0
- package/components/native/ScrollView/package.json +1 -0
- package/components/native/SectionList/package.json +1 -0
- package/components/native/Switch/package.json +1 -0
- package/components/native/Text/package.json +1 -0
- package/components/native/TextInput/package.json +1 -0
- package/components/native/TouchableHighlight/package.json +1 -0
- package/components/native/TouchableOpacity/package.json +1 -0
- package/components/native/View/package.json +1 -0
- package/components/native/VirtualizedList/package.json +1 -0
- package/cxx/common/Helpers.h +89 -0
- package/cxx/core/HostUnistyle.cpp +14 -5
- package/cxx/core/StyleSheet.h +1 -1
- package/cxx/core/UnistyleWrapper.h +1 -1
- package/cxx/core/UnistylesCommitShadowNode.h +0 -21
- package/cxx/core/UnistylesRegistry.cpp +74 -69
- package/cxx/core/UnistylesRegistry.h +1 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -5
- package/cxx/hybridObjects/HybridStyleSheet.cpp +10 -19
- package/cxx/hybridObjects/HybridStyleSheet.h +3 -8
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +5 -1
- package/cxx/parser/Parser.cpp +200 -89
- package/cxx/parser/Parser.h +1 -1
- package/cxx/shadowTree/ShadowTrafficController.h +13 -9
- package/cxx/shadowTree/ShadowTreeManager.cpp +64 -59
- package/cxx/shadowTree/ShadowTreeManager.h +0 -1
- package/ios/NativePlatform+ios.swift +1 -1
- package/ios/NativePlatformListener+ios.swift +12 -7
- package/ios/UnistylesModuleOnLoad.h +1 -5
- package/ios/UnistylesModuleOnLoad.mm +5 -13
- package/lib/commonjs/components/native/Image.js +27 -1
- package/lib/commonjs/components/native/Image.js.map +1 -1
- package/lib/commonjs/components/native/Image.native.js +10 -0
- package/lib/commonjs/components/native/Image.native.js.map +1 -0
- package/lib/commonjs/components/native/ImageBackground.js +21 -36
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +16 -2
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +17 -21
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +7 -1
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +10 -4
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +11 -5
- package/lib/commonjs/core/getClassname.js.map +1 -1
- package/lib/commonjs/core/passForwardRef.js +3 -5
- package/lib/commonjs/core/passForwardRef.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js +5 -3
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +15 -2
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +14 -5
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +14 -7
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.js +4 -4
- package/lib/commonjs/hooks/useMedia.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.native.js +4 -4
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
- package/lib/commonjs/mocks.js +203 -0
- package/lib/commonjs/mocks.js.map +1 -0
- package/lib/commonjs/mq.js +1 -23
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/reanimated/index.js +13 -0
- package/lib/commonjs/reanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated/useAnimatedTheme.js +22 -0
- package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -0
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js +24 -0
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -0
- package/lib/commonjs/server/getServerUnistyles.js +9 -4
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js +4 -2
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +4 -2
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/serialize.js +24 -0
- package/lib/commonjs/server/serialize.js.map +1 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/utils.js +23 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +4 -7
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js +7 -8
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/create.js +10 -2
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js +2 -2
- package/lib/commonjs/web/css/core.js.map +1 -1
- package/lib/commonjs/web/css/state.js +6 -3
- package/lib/commonjs/web/css/state.js.map +1 -1
- package/lib/commonjs/web/index.js +7 -12
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/registry.js +11 -9
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +5 -1
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/services.js +7 -2
- package/lib/commonjs/web/services.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +27 -10
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +11 -2
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/types.js +2 -0
- package/lib/commonjs/web/types.js.map +1 -1
- package/lib/commonjs/web/utils/createUnistylesRef.js +31 -0
- package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -0
- package/lib/commonjs/web/utils/unistyle.js +40 -14
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web-only/getWebProps.js +19 -0
- package/lib/commonjs/web-only/getWebProps.js.map +1 -0
- package/lib/commonjs/web-only/index.js +13 -0
- package/lib/commonjs/web-only/index.js.map +1 -0
- package/lib/module/components/native/Image.js +26 -2
- package/lib/module/components/native/Image.js.map +1 -1
- package/lib/module/components/native/Image.native.js +6 -0
- package/lib/module/components/native/Image.native.js.map +1 -0
- package/lib/module/components/native/ImageBackground.js +22 -37
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +16 -2
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +17 -21
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +7 -1
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +10 -4
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/getClassname.js +9 -5
- package/lib/module/core/getClassname.js.map +1 -1
- package/lib/module/core/passForwardRef.js +3 -5
- package/lib/module/core/passForwardRef.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/listener.js +3 -3
- package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +15 -2
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +14 -5
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +14 -7
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/hooks/useMedia.js +1 -1
- package/lib/module/hooks/useMedia.js.map +1 -1
- package/lib/module/hooks/useMedia.native.js +1 -1
- package/lib/module/hooks/useMedia.native.js.map +1 -1
- package/lib/module/mocks.js +201 -0
- package/lib/module/mocks.js.map +1 -0
- package/lib/module/mq.js +0 -19
- package/lib/module/mq.js.map +1 -1
- package/lib/module/reanimated/index.js +4 -0
- package/lib/module/reanimated/index.js.map +1 -0
- package/lib/module/reanimated/useAnimatedTheme.js +17 -0
- package/lib/module/reanimated/useAnimatedTheme.js.map +1 -0
- package/lib/module/reanimated/useAnimatedTheme.native.js +19 -0
- package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -0
- package/lib/module/server/getServerUnistyles.js +7 -4
- package/lib/module/server/getServerUnistyles.js.map +1 -1
- package/lib/module/server/hydrateServerUnistyles.js +2 -2
- package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/module/server/resetServerUnistyles.js +2 -2
- package/lib/module/server/resetServerUnistyles.js.map +1 -1
- package/lib/module/server/serialize.js +19 -0
- package/lib/module/server/serialize.js.map +1 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +2 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/utils.js +19 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/index.js +4 -7
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/filter.js +3 -4
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/create.js +9 -3
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/css/core.js +2 -2
- package/lib/module/web/css/core.js.map +1 -1
- package/lib/module/web/css/state.js +6 -3
- package/lib/module/web/css/state.js.map +1 -1
- package/lib/module/web/index.js +4 -10
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/registry.js +11 -9
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +5 -1
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/services.js +7 -1
- package/lib/module/web/services.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +27 -10
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +11 -2
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/types.js +1 -1
- package/lib/module/web/types.js.map +1 -1
- package/lib/module/web/utils/createUnistylesRef.js +24 -0
- package/lib/module/web/utils/createUnistylesRef.js.map +1 -0
- package/lib/module/web/utils/unistyle.js +32 -10
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web-only/getWebProps.js +14 -0
- package/lib/module/web-only/getWebProps.js.map +1 -0
- package/lib/module/web-only/index.js +4 -0
- package/lib/module/web-only/index.js.map +1 -0
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.native.d.ts +2 -0
- package/lib/typescript/src/components/native/Image.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/getClassname.d.ts +5 -5
- package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/warn.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +1 -3
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
- package/lib/typescript/src/mocks.d.ts +2 -0
- package/lib/typescript/src/mocks.d.ts.map +1 -0
- package/lib/typescript/src/mq.d.ts +0 -8
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/index.d.ts +2 -0
- package/lib/typescript/src/reanimated/index.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts +4 -0
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -0
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts +4 -0
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -0
- package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts +0 -1
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/serialize.d.ts +2 -0
- package/lib/typescript/src/server/serialize.d.ts.map +1 -0
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +2 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +0 -1
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +8 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts +2 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts +2 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/css/core.d.ts.map +1 -1
- package/lib/typescript/src/web/css/state.d.ts +4 -1
- package/lib/typescript/src/web/css/state.d.ts.map +1 -1
- package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +0 -5
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +2 -2
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/services.d.ts +6 -1
- package/lib/typescript/src/web/services.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +2 -2
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +2 -0
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/types.d.ts +3 -0
- package/lib/typescript/src/web/types.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/createUnistylesRef.d.ts +11 -0
- package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts +5 -2
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/lib/typescript/src/web/variants.d.ts.map +1 -1
- package/lib/typescript/src/web-only/getWebProps.d.ts +7 -0
- package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -0
- package/lib/typescript/src/web-only/index.d.ts +2 -0
- package/lib/typescript/src/web-only/index.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +19 -19
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +22 -22
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +2 -1
- package/nitrogen/generated/android/unistyles+autolinking.cmake +16 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -1
- package/nitrogen/generated/ios/swift/UnistyleDependency.swift +4 -0
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -0
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -0
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -0
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -0
- package/package.json +77 -33
- package/plugin/index.d.ts +51 -18
- package/plugin/index.js +878 -177
- package/reanimated/package.json +6 -0
- package/server/package.json +6 -0
- package/src/components/native/Image.native.tsx +4 -0
- package/src/components/native/Image.tsx +36 -3
- package/src/components/native/ImageBackground.tsx +20 -36
- package/src/components/native/Pressable.native.tsx +25 -2
- package/src/core/createUnistylesElement.native.tsx +13 -2
- package/src/core/createUnistylesElement.tsx +26 -27
- package/src/core/createUnistylesImageBackground.tsx +16 -5
- package/src/core/getClassname.ts +16 -5
- package/src/core/passForwardRef.ts +5 -5
- package/src/core/useProxifiedUnistyles/listener.ts +3 -3
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +18 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +42 -17
- package/src/core/withUnistyles/withUnistyles.tsx +23 -6
- package/src/hooks/useMedia.native.ts +1 -1
- package/src/hooks/useMedia.ts +1 -1
- package/src/mocks.ts +217 -0
- package/src/mq.ts +0 -24
- package/src/reanimated/index.ts +1 -0
- package/src/reanimated/useAnimatedTheme.native.ts +21 -0
- package/src/reanimated/useAnimatedTheme.ts +19 -0
- package/src/server/getServerUnistyles.tsx +15 -10
- package/src/server/hydrateServerUnistyles.ts +3 -2
- package/src/server/resetServerUnistyles.ts +4 -3
- package/src/server/serialize.ts +20 -0
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +2 -1
- package/src/specs/ShadowRegistry/index.ts +2 -2
- package/src/types/common.ts +0 -1
- package/src/types/stylesheet.ts +1 -1
- package/src/utils.ts +25 -0
- package/src/web/convert/index.ts +5 -7
- package/src/web/convert/object/filter.ts +4 -4
- package/src/web/create.ts +10 -3
- package/src/web/css/core.ts +2 -2
- package/src/web/css/state.ts +5 -3
- package/src/web/index.ts +4 -16
- package/src/web/registry.ts +20 -11
- package/src/web/runtime.ts +6 -2
- package/src/web/services.ts +14 -1
- package/src/web/shadowRegistry.ts +35 -13
- package/src/web/state.ts +14 -2
- package/src/web/types.ts +9 -4
- package/src/web/utils/createUnistylesRef.ts +33 -0
- package/src/web/utils/unistyle.ts +55 -23
- package/src/web-only/getWebProps.ts +18 -0
- package/src/web-only/index.ts +2 -0
- package/web/package.json +6 -0
- package/cxx/core/UnistylesCommitHook.cpp +0 -49
- package/cxx/core/UnistylesCommitHook.h +0 -27
- package/cxx/core/UnistylesMountHook.cpp +0 -28
- package/cxx/core/UnistylesMountHook.h +0 -27
- package/lib/module/package.json +0 -1
- package/plugin/consts.js +0 -63
- package/plugin/exotic.js +0 -54
- package/plugin/import.js +0 -51
- package/plugin/ref.js +0 -11
- package/plugin/stylesheet.js +0 -565
- package/plugin/variants.js +0 -66
- /package/cxx/common/{Constants.h → UnistylesConstants.h} +0 -0
package/README.md
CHANGED
@@ -15,9 +15,22 @@
|
|
15
15
|
## Installation
|
16
16
|
|
17
17
|
```shell
|
18
|
-
yarn add react-native-unistyles@
|
18
|
+
yarn add react-native-unistyles@next
|
19
19
|
```
|
20
20
|
|
21
|
+
Install dependencies:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
yarn add react-native-edge-to-edge react-native-nitro-modules@0.25.2
|
25
|
+
```
|
26
|
+
|
27
|
+
> To avoid unexpected behavior, always use a fixed version of `react-native-nitro-modules`
|
28
|
+
|
29
|
+
| react-native-unistyles | react-native-nitro-modules |
|
30
|
+
|------------------------|----------------------------|
|
31
|
+
| 3.0.0-nightly-20250513 | 0.25.2 |
|
32
|
+
| 3.0.0-rc.4 | 0.25.2 |
|
33
|
+
|
21
34
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
22
35
|
|
23
36
|
## [Documentation](https://unistyl.es/)
|
@@ -65,44 +78,53 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
65
78
|
<a href="https://github.com/oscklm">
|
66
79
|
<img src="https://avatars.githubusercontent.com/u/22825865?v=4" height="70px" width="70px" alt="oscklm" />
|
67
80
|
</a>
|
68
|
-
<a href="https://github.com/
|
69
|
-
<img src="https://avatars.githubusercontent.com/u/
|
81
|
+
<a href="https://github.com/ryanlanciaux">
|
82
|
+
<img src="https://avatars.githubusercontent.com/u/85041?v=4" height="70px" width="70px" alt="ryanlanciaux" />
|
70
83
|
</a>
|
71
|
-
<a href="https://github.com/
|
72
|
-
<img src="https://avatars.githubusercontent.com/u/
|
73
|
-
</a>
|
74
|
-
<a href="https://github.com/4cc3ssX">
|
75
|
-
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="70px" width="70px" alt="4cc3ssX" />
|
76
|
-
</a>
|
77
|
-
<a href="https://github.com/dacoto97">
|
78
|
-
<img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="70px" width="70px" alt="dacoto97" />
|
84
|
+
<a href="https://github.com/loopsware">
|
85
|
+
<img src="https://avatars.githubusercontent.com/u/161434039?s=200&v=4" height="70px" width="70px" alt="loopsware" />
|
79
86
|
</a>
|
80
87
|
|
81
88
|
## Past sponsors
|
82
89
|
|
83
90
|
<a href="https://github.com/kmartinezmedia">
|
84
|
-
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="
|
91
|
+
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="60px" width="60px" alt="kmartinezmedia" />
|
85
92
|
</a>
|
86
93
|
<a href="https://github.com/levibuzolic">
|
87
|
-
<img src="https://avatars.githubusercontent.com/u/721323?v=4" height="
|
94
|
+
<img src="https://avatars.githubusercontent.com/u/721323?v=4" height="60px" width="60px" alt="levibuzolic" />
|
88
95
|
</a>
|
89
96
|
<a href="https://github.com/claudesortwell">
|
90
|
-
<img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="
|
97
|
+
<img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="60px" width="60px" alt="claudesortwell" />
|
91
98
|
</a>
|
92
99
|
<a href="https://github.com/luoxuhai">
|
93
|
-
<img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="
|
100
|
+
<img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="60px" width="60px" alt="luoxuhai" />
|
94
101
|
</a>
|
95
102
|
<a href="https://github.com">
|
96
|
-
<img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="
|
103
|
+
<img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="60px" width="60px" alt="anonymous" />
|
97
104
|
</a>
|
98
105
|
<a href="https://github.com/abanobboles">
|
99
|
-
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="
|
106
|
+
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="60px" width="60px" alt="abanobboles" />
|
100
107
|
</a>
|
101
108
|
<a href="https://github.com/hyoban">
|
102
|
-
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="
|
109
|
+
<img src="https://avatars.githubusercontent.com/u/38493346?v=4" height="60px" width="60px" alt="hyoban" />
|
103
110
|
</a>
|
104
111
|
<a href="https://github.com/giovannilondero">
|
105
|
-
<img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="
|
112
|
+
<img src="https://avatars.githubusercontent.com/u/10998991?v=4" height="60px" width="60px" alt="giovannilondero" />
|
113
|
+
</a>
|
114
|
+
<a href="https://github.com/4cc3ssX">
|
115
|
+
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="60px" width="60px" alt="4cc3ssX" />
|
116
|
+
</a>
|
117
|
+
<a href="https://github.com/FilipiRafael">
|
118
|
+
<img src="https://avatars.githubusercontent.com/u/61629642?v=4" height="60px" width="60px" alt="FilipiRafael" />
|
119
|
+
</a>
|
120
|
+
<a href="https://github.com/dacoto97">
|
121
|
+
<img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="60px" width="60px" alt="dacoto97" />
|
122
|
+
</a>
|
123
|
+
<a href="https://github.com/chinamcafee">
|
124
|
+
<img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="60px" width="60px" alt="chinamcafee" />
|
125
|
+
</a>
|
126
|
+
<a href="https://github.com/guillaumehcht">
|
127
|
+
<img src="https://avatars.githubusercontent.com/u/80776475?v=4" height="60px" width="60px" alt="guillaumehcht" />
|
106
128
|
</a>
|
107
129
|
|
108
130
|
## Sponsor my work
|
package/Unistyles.podspec
CHANGED
@@ -29,6 +29,7 @@ Pod::Spec.new do |s|
|
|
29
29
|
if ENV["USE_FRAMEWORKS"]
|
30
30
|
s.dependency "React-Core"
|
31
31
|
add_dependency(s, "React-jsinspector", :framework_name => "jsinspector_modern")
|
32
|
+
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
|
32
33
|
add_dependency(s, "React-rendererconsistency", :framework_name => "React_rendererconsistency")
|
33
34
|
end
|
34
35
|
|
package/android/CMakeLists.txt
CHANGED
@@ -23,7 +23,8 @@ include_directories(
|
|
23
23
|
../cxx/shadowTree
|
24
24
|
)
|
25
25
|
|
26
|
-
|
26
|
+
# Nitro appends all Folly Flags, leaving it empty
|
27
|
+
string(APPEND CMAKE_CXX_FLAGS " ")
|
27
28
|
|
28
29
|
set_target_properties(unistyles PROPERTIES
|
29
30
|
CXX_STANDARD 20
|
@@ -10,19 +10,16 @@ using namespace facebook::react;
|
|
10
10
|
UnistylesModule::UnistylesModule(
|
11
11
|
jni::alias_ref<UnistylesModule::jhybridobject> jThis,
|
12
12
|
jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
|
13
|
-
jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
|
14
13
|
jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
|
15
14
|
): _runtimeExecutor(runtimeExecutorHolder->cthis()->get()),
|
16
|
-
_uiManager(fabricUIManager->getBinding()->getScheduler()->getUIManager()),
|
17
15
|
_nativePlatform(nativePlatform->cthis()) {}
|
18
16
|
|
19
17
|
jni::local_ref<UnistylesModule::jhybriddata> UnistylesModule::initHybrid(
|
20
18
|
jni::alias_ref<UnistylesModule::jhybridobject> jThis,
|
21
19
|
jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
|
22
|
-
jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
|
23
20
|
jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
|
24
21
|
) {
|
25
|
-
return makeCxxInstance(jThis, runtimeExecutorHolder,
|
22
|
+
return makeCxxInstance(jThis, runtimeExecutorHolder, nativePlatform);
|
26
23
|
}
|
27
24
|
|
28
25
|
void UnistylesModule::registerNatives() {
|
@@ -34,10 +31,9 @@ void UnistylesModule::registerNatives() {
|
|
34
31
|
|
35
32
|
jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jobj) {
|
36
33
|
auto& runtimeExecutor = jobj->cthis()->_runtimeExecutor;
|
37
|
-
auto& uiManager = jobj->cthis()->_uiManager;
|
38
34
|
auto& nativePlatform = jobj->cthis()->_nativePlatform;
|
39
35
|
|
40
|
-
return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &
|
36
|
+
return BindingsInstallerHolder::newObjectCxxArgs([&runtimeExecutor, &nativePlatform](jsi::Runtime& rt) {
|
41
37
|
// function is called on: first init and every live reload
|
42
38
|
// check if this is live reload, if so let's replace UnistylesRuntime with new runtime
|
43
39
|
auto hasUnistylesRuntime = HybridObjectRegistry::hasHybridObject("UnistylesRuntime");
|
@@ -56,7 +52,7 @@ jni::local_ref<BindingsInstallerHolder::javaobject> UnistylesModule::getBindings
|
|
56
52
|
|
57
53
|
// init hybrids
|
58
54
|
auto unistylesRuntime = std::make_shared<HybridUnistylesRuntime>(nativePlatform, rt, runOnJSThread);
|
59
|
-
auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime
|
55
|
+
auto styleSheet = std::make_shared<HybridStyleSheet>(unistylesRuntime);
|
60
56
|
|
61
57
|
HybridObjectRegistry::registerHybridObjectConstructor("UnistylesRuntime", [unistylesRuntime]() -> std::shared_ptr<HybridObject>{
|
62
58
|
return unistylesRuntime;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
3
|
#include <ReactCommon/BindingsInstallerHolder.h>
|
4
|
-
#include <react/fabric/JFabricUIManager.h>
|
5
4
|
#include <react/jni/JRuntimeExecutor.h>
|
6
5
|
#include <react/renderer/scheduler/Scheduler.h>
|
7
6
|
#include <fbjni/fbjni.h>
|
@@ -19,7 +18,6 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
|
|
19
18
|
explicit UnistylesModule(
|
20
19
|
jni::alias_ref<jhybridobject> jThis,
|
21
20
|
jni::alias_ref<react::JRuntimeExecutor::javaobject> runtimeExecutorHolder,
|
22
|
-
jni::alias_ref<JFabricUIManager::javaobject> fabricUIManager,
|
23
21
|
jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
|
24
22
|
);
|
25
23
|
|
@@ -27,14 +25,12 @@ struct UnistylesModule : public jni::HybridClass<UnistylesModule> {
|
|
27
25
|
static jni::local_ref<jhybriddata> initHybrid(
|
28
26
|
jni::alias_ref<jhybridobject> jThis,
|
29
27
|
jni::alias_ref<JRuntimeExecutor::javaobject> runtimeExecutorHolder,
|
30
|
-
jni::alias_ref<JFabricUIManager::javaobject>,
|
31
28
|
jni::alias_ref<JHybridNativePlatformSpec::javaobject> nativePlatform
|
32
29
|
);
|
33
30
|
|
34
31
|
static jni::local_ref<BindingsInstallerHolder::javaobject> getBindingsInstaller(jni::alias_ref<UnistylesModule::javaobject> jThis);
|
35
32
|
|
36
33
|
private:
|
37
|
-
std::shared_ptr<UIManager> _uiManager;
|
38
34
|
RuntimeExecutor _runtimeExecutor;
|
39
35
|
std::shared_ptr<HybridNativePlatformSpec> _nativePlatform;
|
40
36
|
};
|
@@ -27,7 +27,7 @@ import java.util.Locale
|
|
27
27
|
@Keep
|
28
28
|
@DoNotStrip
|
29
29
|
class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
|
30
|
-
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.
|
30
|
+
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.onConfigChange() }
|
31
31
|
private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
|
32
32
|
private val _listener = NativePlatformListener(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
|
33
33
|
|
@@ -263,6 +263,10 @@ class NativePlatformAndroid(private val reactContext: ReactApplicationContext):
|
|
263
263
|
return changedDependencies
|
264
264
|
}
|
265
265
|
|
266
|
+
private fun onConfigChange() {
|
267
|
+
this._listener.onConfigChange()
|
268
|
+
}
|
269
|
+
|
266
270
|
override fun registerPlatformListener(callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit) {
|
267
271
|
this._listener.addPlatformListener(callback)
|
268
272
|
}
|
@@ -12,7 +12,6 @@ import androidx.core.view.WindowInsetsCompat
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
13
13
|
import com.facebook.react.bridge.ReactApplicationContext
|
14
14
|
import com.margelo.nitro.unistyles.Insets
|
15
|
-
import com.margelo.nitro.unistyles.UnistyleDependency
|
16
15
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
17
16
|
|
18
17
|
typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
@@ -22,8 +21,9 @@ typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
|
22
21
|
class NativePlatformInsets(
|
23
22
|
private val reactContext: ReactApplicationContext,
|
24
23
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
25
|
-
private val
|
24
|
+
private val onConfigChange: () -> Unit
|
26
25
|
) {
|
26
|
+
private var _shouldListenToImeEvents = false
|
27
27
|
private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
|
28
28
|
private var _insets: Insets = Insets(0.0, 0.0, 0.0, 0.0, 0.0)
|
29
29
|
|
@@ -105,7 +105,7 @@ class NativePlatformInsets(
|
|
105
105
|
return
|
106
106
|
}
|
107
107
|
|
108
|
-
|
108
|
+
this@NativePlatformInsets.onConfigChange()
|
109
109
|
|
110
110
|
if (shouldEmitImeEvent) {
|
111
111
|
this@NativePlatformInsets.emitImeEvent(this.getMiniRuntime())
|
@@ -113,6 +113,8 @@ class NativePlatformInsets(
|
|
113
113
|
}
|
114
114
|
|
115
115
|
fun startInsetsListener() {
|
116
|
+
_shouldListenToImeEvents = true
|
117
|
+
|
116
118
|
reactContext.currentActivity?.let { activity ->
|
117
119
|
activity.findViewById<View>(android.R.id.content)?.let { mainView ->
|
118
120
|
ViewCompat.setOnApplyWindowInsetsListener(mainView) { _, insets ->
|
@@ -130,6 +132,10 @@ class NativePlatformInsets(
|
|
130
132
|
insets: WindowInsetsCompat,
|
131
133
|
runningAnimations: List<WindowInsetsAnimationCompat>
|
132
134
|
): WindowInsetsCompat {
|
135
|
+
if (!_shouldListenToImeEvents) {
|
136
|
+
return insets
|
137
|
+
}
|
138
|
+
|
133
139
|
runningAnimations.firstOrNull()?.let {
|
134
140
|
val bottomInset = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom.toDouble() - this@NativePlatformInsets._insets.bottom
|
135
141
|
val nextBottomInset = if (bottomInset < 0) {
|
@@ -160,9 +166,10 @@ class NativePlatformInsets(
|
|
160
166
|
reactContext.currentActivity?.let { activity ->
|
161
167
|
activity.window?.decorView?.let { view ->
|
162
168
|
ViewCompat.setOnApplyWindowInsetsListener(view, null)
|
163
|
-
ViewCompat.setWindowInsetsAnimationCallback(view, null)
|
164
169
|
}
|
165
170
|
}
|
171
|
+
|
172
|
+
_shouldListenToImeEvents = false
|
166
173
|
}
|
167
174
|
|
168
175
|
fun addImeListener(listener: CxxImeListener) {
|
@@ -5,11 +5,8 @@ import com.facebook.jni.HybridData
|
|
5
5
|
import com.facebook.proguard.annotations.DoNotStrip
|
6
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
7
7
|
import com.facebook.react.bridge.RuntimeExecutor
|
8
|
-
import com.facebook.react.fabric.FabricUIManager
|
9
8
|
import com.facebook.react.turbomodule.core.interfaces.BindingsInstallerHolder
|
10
9
|
import com.facebook.react.turbomodule.core.interfaces.TurboModuleWithJSIBindings
|
11
|
-
import com.facebook.react.uimanager.UIManagerHelper
|
12
|
-
import com.facebook.react.uimanager.common.UIManagerType
|
13
10
|
import com.margelo.nitro.unistyles.HybridNativePlatformSpec
|
14
11
|
import com.margelo.nitro.unistyles.unistylesOnLoad.Companion.initializeNative
|
15
12
|
|
@@ -34,10 +31,8 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
|
|
34
31
|
private fun initializeHybridData(reactContext: ReactApplicationContext): HybridData {
|
35
32
|
val runtimeExecutor = reactContext.catalystInstance?.runtimeExecutor
|
36
33
|
?: throw IllegalStateException("Unistyles: React Native runtime executor is not available. Please follow installation guides.")
|
37
|
-
val fabricUIManager = UIManagerHelper.getUIManager(reactContext, UIManagerType.FABRIC) as? FabricUIManager
|
38
|
-
?: throw IllegalStateException("Unistyles: Fabric UI Manager is not available. Please follow installation guides.")
|
39
34
|
|
40
|
-
return initHybrid(runtimeExecutor,
|
35
|
+
return initHybrid(runtimeExecutor, _nativePlatform)
|
41
36
|
}
|
42
37
|
|
43
38
|
@DoNotStrip
|
@@ -46,7 +41,6 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
|
|
46
41
|
@DoNotStrip
|
47
42
|
private external fun initHybrid(
|
48
43
|
runtimeExecutor: RuntimeExecutor,
|
49
|
-
fabricUIManager: FabricUIManager,
|
50
44
|
nativePlatform: HybridNativePlatformSpec
|
51
45
|
): HybridData
|
52
46
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ActivityIndicator.js",
|
3
3
|
"module": "../../../lib/module/components/native/ActivityIndicator.js",
|
4
|
+
"browser": "../../../lib/module/components/native/ActivityIndicator.js",
|
4
5
|
"react-native": "../../../src/components/native/ActivityIndicator.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/Image.js",
|
3
3
|
"module": "../../../lib/module/components/native/Image.js",
|
4
|
-
"
|
4
|
+
"browser": "../../../lib/module/components/native/Image.js",
|
5
|
+
"react-native": "../../../src/components/native/Image.native.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ImageBackground.js",
|
3
3
|
"module": "../../../lib/module/components/native/ImageBackground.js",
|
4
|
+
"browser": "../../../lib/module/components/native/ImageBackground.js",
|
4
5
|
"react-native": "../../../src/components/native/ImageBackground.native.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js",
|
3
3
|
"module": "../../../lib/module/components/native/KeyboardAvoidingView.js",
|
4
|
+
"browser": "../../../lib/module/components/native/KeyboardAvoidingView.js",
|
4
5
|
"react-native": "../../../src/components/native/KeyboardAvoidingView.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/NativeText.js",
|
3
3
|
"module": "../../../lib/module/components/native/NativeText.js",
|
4
|
+
"browser": "../../../lib/module/components/native/NativeText.js",
|
4
5
|
"react-native": "../../../src/components/native/NativeText.native.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/NativeView.js",
|
3
3
|
"module": "../../../lib/module/components/native/NativeView.js",
|
4
|
+
"browser": "../../../lib/module/components/native/NativeView.js",
|
4
5
|
"react-native": "../../../src/components/native/NativeView.native.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/Pressable.js",
|
3
3
|
"module": "../../../lib/module/components/native/Pressable.js",
|
4
|
+
"browser": "../../../lib/module/components/native/Pressable.js",
|
4
5
|
"react-native": "../../../src/components/native/Pressable.native.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/RefreshControl.js",
|
3
3
|
"module": "../../../lib/module/components/native/RefreshControl.js",
|
4
|
+
"browser": "../../../lib/module/components/native/RefreshControl.js",
|
4
5
|
"react-native": "../../../src/components/native/RefreshControl.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/ScrollView.js",
|
3
3
|
"module": "../../../lib/module/components/native/ScrollView.js",
|
4
|
+
"browser": "../../../lib/module/components/native/ScrollView.js",
|
4
5
|
"react-native": "../../../src/components/native/ScrollView.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/SectionList.js",
|
3
3
|
"module": "../../../lib/module/components/native/SectionList.js",
|
4
|
+
"browser": "../../../lib/module/components/native/SectionList.js",
|
4
5
|
"react-native": "../../../src/components/native/SectionList.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/TouchableHighlight.js",
|
3
3
|
"module": "../../../lib/module/components/native/TouchableHighlight.js",
|
4
|
+
"browser": "../../../lib/module/components/native/TouchableHighlight.js",
|
4
5
|
"react-native": "../../../src/components/native/TouchableHighlight.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/TouchableOpacity.js",
|
3
3
|
"module": "../../../lib/module/components/native/TouchableOpacity.js",
|
4
|
+
"browser": "../../../lib/module/components/native/TouchableOpacity.js",
|
4
5
|
"react-native": "../../../src/components/native/TouchableOpacity.tsx"
|
5
6
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main": "../../../lib/commonjs/components/native/VirtualizedList.js",
|
3
3
|
"module": "../../../lib/module/components/native/VirtualizedList.js",
|
4
|
+
"browser": "../../../lib/module/components/native/VirtualizedList.js",
|
4
5
|
"react-native": "../../../src/components/native/VirtualizedList.tsx"
|
5
6
|
}
|
package/cxx/common/Helpers.h
CHANGED
@@ -122,6 +122,10 @@ inline Variants variantsToPairs(jsi::Runtime& rt, jsi::Object&& variants) {
|
|
122
122
|
if (variantValue.isString()) {
|
123
123
|
pairs.emplace_back(std::make_pair(variantName, variantValue.asString(rt).utf8(rt)));
|
124
124
|
}
|
125
|
+
|
126
|
+
if (variantValue.isNumber()) {
|
127
|
+
pairs.emplace_back(std::make_pair(variantName, std::to_string(static_cast<int>(variantValue.asNumber()))));
|
128
|
+
}
|
125
129
|
});
|
126
130
|
|
127
131
|
return pairs;
|
@@ -225,4 +229,89 @@ inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vec
|
|
225
229
|
return result;
|
226
230
|
}
|
227
231
|
|
232
|
+
inline void debugPrintJSIObject(jsi::Runtime& rt, std::string& name, jsi::Object& obj) {
|
233
|
+
auto console = rt.global().getPropertyAsObject(rt, "console");
|
234
|
+
auto log = console.getPropertyAsFunction(rt, "log");
|
235
|
+
auto parser = [&](const std::string& key, jsi::Value& value){
|
236
|
+
if (value.isBool()) {
|
237
|
+
std::string output = key + ": " + (value.getBool() ? "true" : "false");
|
238
|
+
log.call(rt, output);
|
239
|
+
|
240
|
+
return;
|
241
|
+
}
|
242
|
+
|
243
|
+
if (value.isNumber()) {
|
244
|
+
std::string output = key + ": " + std::to_string(value.getNumber());
|
245
|
+
log.call(rt, output);
|
246
|
+
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
|
250
|
+
if (value.isString()) {
|
251
|
+
std::string output = key + ": " + value.getString(rt).utf8(rt);
|
252
|
+
log.call(rt, output);
|
253
|
+
|
254
|
+
return;
|
255
|
+
}
|
256
|
+
|
257
|
+
if (value.isUndefined()) {
|
258
|
+
std::string output = key + ": undefined";
|
259
|
+
log.call(rt, output);
|
260
|
+
|
261
|
+
return;
|
262
|
+
}
|
263
|
+
|
264
|
+
if (value.isNull()) {
|
265
|
+
std::string output = key + ": null";
|
266
|
+
log.call(rt, output);
|
267
|
+
|
268
|
+
return;
|
269
|
+
}
|
270
|
+
};
|
271
|
+
|
272
|
+
log.call(rt, "===" + name + "===");
|
273
|
+
|
274
|
+
enumerateJSIObject(rt, obj, [&](const std::string& key, jsi::Value& value){
|
275
|
+
if (value.isObject()) {
|
276
|
+
if (value.asObject(rt).isArray(rt)) {
|
277
|
+
iterateJSIArray(rt, value.asObject(rt).asArray(rt), [&](size_t i, jsi::Value& nestedValue){
|
278
|
+
std::string printableKey = key + ": Array[" + std::to_string(i) + "]";
|
279
|
+
|
280
|
+
log.call(rt, printableKey);
|
281
|
+
|
282
|
+
if (nestedValue.isObject()) {
|
283
|
+
enumerateJSIObject(rt, nestedValue.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
284
|
+
parser(nestedKey, nestedValue);
|
285
|
+
});
|
286
|
+
} else {
|
287
|
+
parser(printableKey, nestedValue);
|
288
|
+
}
|
289
|
+
|
290
|
+
std::string endKey = key + ": Array[end]";
|
291
|
+
|
292
|
+
log.call(rt, endKey);
|
293
|
+
});
|
294
|
+
}
|
295
|
+
|
296
|
+
if (value.asObject(rt).isFunction(rt)) {
|
297
|
+
std::string output = key + ": [Function]";
|
298
|
+
|
299
|
+
log.call(rt, output);
|
300
|
+
|
301
|
+
return;
|
302
|
+
}
|
303
|
+
|
304
|
+
enumerateJSIObject(rt, value.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
305
|
+
parser(nestedKey, nestedValue);
|
306
|
+
});
|
307
|
+
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
parser(key, value);
|
312
|
+
});
|
313
|
+
|
314
|
+
log.call(rt, "===/" + name + "===");
|
315
|
+
}
|
316
|
+
|
228
317
|
}
|
@@ -87,19 +87,28 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
|
|
87
87
|
Variants variants = helpers::variantsToPairs(rt, arguments[0].asObject(rt));
|
88
88
|
parser::Parser parser = parser::Parser(this->_unistylesRuntime);
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
auto stylesheetCopy = std::make_shared<StyleSheet>(
|
91
|
+
this->_stylesheet->tag,
|
92
|
+
this->_stylesheet->type,
|
93
|
+
jsi::Value(rt, this->_stylesheet->rawValue).asObject(rt)
|
94
|
+
);
|
95
|
+
|
96
|
+
parser.buildUnistyles(rt, stylesheetCopy);
|
97
|
+
parser.parseUnistyles(rt, stylesheetCopy);
|
98
|
+
|
99
|
+
helpers::enumerateJSIObject(rt, thisVal.asObject(rt), [this, &parser, &rt, &variants, stylesheetCopy](const std::string& name, jsi::Value& value){
|
100
|
+
if (name == helpers::ADD_VARIANTS_FN || !stylesheetCopy->unistyles.contains(name)) {
|
92
101
|
return;
|
93
102
|
}
|
94
103
|
|
95
|
-
auto unistyle =
|
96
|
-
|
104
|
+
auto unistyle = stylesheetCopy->unistyles[name];
|
105
|
+
|
97
106
|
if (unistyle->dependsOn(UnistyleDependency::VARIANTS)) {
|
98
107
|
parser.rebuildUnistyle(rt, unistyle, variants, std::nullopt);
|
99
108
|
}
|
100
109
|
});
|
101
110
|
|
102
|
-
auto style = std::make_shared<core::HostUnistyle>(
|
111
|
+
auto style = std::make_shared<core::HostUnistyle>(stylesheetCopy, this->_unistylesRuntime, variants);
|
103
112
|
auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
|
104
113
|
|
105
114
|
return styleHostObject;
|
package/cxx/core/StyleSheet.h
CHANGED