react-native-unistyles 3.0.0-beta.5 → 3.0.0-beta.7
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 +17 -2
- package/android/CMakeLists.txt +1 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +1 -1
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -2
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +24 -1
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +6 -1
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +5 -4
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +6 -6
- package/components/native/Animated/package.json +5 -0
- package/components/native/NativeText/package.json +5 -0
- package/components/native/NativeView/package.json +5 -0
- package/cxx/core/HashGenerator.cpp +1 -1
- package/cxx/core/HostUnistyle.cpp +28 -4
- package/cxx/core/HostUnistyle.h +1 -0
- package/cxx/core/Unistyle.h +4 -0
- package/cxx/core/UnistyleWrapper.h +6 -6
- package/cxx/core/UnistylesRegistry.cpp +24 -3
- package/cxx/core/UnistylesRegistry.h +3 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -0
- package/cxx/hybridObjects/HybridStyleSheet.cpp +27 -2
- package/cxx/parser/Parser.cpp +13 -7
- package/ios/NativePlatform+ios.swift +16 -4
- package/ios/UnistylesModuleOnLoad.h +4 -4
- package/ios/UnistylesModuleOnLoad.mm +4 -8
- package/lib/commonjs/components/native/Animated.js +23 -0
- package/lib/commonjs/components/native/Animated.js.map +1 -0
- package/lib/commonjs/components/native/ImageBackground.js +6 -4
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/NativeText.js +13 -0
- package/lib/commonjs/components/native/NativeText.js.map +1 -0
- package/lib/commonjs/components/native/NativeText.native.js +18 -0
- package/lib/commonjs/components/native/NativeText.native.js.map +1 -0
- package/lib/commonjs/components/native/NativeView.js +9 -0
- package/lib/commonjs/components/native/NativeView.js.map +1 -0
- package/lib/commonjs/components/native/NativeView.native.js +20 -0
- package/lib/commonjs/components/native/NativeView.native.js.map +1 -0
- package/lib/commonjs/components/native/Pressable.js +1 -1
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +18 -9
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +28 -24
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +37 -23
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +34 -30
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +1 -3
- package/lib/commonjs/core/getClassname.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/warn.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +2 -2
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +5 -3
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.native.js +1 -1
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js +4 -2
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/useServerUnistyles.js +2 -2
- package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.native.js +3 -3
- package/lib/commonjs/specs/index.native.js.map +1 -1
- package/lib/commonjs/utils.js +16 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +4 -4
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js +3 -3
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/convert/object/transform.js +1 -1
- package/lib/commonjs/web/convert/object/transform.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -1
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/registry.js +1 -1
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +1 -1
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +1 -1
- package/lib/commonjs/web/utils/unistyle.js +10 -6
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/native/Animated.js +19 -0
- package/lib/module/components/native/Animated.js.map +1 -0
- package/lib/module/components/native/ImageBackground.js +5 -3
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/NativeText.js +4 -0
- package/lib/module/components/native/NativeText.js.map +1 -0
- package/lib/module/components/native/NativeText.native.js +15 -0
- package/lib/module/components/native/NativeText.native.js.map +1 -0
- package/lib/module/components/native/NativeView.js +5 -0
- package/lib/module/components/native/NativeView.js.map +1 -0
- package/lib/module/components/native/NativeView.native.js +17 -0
- package/lib/module/components/native/NativeView.native.js.map +1 -0
- package/lib/module/components/native/Pressable.js +1 -1
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +19 -10
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +28 -24
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +38 -24
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +35 -31
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/getClassname.js +2 -4
- package/lib/module/core/getClassname.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/warn.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +2 -2
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -4
- package/lib/module/core/withUnistyles/withUnistyles.native.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/mq.js.map +1 -1
- package/lib/module/server/getServerUnistyles.js +4 -2
- package/lib/module/server/getServerUnistyles.js.map +1 -1
- package/lib/module/server/hydrateServerUnistyles.js +1 -1
- package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/module/server/resetServerUnistyles.js +1 -1
- package/lib/module/server/resetServerUnistyles.js.map +1 -1
- package/lib/module/server/useServerUnistyles.js +2 -2
- package/lib/module/server/useServerUnistyles.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.native.js +4 -4
- package/lib/module/specs/index.native.js.map +1 -1
- package/lib/module/utils.js +14 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/index.js +5 -5
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +2 -2
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/convert/object/filter.js +3 -3
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/convert/object/transform.js +1 -1
- package/lib/module/web/convert/object/transform.js.map +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/index.js +1 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/registry.js +1 -1
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +1 -1
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -1
- package/lib/module/web/utils/unistyle.js +10 -6
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts +1 -3
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Animated.d.ts +39 -0
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -0
- package/lib/typescript/src/components/native/FlatList.d.ts +1 -3
- package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Image.d.ts +1 -3
- package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts +1 -8
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts +1 -2
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +1 -3
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/NativeText.d.ts +2 -0
- package/lib/typescript/src/components/native/NativeText.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeText.native.d.ts +2 -0
- package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeView.d.ts +3 -0
- package/lib/typescript/src/components/native/NativeView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/NativeView.native.d.ts +3 -0
- package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/RefreshControl.d.ts +1 -3
- package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts +1 -3
- package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/SectionList.d.ts +1 -3
- package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Switch.d.ts +1 -3
- package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Text.d.ts +1 -3
- package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TextInput.d.ts +1 -3
- package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts +1 -3
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts +1 -3
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
- package/lib/typescript/src/components/native/View.d.ts +1 -3
- package/lib/typescript/src/components/native/View.d.ts.map +1 -1
- package/lib/typescript/src/components/native/VirtualizedList.d.ts +1 -3
- package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts +1 -7
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts +1 -2
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +2 -3
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/getClassname.d.ts +2 -2
- package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +2 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +1 -1
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.native.d.ts +4 -4
- package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +2 -2
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +1 -1
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +4 -4
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +1 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +2 -2
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +1 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +23 -39
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +35 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +3 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -3
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +18 -18
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
- package/package.json +16 -12
- package/plugin/consts.js +63 -0
- package/plugin/exotic.js +54 -0
- package/plugin/import.js +1 -1
- package/plugin/index.d.ts +84 -36
- package/plugin/index.js +48 -65
- package/plugin/stylesheet.js +454 -117
- package/plugin/variants.js +1 -1
- package/src/components/native/Animated.tsx +17 -0
- package/src/components/native/ImageBackground.tsx +7 -4
- package/src/components/native/NativeText.native.tsx +12 -0
- package/src/components/native/NativeText.tsx +1 -0
- package/src/components/native/NativeView.native.tsx +13 -0
- package/src/components/native/NativeView.tsx +3 -0
- package/src/components/native/Pressable.native.tsx +26 -13
- package/src/components/native/Pressable.tsx +1 -1
- package/src/core/createUnistylesElement.native.tsx +42 -27
- package/src/core/createUnistylesElement.tsx +36 -31
- package/src/core/createUnistylesImageBackground.tsx +39 -34
- package/src/core/getClassname.ts +5 -4
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +3 -3
- package/src/core/warn.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +8 -6
- package/src/core/withUnistyles/withUnistyles.tsx +4 -4
- package/src/hooks/useMedia.native.ts +1 -1
- package/src/mq.ts +1 -1
- package/src/server/getServerUnistyles.tsx +3 -2
- package/src/server/hydrateServerUnistyles.ts +1 -1
- package/src/server/resetServerUnistyles.ts +1 -1
- package/src/server/useServerUnistyles.tsx +2 -2
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +5 -4
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +5 -5
- package/src/specs/index.native.ts +4 -4
- package/src/types/breakpoints.ts +2 -2
- package/src/types/core.ts +1 -1
- package/src/types/stylesheet.ts +4 -4
- package/src/utils.ts +17 -0
- package/src/web/convert/index.ts +5 -5
- package/src/web/convert/object/boxShadow.ts +2 -2
- package/src/web/convert/object/filter.ts +3 -3
- package/src/web/convert/object/transform.ts +2 -2
- package/src/web/convert/types.ts +1 -1
- package/src/web/convert/utils.ts +2 -2
- package/src/web/create.ts +1 -1
- package/src/web/index.ts +3 -3
- package/src/web/registry.ts +2 -2
- package/src/web/runtime.ts +2 -2
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/state.ts +4 -4
- package/src/web/utils/common.ts +1 -1
- package/src/web/utils/unistyle.ts +13 -7
- package/plugin/common.js +0 -142
@@ -1,17 +1,18 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import { ImageBackground as NativeImageBackground } from 'react-native'
|
3
2
|
import { forwardRef } from 'react'
|
4
|
-
import
|
3
|
+
import { ImageBackground as NativeImageBackground } from 'react-native'
|
5
4
|
import { getClassName } from '../../core'
|
6
|
-
import {
|
5
|
+
import type { UnistylesValues } from '../../types'
|
6
|
+
import { copyComponentProperties } from '../../utils'
|
7
7
|
import { UnistylesShadowRegistry } from '../../web'
|
8
|
+
import { isServer } from '../../web/utils'
|
8
9
|
|
9
10
|
type Props = {
|
10
11
|
style?: UnistylesValues
|
11
12
|
imageStyle?: UnistylesValues
|
12
13
|
}
|
13
14
|
|
14
|
-
|
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)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type ComponentType, createElement, forwardRef } from 'react'
|
2
|
+
import type { TextProps } from 'react-native'
|
3
|
+
import { createUnistylesElement } from '../../core'
|
4
|
+
|
5
|
+
// credits to @hirbod
|
6
|
+
const LeanText = forwardRef((props, ref) => {
|
7
|
+
return createElement('RCTText', { ...props, ref })
|
8
|
+
}) as ComponentType<TextProps>
|
9
|
+
|
10
|
+
LeanText.displayName = 'RCTText'
|
11
|
+
|
12
|
+
export const NativeText = createUnistylesElement(LeanText)
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Text } from './Text'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type ComponentType, createElement, forwardRef } from 'react'
|
2
|
+
import type { ViewProps } from 'react-native'
|
3
|
+
import { createUnistylesElement } from '../../core'
|
4
|
+
|
5
|
+
// credits to @hirbod
|
6
|
+
const LeanView = forwardRef((props, ref) => {
|
7
|
+
return createElement('RCTView', { ...props, ref })
|
8
|
+
}) as ComponentType<ViewProps>
|
9
|
+
|
10
|
+
LeanView.displayName = 'RCTView'
|
11
|
+
|
12
|
+
// this will match default export from react-native
|
13
|
+
export default createUnistylesElement(LeanView)
|
@@ -1,17 +1,33 @@
|
|
1
|
-
import React, { forwardRef,
|
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
|
-
import { UnistylesShadowRegistry } from '../../specs'
|
5
4
|
import { passForwardedRef } from '../../core'
|
5
|
+
import { UnistylesShadowRegistry } from '../../specs'
|
6
6
|
|
7
7
|
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]
|
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
|
-
|
30
|
+
useLayoutEffect(() => {
|
15
31
|
return () => {
|
16
32
|
if (storedRef.current) {
|
17
33
|
// @ts-expect-error - this is hidden from TS
|
@@ -24,13 +40,6 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
24
40
|
<NativePressableReactNative
|
25
41
|
{...props}
|
26
42
|
ref={ref => {
|
27
|
-
const unistyles = typeof style === 'function'
|
28
|
-
? style({ pressed: false })
|
29
|
-
: style
|
30
|
-
|
31
|
-
// @ts-expect-error web types are not compatible with RN styles
|
32
|
-
UnistylesShadowRegistry.add(ref, unistyles)
|
33
|
-
|
34
43
|
if (ref) {
|
35
44
|
storedRef.current = ref
|
36
45
|
}
|
@@ -38,14 +47,18 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
38
47
|
return passForwardedRef(props, ref, forwardedRef)
|
39
48
|
}}
|
40
49
|
style={state => {
|
41
|
-
const
|
42
|
-
|
43
|
-
|
50
|
+
const isPropStyleAFunction = typeof style === 'function'
|
51
|
+
const unistyles = isPropStyleAFunction
|
52
|
+
? style.call(style, state)
|
53
|
+
: getStyles(style as unknown as Record<string, any>)
|
44
54
|
|
45
55
|
if (!storedRef.current) {
|
46
56
|
return unistyles
|
47
57
|
}
|
48
58
|
|
59
|
+
// @ts-expect-error - this is hidden from TS
|
60
|
+
UnistylesShadowRegistry.remove(storedRef.current)
|
61
|
+
|
49
62
|
// @ts-expect-error - this is hidden from TS
|
50
63
|
UnistylesShadowRegistry.add(storedRef.current, unistyles)
|
51
64
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { forwardRef } from 'react'
|
2
2
|
import { Pressable as NativePressableReactNative } from 'react-native'
|
3
3
|
import type { PressableProps as Props, View } from 'react-native'
|
4
|
+
import { getClassName } from '../../core'
|
4
5
|
import { UnistylesShadowRegistry } from '../../specs'
|
5
6
|
import type { UnistylesValues } from '../../types'
|
6
|
-
import { getClassName } from '../../core'
|
7
7
|
import { isServer } from '../../web/utils'
|
8
8
|
|
9
9
|
type Variants = Record<string, string | boolean | undefined>
|
@@ -1,36 +1,51 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useLayoutEffect, useRef } from 'react'
|
2
2
|
import { UnistylesShadowRegistry } from '../specs'
|
3
|
+
import { copyComponentProperties } from '../utils'
|
3
4
|
import { passForwardedRef } from './passForwardRef'
|
4
5
|
import { maybeWarnAboutMultipleUnistyles } from './warn'
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
const getNativeRef = (Component: any, ref: any) => {
|
8
|
+
switch (Component.name) {
|
9
|
+
case 'KeyboardAvoidingView':
|
10
|
+
return ref.viewRef?.current
|
11
|
+
case 'FlatList':
|
12
|
+
return ref.getNativeScrollRef?.()
|
13
|
+
case 'VirtualizedList':
|
14
|
+
return ref.getScrollRef?.()
|
15
|
+
default:
|
16
|
+
return ref
|
17
|
+
}
|
18
|
+
}
|
8
19
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
// @ts-ignore
|
13
|
-
UnistylesShadowRegistry.remove(storedRef.current)
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}, [])
|
20
|
+
export const createUnistylesElement = (Component: any) => {
|
21
|
+
const UnistylesComponent = React.forwardRef((props, forwardedRef) => {
|
22
|
+
const storedRef = useRef<unknown>(null)
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
storedRef.current = Component.name === 'KeyboardAvoidingView'
|
24
|
-
// @ts-ignore this is special case for KeyboardAvoidingView
|
25
|
-
? ref.viewRef.current
|
26
|
-
: ref
|
24
|
+
useLayoutEffect(() => {
|
25
|
+
return () => {
|
26
|
+
if (storedRef.current) {
|
27
|
+
// @ts-ignore
|
28
|
+
UnistylesShadowRegistry.remove(storedRef.current)
|
27
29
|
}
|
30
|
+
}
|
31
|
+
}, [])
|
32
|
+
|
33
|
+
return (
|
34
|
+
<Component
|
35
|
+
{...props}
|
36
|
+
ref={(ref: unknown) => {
|
37
|
+
if (ref) {
|
38
|
+
storedRef.current = getNativeRef(Component, ref)
|
39
|
+
}
|
40
|
+
|
41
|
+
passForwardedRef(props, ref, forwardedRef)
|
28
42
|
|
29
|
-
|
43
|
+
// @ts-ignore we don't know the type of the component
|
44
|
+
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName)
|
45
|
+
}}
|
46
|
+
/>
|
47
|
+
)
|
48
|
+
})
|
30
49
|
|
31
|
-
|
32
|
-
|
33
|
-
}}
|
34
|
-
/>
|
35
|
-
)
|
36
|
-
})
|
50
|
+
return copyComponentProperties(Component, UnistylesComponent)
|
51
|
+
}
|
@@ -1,43 +1,48 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import type { UnistylesValues } from '../types'
|
3
|
-
import {
|
4
|
-
import { isServer } from '../web/utils'
|
3
|
+
import { copyComponentProperties } from '../utils'
|
5
4
|
import { UnistylesShadowRegistry } from '../web'
|
5
|
+
import { isServer } from '../web/utils'
|
6
|
+
import { getClassName } from './getClassname'
|
6
7
|
import { maybeWarnAboutMultipleUnistyles } from './warn'
|
7
8
|
|
8
9
|
type ComponentProps = {
|
9
10
|
style?: UnistylesValues | Array<UnistylesValues>
|
10
11
|
}
|
11
12
|
|
12
|
-
export const createUnistylesElement = (Component: any) =>
|
13
|
-
|
14
|
-
|
13
|
+
export const createUnistylesElement = (Component: any) => {
|
14
|
+
const UnistylesComponent = React.forwardRef<unknown, ComponentProps>((props, forwardedRef) => {
|
15
|
+
let storedRef: HTMLElement | null = null
|
16
|
+
const classNames = getClassName(props.style)
|
17
|
+
|
18
|
+
return (
|
19
|
+
<Component
|
20
|
+
{...props}
|
21
|
+
style={classNames}
|
22
|
+
ref={isServer() ? undefined : (ref: HTMLElement | null) => {
|
23
|
+
// @ts-ignore we don't know the type of the component
|
24
|
+
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName)
|
15
25
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
ref={isServer() ? undefined : (ref: HTMLElement | null) => {
|
21
|
-
// @ts-ignore we don't know the type of the component
|
22
|
-
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName)
|
26
|
+
if (!ref) {
|
27
|
+
// @ts-expect-error hidden from TS
|
28
|
+
UnistylesShadowRegistry.remove(storedRef, classNames?.hash)
|
29
|
+
}
|
23
30
|
|
24
|
-
|
31
|
+
storedRef = ref
|
25
32
|
// @ts-expect-error hidden from TS
|
26
|
-
UnistylesShadowRegistry.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
)
|
43
|
-
})
|
33
|
+
UnistylesShadowRegistry.add(ref, classNames?.hash)
|
34
|
+
|
35
|
+
if (typeof forwardedRef === 'function') {
|
36
|
+
return forwardedRef(ref)
|
37
|
+
}
|
38
|
+
|
39
|
+
if (forwardedRef) {
|
40
|
+
forwardedRef.current = ref
|
41
|
+
}
|
42
|
+
}}
|
43
|
+
/>
|
44
|
+
)
|
45
|
+
})
|
46
|
+
|
47
|
+
return copyComponentProperties(Component, UnistylesComponent)
|
48
|
+
}
|
@@ -1,45 +1,50 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useLayoutEffect, useRef } from 'react'
|
2
2
|
import type { Image, ImageBackground, ImageBackgroundProps } from 'react-native'
|
3
3
|
import { UnistylesShadowRegistry } from '../specs'
|
4
|
+
import { copyComponentProperties } from '../utils'
|
4
5
|
import { passForwardedRef } from './passForwardRef'
|
5
6
|
import { maybeWarnAboutMultipleUnistyles } from './warn'
|
6
7
|
|
7
|
-
export const createUnistylesImageBackground = (Component: typeof ImageBackground) =>
|
8
|
-
const
|
8
|
+
export const createUnistylesImageBackground = (Component: typeof ImageBackground) => {
|
9
|
+
const UnistylesImageBackground = React.forwardRef<ImageBackground, ImageBackgroundProps>((props, forwardedRef) => {
|
10
|
+
const storedImageRef = useRef<Image | null>(null)
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
useLayoutEffect(() => {
|
13
|
+
return () => {
|
14
|
+
if (storedImageRef.current) {
|
15
|
+
// @ts-ignore
|
16
|
+
UnistylesShadowRegistry.remove(storedImageRef.current)
|
17
|
+
}
|
15
18
|
}
|
16
|
-
}
|
17
|
-
}, [])
|
19
|
+
}, [])
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
// @ts-expect-error we don't know the type of the component
|
22
|
+
maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground')
|
23
|
+
// @ts-ignore we don't know the type of the component
|
24
|
+
maybeWarnAboutMultipleUnistyles(props.imageStyle, 'ImageBackground')
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
return (
|
27
|
+
<Component
|
28
|
+
{...props}
|
29
|
+
ref={ref => {
|
30
|
+
passForwardedRef(props, ref, forwardedRef)
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
return () => {
|
33
|
+
// @ts-ignore
|
34
|
+
UnistylesShadowRegistry.remove(ref)
|
35
|
+
}
|
36
|
+
}}
|
37
|
+
imageRef={ref => {
|
38
|
+
if (ref) {
|
39
|
+
storedImageRef.current = ref
|
40
|
+
}
|
41
|
+
|
42
|
+
// @ts-expect-error web types are not compatible with RN styles
|
43
|
+
UnistylesShadowRegistry.add(ref, props.imageStyle)
|
44
|
+
}}
|
45
|
+
/>
|
46
|
+
)
|
47
|
+
})
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
}}
|
43
|
-
/>
|
44
|
-
)
|
45
|
-
})
|
49
|
+
return copyComponentProperties(Component, UnistylesImageBackground)
|
50
|
+
}
|
package/src/core/getClassname.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
import type { UnistylesValues } from '../types'
|
2
|
-
import {
|
1
|
+
import type { UnistylesValues } from '../types'
|
2
|
+
import { UnistylesWeb } from '../web'
|
3
3
|
|
4
4
|
export const getClassName = (unistyle: UnistylesValues | undefined | Array<UnistylesValues>) => {
|
5
5
|
if (!unistyle) {
|
6
6
|
return undefined
|
7
7
|
}
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
const { hash, injectedClassName } = UnistylesWeb.shadowRegistry.addStyles(
|
10
|
+
Array.isArray(unistyle) ? unistyle.flat(Number.POSITIVE_INFINITY) : [unistyle]
|
11
|
+
)
|
11
12
|
|
12
13
|
return hash ? { $$css: true, hash, injectedClassName } : undefined
|
13
14
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useEffect, useReducer, useRef, useState } from 'react'
|
2
|
-
import { UnistylesRuntime, UnistylesShadowRegistry
|
2
|
+
import { type UnistylesMiniRuntime, UnistylesRuntime, UnistylesShadowRegistry } from '../../specs'
|
3
3
|
// It's imported that way because of circular dependency
|
4
4
|
import { UnistyleDependency } from '../../specs/NativePlatform'
|
5
5
|
import type { UnistylesTheme } from '../../types'
|
@@ -26,8 +26,8 @@ const RTDependencyMap = {
|
|
26
26
|
themeName: UnistyleDependency.ThemeName,
|
27
27
|
} satisfies Partial<Record<keyof UnistylesMiniRuntime, UnistyleDependency>>
|
28
28
|
|
29
|
-
export const useProxifiedUnistyles = () => {
|
30
|
-
const scopedTheme = UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme
|
29
|
+
export const useProxifiedUnistyles = (forcedTheme?: UnistylesTheme) => {
|
30
|
+
const scopedTheme = forcedTheme ?? UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme
|
31
31
|
const [dependencies] = useState(() => new Set<number>())
|
32
32
|
const [theme, setTheme] = useState(UnistylesRuntime.getTheme(scopedTheme))
|
33
33
|
const [_, runtimeChanged] = useReducer(() => ({}), {})
|
package/src/core/warn.ts
CHANGED
@@ -4,7 +4,7 @@ export const maybeWarnAboutMultipleUnistyles = (style: ViewStyle, displayName =
|
|
4
4
|
if (__DEV__ && style && !Array.isArray(style)) {
|
5
5
|
const unistylesKeys = Object
|
6
6
|
.keys(style)
|
7
|
-
.filter(key => key.startsWith('
|
7
|
+
.filter(key => key.startsWith('unistyles_'))
|
8
8
|
|
9
9
|
if (unistylesKeys.length > 1) {
|
10
10
|
console.warn(`Unistyles: we detected style object with ${unistylesKeys.length} unistyles styles. This might cause no updates or unpredictable behavior. Please check style prop for "${displayName}" and use array syntax instead of object syntax.`)
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import React, { forwardRef, useEffect, type ComponentType } from 'react'
|
2
|
-
import type
|
1
|
+
import React, { forwardRef, useEffect, type ComponentType, useRef } from 'react'
|
2
|
+
import { type UnistyleDependency, UnistylesShadowRegistry } from '../../specs'
|
3
|
+
import type { UnistylesTheme } from '../../types'
|
3
4
|
import type { PartialBy } from '../../types/common'
|
4
5
|
import { deepMergeObjects } from '../../utils'
|
5
|
-
import type { Mappings, SupportedStyleProps } from './types'
|
6
|
-
import { maybeWarnAboutMultipleUnistyles } from '../warn'
|
7
6
|
import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
|
7
|
+
import { maybeWarnAboutMultipleUnistyles } from '../warn'
|
8
|
+
import type { Mappings, SupportedStyleProps } from './types'
|
8
9
|
|
9
10
|
// @ts-expect-error
|
10
11
|
type GenericComponentProps<P> = ComponentProps<P>
|
@@ -19,7 +20,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
19
20
|
const getSecrets = (styleProps: Record<string, any> = {}): { uni__getStyles(): any, uni__dependencies: Array<UnistyleDependency> } => {
|
20
21
|
const unistyleKey = Object
|
21
22
|
.keys(styleProps)
|
22
|
-
.find(key => key.startsWith('
|
23
|
+
.find(key => key.startsWith('unistyles_'))
|
23
24
|
|
24
25
|
return unistyleKey
|
25
26
|
? styleProps[unistyleKey]
|
@@ -38,7 +39,8 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
38
39
|
// @ts-ignore we don't know the type of the component
|
39
40
|
maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`)
|
40
41
|
|
41
|
-
const
|
42
|
+
const scopedTheme = useRef(UnistylesShadowRegistry.getScopedTheme() as UnistylesTheme)
|
43
|
+
const { proxifiedRuntime, proxifiedTheme, addDependencies } = useProxifiedUnistyles(scopedTheme.current)
|
42
44
|
|
43
45
|
useEffect(() => {
|
44
46
|
const styleSecrets = getSecrets(narrowedProps.style)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React, { type ComponentType, forwardRef, type ComponentProps, type ComponentRef } from 'react'
|
2
|
+
import type { UnistylesValues } from '../../types'
|
2
3
|
import type { PartialBy } from '../../types/common'
|
3
4
|
import { deepMergeObjects } from '../../utils'
|
4
|
-
import type { Mappings, SupportedStyleProps } from './types'
|
5
|
-
import type { UnistylesValues } from '../../types'
|
6
5
|
import { getClassName } from '../getClassname'
|
7
|
-
import { maybeWarnAboutMultipleUnistyles } from '../warn'
|
8
6
|
import { useProxifiedUnistyles } from '../useProxifiedUnistyles'
|
7
|
+
import { maybeWarnAboutMultipleUnistyles } from '../warn'
|
8
|
+
import type { Mappings, SupportedStyleProps } from './types'
|
9
9
|
|
10
10
|
// @ts-expect-error
|
11
11
|
type GenericComponentProps<T> = ComponentProps<T>
|
@@ -37,7 +37,7 @@ export const withUnistyles = <TComponent, TMappings extends GenericComponentProp
|
|
37
37
|
style: styleClassNames,
|
38
38
|
} : {},
|
39
39
|
...narrowedProps.contentContainerStyle ? {
|
40
|
-
|
40
|
+
contentContainerStyle: contentContainerStyleClassNames,
|
41
41
|
} : {},
|
42
42
|
} as any
|
43
43
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useEffect, useLayoutEffect, useState } from 'react'
|
2
|
+
import { isUnistylesMq, isValidMq, parseMq } from '../mq'
|
2
3
|
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
|
3
|
-
import { isValidMq, parseMq, isUnistylesMq } from '../mq'
|
4
4
|
|
5
5
|
export const useMedia = (config: { mq: symbol }) => {
|
6
6
|
const computeIsVisible = (): boolean => {
|
package/src/mq.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { Nullable } from './types'
|
2
1
|
import type { UnistylesBreakpoints } from './global'
|
3
2
|
import { UnistylesRuntime } from './specs'
|
3
|
+
import type { Nullable } from './types'
|
4
4
|
|
5
5
|
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/
|
6
6
|
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { StyleSheet } from 'react-native'
|
3
|
-
import { error, isServer } from '../web/utils'
|
4
3
|
import { UnistylesWeb } from '../web'
|
4
|
+
import { error, isServer } from '../web/utils'
|
5
5
|
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
|
6
6
|
|
7
7
|
export const getServerUnistyles = ({ includeRNWStyles = true }: ServerUnistylesSettings = DefaultServerUnistylesSettings) => {
|
@@ -15,6 +15,7 @@ export const getServerUnistyles = ({ includeRNWStyles = true }: ServerUnistylesS
|
|
15
15
|
return <>
|
16
16
|
{rnwStyle && <style id='rnw-style'>{rnwStyle}</style>}
|
17
17
|
<style id='unistyles-web'>{css}</style>
|
18
|
-
|
18
|
+
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Needs the json quotes to be unescaped */}
|
19
|
+
<script id='unistyles-script' dangerouslySetInnerHTML={{ __html: `window.__UNISTYLES_STATE__ = ${JSON.stringify(state)}`}} />
|
19
20
|
</>
|
20
21
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useRef } from 'react'
|
2
2
|
import { isServer } from '../web/utils'
|
3
|
-
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
|
4
3
|
import { getServerUnistyles } from './getServerUnistyles'
|
5
|
-
import { resetServerUnistyles } from './resetServerUnistyles'
|
6
4
|
import { hydrateServerUnistyles } from './hydrateServerUnistyles'
|
5
|
+
import { resetServerUnistyles } from './resetServerUnistyles'
|
6
|
+
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
|
7
7
|
|
8
8
|
export const useServerUnistyles = (settings: ServerUnistylesSettings = DefaultServerUnistylesSettings): React.ReactNode | null => {
|
9
9
|
const isServerInserted = useRef(false)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { StatusBar as NativeStatusBar } from 'react-native'
|
2
|
-
import type { UnistylesStatusBar as UnistylesStatusBarSpec } from './UnistylesStatusBar.nitro'
|
3
2
|
import { StatusBarStyle } from '../types'
|
3
|
+
import type { UnistylesStatusBar as UnistylesStatusBarSpec } from './UnistylesStatusBar.nitro'
|
4
4
|
|
5
5
|
export type StatusBarHiddenAnimation = 'none' | 'fade' | 'slide'
|
6
6
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import { processColor, StyleSheet as NativeStyleSheet } from 'react-native'
|
1
|
+
import { StyleSheet as NativeStyleSheet, processColor } from 'react-native'
|
3
2
|
import type { StyleSheet as NativeStyleSheetType } from 'react-native'
|
4
|
-
import
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules'
|
5
4
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../../global'
|
6
5
|
import type { CreateUnistylesStyleSheet } from '../../types'
|
6
|
+
import type { UnistylesStyleSheet as UnistylesStyleSheetSpec } from './UnistylesStyleSheet.nitro'
|
7
7
|
|
8
8
|
type UnistylesThemeSettings = {
|
9
9
|
initialTheme: (() => keyof UnistylesThemes) | keyof UnistylesThemes
|
@@ -12,7 +12,8 @@ type UnistylesThemeSettings = {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
type UnistylesSettings = UnistylesThemeSettings & {
|
15
|
-
CSSVars?: boolean
|
15
|
+
CSSVars?: boolean,
|
16
|
+
nativeBreakpointsMode?: 'pixels' | 'points'
|
16
17
|
}
|
17
18
|
|
18
19
|
export type UnistylesConfig = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules'
|
2
|
-
import type { AppBreakpoint, AppThemeName, Dimensions, Insets } from '../types'
|
3
2
|
import type { AndroidContentSizeCategory, IOSContentSizeCategory, WebContentSizeCategory } from '../../types'
|
4
3
|
import type { UnistylesNativeMiniRuntime } from '../NativePlatform'
|
4
|
+
import type { AppBreakpoint, AppThemeName, Dimensions, Insets } from '../types'
|
5
5
|
|
6
6
|
type ColorScheme = 'light' | 'dark' | 'unspecified'
|
7
7
|
type Orientation = 'portrait' | 'landscape'
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { processColor } from 'react-native'
|
2
2
|
import { NitroModules } from 'react-native-nitro-modules'
|
3
|
-
import type { UnistylesRuntime as UnistylesRuntimeSpec, UnistylesMiniRuntime } from './UnistylesRuntime.nitro'
|
4
|
-
import type { AppBreakpoint, AppTheme, AppThemeName, Color, ColorScheme, Orientation } from '../types'
|
5
|
-
import { attachStatusBarJSMethods, type UnistylesStatusBar } from '../StatusBar'
|
6
|
-
import type { UnistylesNavigationBar } from '../NavigtionBar'
|
7
|
-
import type { AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesTheme } from '../../types'
|
8
3
|
import { isIOS } from '../../common'
|
9
4
|
import type { UnistylesThemes } from '../../global'
|
5
|
+
import type { AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesTheme } from '../../types'
|
6
|
+
import type { UnistylesNavigationBar } from '../NavigtionBar'
|
7
|
+
import { type UnistylesStatusBar, attachStatusBarJSMethods } from '../StatusBar'
|
8
|
+
import type { AppBreakpoint, AppTheme, AppThemeName, Color, ColorScheme, Orientation } from '../types'
|
9
|
+
import type { UnistylesMiniRuntime, UnistylesRuntime as UnistylesRuntimeSpec } from './UnistylesRuntime.nitro'
|
10
10
|
|
11
11
|
export interface UnistylesRuntimePrivate extends Omit<UnistylesRuntimeSpec, 'setRootViewBackgroundColor'> {
|
12
12
|
readonly colorScheme: ColorScheme,
|