react-native-unistyles 3.0.24 → 3.1.0
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/android/src/main/cxx/NativeUnistylesModule.cpp +7 -4
- package/android/src/main/cxx/NativeUnistylesModule.h +9 -3
- package/android/src/main/cxx/cpp-adapter.cpp +1 -1
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +22 -4
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -0
- package/cxx/core/StyleSheetRegistry.cpp +11 -11
- package/cxx/core/StyleSheetRegistry.h +4 -4
- package/cxx/core/UnistylesRegistry.cpp +27 -14
- package/cxx/core/UnistylesRegistry.h +4 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +5 -0
- package/cxx/hybridObjects/HybridStyleSheet.cpp +2 -14
- package/cxx/hybridObjects/HybridStyleSheet.h +0 -2
- package/ios/UnistylesModuleOnLoad.mm +10 -2
- package/lib/commonjs/components/AdaptiveTheme.js +1 -1
- package/lib/commonjs/components/AdaptiveTheme.js.map +1 -1
- package/lib/commonjs/components/ApplyScopedTheme.js.map +1 -1
- package/lib/commonjs/components/Display.js.map +1 -1
- package/lib/commonjs/components/Hide.js.map +1 -1
- package/lib/commonjs/components/NamedTheme.js +2 -2
- package/lib/commonjs/components/NamedTheme.js.map +1 -1
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/components/native/ActivityIndicator.js.map +1 -1
- package/lib/commonjs/components/native/Animated.js.map +1 -1
- package/lib/commonjs/components/native/FlatList.js.map +1 -1
- package/lib/commonjs/components/native/Image.js.map +1 -1
- package/lib/commonjs/components/native/Image.native.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.native.js.map +1 -1
- package/lib/commonjs/components/native/KeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/components/native/NativeText.native.js.map +1 -1
- package/lib/commonjs/components/native/NativeView.native.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/components/native/RefreshControl.js.map +1 -1
- package/lib/commonjs/components/native/SafeAreaView.js.map +1 -1
- package/lib/commonjs/components/native/ScrollView.js.map +1 -1
- package/lib/commonjs/components/native/SectionList.js.map +1 -1
- package/lib/commonjs/components/native/Switch.js.map +1 -1
- package/lib/commonjs/components/native/Text.js.map +1 -1
- package/lib/commonjs/components/native/TextInput.js.map +1 -1
- package/lib/commonjs/components/native/TouchableHighlight.js.map +1 -1
- package/lib/commonjs/components/native/TouchableOpacity.js.map +1 -1
- package/lib/commonjs/components/native/View.js.map +1 -1
- package/lib/commonjs/components/native/VirtualizedList.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js.map +1 -1
- package/lib/commonjs/core/parseBoxShadow.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +0 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/useUnistyles.js.map +1 -1
- package/lib/commonjs/core/warn.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +3 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +6 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.native.js +0 -1
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mocks.js +28 -8
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js +0 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/commonjs/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.js.map +1 -1
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js +0 -1
- package/lib/commonjs/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +9 -5
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.native.js +1 -1
- package/lib/commonjs/specs/index.native.js.map +1 -1
- package/lib/commonjs/specs/types.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/stylesheet.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -1
- package/lib/commonjs/web/convert/object/transform.js.map +1 -1
- package/lib/commonjs/web/convert/pseudo.js.map +1 -1
- package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -1
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/create.js +1 -5
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js.map +1 -1
- package/lib/commonjs/web/css/state.js.map +1 -1
- package/lib/commonjs/web/css/utils.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -0
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js +29 -8
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +1 -2
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +3 -3
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +2 -0
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web/variants.js.map +1 -1
- package/lib/commonjs/web-only/getWebProps.js.map +1 -1
- package/lib/commonjs/web-only/index.js.map +1 -1
- package/lib/module/components/AdaptiveTheme.js +1 -1
- package/lib/module/components/AdaptiveTheme.js.map +1 -1
- package/lib/module/components/ApplyScopedTheme.js.map +1 -1
- package/lib/module/components/Display.js.map +1 -1
- package/lib/module/components/Hide.js.map +1 -1
- package/lib/module/components/NamedTheme.js +2 -2
- package/lib/module/components/NamedTheme.js.map +1 -1
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/components/native/ActivityIndicator.js.map +1 -1
- package/lib/module/components/native/Animated.js.map +1 -1
- package/lib/module/components/native/FlatList.js.map +1 -1
- package/lib/module/components/native/Image.js.map +1 -1
- package/lib/module/components/native/Image.native.js.map +1 -1
- package/lib/module/components/native/ImageBackground.js.map +1 -1
- package/lib/module/components/native/ImageBackground.native.js.map +1 -1
- package/lib/module/components/native/KeyboardAvoidingView.js.map +1 -1
- package/lib/module/components/native/NativeText.native.js.map +1 -1
- package/lib/module/components/native/NativeView.native.js.map +1 -1
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/components/native/RefreshControl.js.map +1 -1
- package/lib/module/components/native/SafeAreaView.js.map +1 -1
- package/lib/module/components/native/ScrollView.js.map +1 -1
- package/lib/module/components/native/SectionList.js.map +1 -1
- package/lib/module/components/native/Switch.js.map +1 -1
- package/lib/module/components/native/Text.js.map +1 -1
- package/lib/module/components/native/TextInput.js.map +1 -1
- package/lib/module/components/native/TouchableHighlight.js.map +1 -1
- package/lib/module/components/native/TouchableOpacity.js.map +1 -1
- package/lib/module/components/native/View.js.map +1 -1
- package/lib/module/components/native/VirtualizedList.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/getClassname.js.map +1 -1
- package/lib/module/core/parseBoxShadow.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/listener.native.js +0 -1
- package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/useUnistyles.js.map +1 -1
- package/lib/module/core/warn.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +3 -1
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -0
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/hooks/useMedia.js.map +1 -1
- package/lib/module/hooks/useMedia.native.js +0 -1
- package/lib/module/hooks/useMedia.native.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks.js +28 -8
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/mq.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.native.js +0 -1
- package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/module/reanimated/variant/useAnimatedVariantColor.js.map +1 -1
- package/lib/module/reanimated/variant/useUpdateVariantColor.js.map +1 -1
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js +0 -1
- package/lib/module/reanimated/variant/useUpdateVariantColor.native.js.map +1 -1
- package/lib/module/server/getServerUnistyles.js.map +1 -1
- package/lib/module/server/useServerUnistyles.js.map +1 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +9 -5
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.native.js +1 -1
- package/lib/module/specs/index.native.js.map +1 -1
- package/lib/module/specs/types.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/stylesheet.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/convert/object/objectStyle.js.map +1 -1
- package/lib/module/web/convert/object/transform.js.map +1 -1
- package/lib/module/web/convert/pseudo.js.map +1 -1
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -1
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -1
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -1
- package/lib/module/web/convert/types.js.map +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/create.js +2 -6
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/css/core.js.map +1 -1
- package/lib/module/web/css/state.js.map +1 -1
- package/lib/module/web/css/utils.js.map +1 -1
- package/lib/module/web/index.js +1 -0
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js +29 -8
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +1 -2
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +3 -3
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/createUnistylesRef.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +2 -0
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants.js.map +1 -1
- package/lib/module/web-only/getWebProps.js.map +1 -1
- package/lib/module/web-only/index.js.map +1 -1
- package/lib/typescript/src/__tests__/mocks.spec.d.ts +2 -0
- package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +1 -0
- package/lib/typescript/src/__tests__/web-listener.spec.d.ts +2 -0
- package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +1 -0
- package/lib/typescript/src/components/AdaptiveTheme.d.ts +1 -1
- package/lib/typescript/src/components/AdaptiveTheme.d.ts.map +1 -1
- package/lib/typescript/src/components/ApplyScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/components/Display.d.ts.map +1 -1
- package/lib/typescript/src/components/Hide.d.ts.map +1 -1
- package/lib/typescript/src/components/NamedTheme.d.ts +1 -1
- package/lib/typescript/src/components/NamedTheme.d.ts.map +1 -1
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
- package/lib/typescript/src/components/native/FlatList.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.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.d.ts +1 -1
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
- package/lib/typescript/src/components/native/SafeAreaView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
- package/lib/typescript/src/components/native/View.d.ts.map +1 -1
- package/lib/typescript/src/components/native/VirtualizedList.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.map +1 -1
- package/lib/typescript/src/core/parseBoxShadow.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 +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/useUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/types.d.ts +1 -1
- package/lib/typescript/src/core/withUnistyles/types.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/global.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/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/types.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/useAnimatedVariantColor.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts +1 -1
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts +1 -1
- package/lib/typescript/src/reanimated/variant/useUpdateVariantColor.native.d.ts.map +1 -1
- package/lib/typescript/src/server/getServerUnistyles.d.ts +1 -1
- package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/types.d.ts.map +1 -1
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -5
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.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/UnistylesStyleSheet.nitro.d.ts +0 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -3
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
- 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/specs/types.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.map +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/lib/typescript/src/types/index.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/types/variants.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -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.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/types.d.ts +2 -2
- package/lib/typescript/src/web/convert/types.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 +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.map +1 -1
- package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts +5 -1
- package/lib/typescript/src/web/listener.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.map +1 -1
- package/lib/typescript/src/web/types.d.ts +1 -1
- 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.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +1 -1
- 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.map +1 -1
- package/lib/typescript/src/web-only/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +36 -42
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +19 -22
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +15 -18
- package/nitrogen/generated/android/unistylesOnLoad.cpp +14 -9
- package/nitrogen/generated/android/unistylesOnLoad.hpp +13 -4
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +0 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +0 -1
- package/package.json +43 -44
- package/plugin/index.d.ts +34 -28
- package/plugin/index.js +113 -103
- package/repack-plugin/index.d.ts +2 -2
- package/src/components/AdaptiveTheme.tsx +8 -12
- package/src/components/ApplyScopedTheme.tsx +2 -0
- package/src/components/Display.tsx +2 -3
- package/src/components/Hide.tsx +2 -3
- package/src/components/NamedTheme.tsx +9 -14
- package/src/components/ScopedTheme.tsx +22 -27
- package/src/components/native/ActivityIndicator.tsx +1 -0
- package/src/components/native/Animated.tsx +2 -1
- package/src/components/native/FlatList.tsx +1 -0
- package/src/components/native/Image.native.tsx +1 -0
- package/src/components/native/Image.tsx +11 -7
- package/src/components/native/ImageBackground.native.tsx +1 -0
- package/src/components/native/ImageBackground.tsx +11 -7
- package/src/components/native/KeyboardAvoidingView.tsx +1 -0
- package/src/components/native/NativeText.native.tsx +3 -1
- package/src/components/native/NativeView.native.tsx +3 -1
- package/src/components/native/Pressable.native.tsx +8 -8
- package/src/components/native/Pressable.tsx +25 -20
- package/src/components/native/RefreshControl.tsx +1 -0
- package/src/components/native/SafeAreaView.tsx +1 -0
- package/src/components/native/ScrollView.tsx +1 -0
- package/src/components/native/SectionList.tsx +1 -0
- package/src/components/native/Switch.tsx +1 -0
- package/src/components/native/Text.tsx +1 -0
- package/src/components/native/TextInput.tsx +1 -0
- package/src/components/native/TouchableHighlight.tsx +1 -0
- package/src/components/native/TouchableOpacity.tsx +1 -0
- package/src/components/native/View.tsx +1 -0
- package/src/components/native/VirtualizedList.tsx +1 -0
- package/src/core/createUnistylesElement.native.tsx +4 -2
- package/src/core/createUnistylesElement.tsx +14 -17
- package/src/core/createUnistylesImageBackground.tsx +6 -4
- package/src/core/getClassname.ts +4 -11
- package/src/core/parseBoxShadow.ts +11 -24
- package/src/core/passForwardRef.ts +1 -1
- package/src/core/useProxifiedUnistyles/listener.native.ts +3 -3
- package/src/core/useProxifiedUnistyles/listener.ts +10 -3
- package/src/core/useProxifiedUnistyles/types.ts +2 -2
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +13 -9
- package/src/core/useUnistyles.ts +2 -1
- package/src/core/warn.ts +4 -4
- package/src/core/withUnistyles/types.ts +7 -4
- package/src/core/withUnistyles/withUnistyles.native.tsx +53 -44
- package/src/core/withUnistyles/withUnistyles.tsx +30 -24
- package/src/global.ts +2 -2
- package/src/hooks/useMedia.native.ts +2 -2
- package/src/hooks/useMedia.ts +6 -3
- package/src/index.ts +1 -0
- package/src/mocks.ts +74 -49
- package/src/mq.ts +23 -15
- package/src/reanimated/useAnimatedTheme.native.ts +4 -3
- package/src/reanimated/useAnimatedTheme.ts +6 -2
- package/src/reanimated/variant/types.ts +11 -10
- package/src/reanimated/variant/useAnimatedVariantColor.ts +7 -7
- package/src/reanimated/variant/useUpdateVariantColor.native.ts +10 -6
- package/src/reanimated/variant/useUpdateVariantColor.ts +21 -21
- package/src/server/getServerUnistyles.tsx +11 -4
- package/src/server/index.ts +0 -1
- package/src/server/types.ts +1 -1
- package/src/server/useServerUnistyles.tsx +4 -1
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +30 -27
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +3 -3
- package/src/specs/ShadowRegistry/ShadowRegistry.nitro.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +35 -29
- package/src/specs/ShadowRegistry/types.ts +9 -10
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +4 -4
- package/src/specs/StatusBar/index.ts +5 -5
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +2 -2
- package/src/specs/StyleSheet/index.ts +32 -27
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -0
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +26 -25
- package/src/specs/UnistylesRuntime/index.ts +20 -20
- package/src/specs/index.native.ts +6 -18
- package/src/specs/types.ts +9 -8
- package/src/types/accessibility.ts +2 -2
- package/src/types/breakpoints.ts +61 -59
- package/src/types/core.ts +17 -17
- package/src/types/index.ts +2 -9
- package/src/types/stylesheet.ts +27 -19
- package/src/types/variants.ts +3 -11
- package/src/utils.ts +16 -16
- package/src/web/convert/index.ts +6 -2
- package/src/web/convert/object/boxShadow.ts +23 -18
- package/src/web/convert/object/filter.ts +30 -13
- package/src/web/convert/object/objectStyle.ts +33 -23
- package/src/web/convert/object/transform.ts +10 -8
- package/src/web/convert/pseudo.ts +2 -2
- package/src/web/convert/shadow/boxShadow.ts +6 -6
- package/src/web/convert/shadow/getShadowBreakpoints.ts +4 -4
- package/src/web/convert/shadow/textShadow.ts +6 -6
- package/src/web/convert/style.ts +25 -25
- package/src/web/convert/types.ts +4 -3
- package/src/web/convert/utils.ts +20 -10
- package/src/web/create.ts +29 -20
- package/src/web/css/core.ts +2 -1
- package/src/web/css/state.ts +11 -8
- package/src/web/css/utils.ts +2 -1
- package/src/web/index.ts +7 -4
- package/src/web/listener.ts +61 -18
- package/src/web/mock.ts +2 -2
- package/src/web/registry.ts +17 -10
- package/src/web/runtime.ts +23 -17
- package/src/web/shadowRegistry.ts +26 -24
- package/src/web/state.ts +23 -16
- package/src/web/types.ts +5 -5
- package/src/web/utils/common.ts +7 -9
- package/src/web/utils/createUnistylesRef.ts +18 -14
- package/src/web/utils/unistyle.ts +53 -34
- package/src/web/variants.ts +19 -11
- package/src/web-only/getWebProps.ts +5 -6
- package/src/web-only/index.ts +0 -1
- package/LICENSE +0 -20
- package/README.md +0 -178
- package/lib/typescript/plugin/src/consts.d.ts +0 -17
- package/lib/typescript/plugin/src/consts.d.ts.map +0 -1
- package/lib/typescript/repack-plugin/src/index.d.ts +0 -18
- package/lib/typescript/repack-plugin/src/index.d.ts.map +0 -1
- package/lib/typescript/repack-plugin/src/loader.d.ts +0 -9
- package/lib/typescript/repack-plugin/src/loader.d.ts.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useEffect } from 'react'
|
|
2
2
|
import { type SharedValue, useSharedValue } from 'react-native-reanimated'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import type { UnistylesTheme } from '../types'
|
|
5
5
|
|
|
6
|
+
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
|
|
7
|
+
|
|
6
8
|
export const useAnimatedTheme = () => {
|
|
7
9
|
const theme = useSharedValue(UnistylesRuntime.getTheme())
|
|
8
10
|
|
|
9
11
|
useEffect(() => {
|
|
10
|
-
|
|
11
|
-
const dispose = StyleSheet.addChangeListener(changedDependencies => {
|
|
12
|
+
const dispose = StyleSheet.addChangeListener((changedDependencies) => {
|
|
12
13
|
if (changedDependencies.includes(UnistyleDependency.Theme)) {
|
|
13
14
|
theme.set(UnistylesRuntime.getTheme())
|
|
14
15
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { useEffect } from 'react'
|
|
2
2
|
import { type SharedValue, useSharedValue } from 'react-native-reanimated'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import type { UnistylesTheme } from '../types'
|
|
5
|
+
|
|
6
|
+
import { UnistyleDependency, UnistylesRuntime } from '../specs'
|
|
5
7
|
import { services } from '../web/services'
|
|
6
8
|
|
|
7
9
|
export const useAnimatedTheme = () => {
|
|
8
10
|
const theme = useSharedValue(UnistylesRuntime.getTheme())
|
|
9
11
|
|
|
10
12
|
useEffect(() => {
|
|
11
|
-
const dispose = services.listener.addListeners([UnistyleDependency.Theme], () =>
|
|
13
|
+
const dispose = services.listener.addListeners([UnistyleDependency.Theme], () =>
|
|
14
|
+
theme.set(UnistylesRuntime.getTheme()),
|
|
15
|
+
)
|
|
12
16
|
|
|
13
17
|
return () => {
|
|
14
18
|
dispose()
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
type KeysOfUnion<T> = T extends T ? keyof T : never
|
|
2
2
|
|
|
3
|
-
export type ColorKeys<T> =
|
|
4
|
-
|
|
5
|
-
? K extends
|
|
6
|
-
? K
|
|
7
|
-
: K extends `${string}color${string}`
|
|
3
|
+
export type ColorKeys<T> =
|
|
4
|
+
KeysOfUnion<T> extends infer K
|
|
5
|
+
? K extends string
|
|
6
|
+
? K extends `${string}Color${string}`
|
|
8
7
|
? K
|
|
9
|
-
:
|
|
8
|
+
: K extends `${string}color${string}`
|
|
9
|
+
? K
|
|
10
|
+
: never
|
|
11
|
+
: never
|
|
10
12
|
: never
|
|
11
|
-
: never
|
|
12
13
|
|
|
13
14
|
export type UseUpdateVariantColorConfig<T extends Record<string, any>> = {
|
|
14
|
-
animateCallback?: (from: string, to: string) => void
|
|
15
|
-
colorKey: ColorKeys<T
|
|
16
|
-
style: T
|
|
15
|
+
animateCallback?: (from: string, to: string) => void
|
|
16
|
+
colorKey: ColorKeys<T>
|
|
17
|
+
style: T
|
|
17
18
|
secretKey: string | undefined
|
|
18
19
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { interpolateColor, useDerivedValue, useSharedValue } from 'react-native-reanimated'
|
|
2
|
+
|
|
2
3
|
import type { ColorKeys } from './types'
|
|
4
|
+
|
|
3
5
|
import { useUpdateVariantColor } from './useUpdateVariantColor'
|
|
4
6
|
|
|
5
7
|
export const useAnimatedVariantColor = <T extends Record<string, any>>(style: T, colorKey: ColorKeys<T>) => {
|
|
6
|
-
const secretKey = Object.keys(style).find(key => key.startsWith('unistyles_'))
|
|
8
|
+
const secretKey = Object.keys(style).find((key) => key.startsWith('unistyles_'))
|
|
7
9
|
// @ts-ignore this is hidden from TS
|
|
8
10
|
const hasVariants = style[secretKey]?.__stylesheetVariants
|
|
9
11
|
|
|
10
12
|
if (!hasVariants || !(colorKey as string).toLowerCase().includes('color')) {
|
|
11
|
-
throw new Error(
|
|
13
|
+
throw new Error(
|
|
14
|
+
'useAnimatedVariantColor: Style was not created by Unistyles, does not have variants or has no color property',
|
|
15
|
+
)
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
const { fromValue, toValue } = useUpdateVariantColor({
|
|
@@ -27,11 +31,7 @@ export const useAnimatedVariantColor = <T extends Record<string, any>>(style: T,
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const derivedColor = useDerivedValue(() => {
|
|
30
|
-
return interpolateColor(
|
|
31
|
-
progress.value,
|
|
32
|
-
[0, 1],
|
|
33
|
-
[fromValue.get(), toValue.get()]
|
|
34
|
-
)
|
|
34
|
+
return interpolateColor(progress.value, [0, 1], [fromValue.get(), toValue.get()])
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
return derivedColor
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect } from 'react'
|
|
2
2
|
import { useSharedValue } from 'react-native-reanimated'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import type { UseUpdateVariantColorConfig } from './types'
|
|
5
5
|
|
|
6
|
+
import { StyleSheet, UnistyleDependency } from '../../specs'
|
|
7
|
+
|
|
6
8
|
export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
7
9
|
colorKey,
|
|
8
10
|
style,
|
|
9
|
-
secretKey
|
|
11
|
+
secretKey,
|
|
10
12
|
}: UseUpdateVariantColorConfig<T>) => {
|
|
11
13
|
const fromValue = useSharedValue<string>(style[colorKey])
|
|
12
14
|
const toValue = useSharedValue<string>(style[colorKey])
|
|
13
15
|
|
|
14
16
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const dispose = StyleSheet.addChangeListener((changedDependencies) => {
|
|
18
|
+
if (
|
|
19
|
+
changedDependencies.includes(UnistyleDependency.Theme) ||
|
|
20
|
+
changedDependencies.includes(UnistyleDependency.Breakpoints)
|
|
21
|
+
) {
|
|
18
22
|
// @ts-ignore
|
|
19
23
|
const newStyles = style[secretKey]?.uni__getStyles()
|
|
20
24
|
|
|
@@ -33,6 +37,6 @@ export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
|
33
37
|
|
|
34
38
|
return {
|
|
35
39
|
fromValue,
|
|
36
|
-
toValue
|
|
40
|
+
toValue,
|
|
37
41
|
}
|
|
38
42
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react'
|
|
2
2
|
import { runOnUI, useSharedValue } from 'react-native-reanimated'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import type { UnistylesValues } from '../../types'
|
|
5
|
+
import type { UseUpdateVariantColorConfig } from './types'
|
|
6
|
+
|
|
7
|
+
import { UnistyleDependency } from '../../specs'
|
|
5
8
|
import { services } from '../../web/services'
|
|
6
9
|
import { getClosestBreakpointValue } from '../../web/utils'
|
|
7
|
-
import type { UseUpdateVariantColorConfig } from './types'
|
|
8
10
|
|
|
9
11
|
export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
10
12
|
animateCallback,
|
|
11
13
|
colorKey,
|
|
12
|
-
style
|
|
14
|
+
style,
|
|
13
15
|
}: UseUpdateVariantColorConfig<T>) => {
|
|
14
16
|
const [dummyDiv] = useState(() => {
|
|
15
17
|
const div = document.createElement('div')
|
|
@@ -22,27 +24,25 @@ export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
|
22
24
|
const parsedStyles = useMemo(() => {
|
|
23
25
|
return services.shadowRegistry.addStyles([style]).parsedStyles
|
|
24
26
|
}, [style])
|
|
25
|
-
const getCurrentColor = useCallback(
|
|
26
|
-
()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const getCurrentColor = useCallback(() => {
|
|
28
|
+
if (!parsedStyles) {
|
|
29
|
+
return 'rgb(0, 0, 0)'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const currentColor = parsedStyles[colorKey as keyof UnistylesValues] as string | Record<string, string>
|
|
33
|
+
const currentColorVar =
|
|
34
|
+
typeof currentColor === 'string'
|
|
33
35
|
? currentColor
|
|
34
|
-
: getClosestBreakpointValue<string>(services.runtime, currentColor) ?? 'rgb(0, 0, 0)'
|
|
36
|
+
: (getClosestBreakpointValue<string>(services.runtime, currentColor) ?? 'rgb(0, 0, 0)')
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
if (currentColorVar.startsWith('var(--')) {
|
|
39
|
+
dummyDiv.style.color = currentColorVar
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
return getComputedStyle(dummyDiv).color
|
|
42
|
+
}
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[style, colorKey]
|
|
45
|
-
)
|
|
44
|
+
return currentColorVar
|
|
45
|
+
}, [style, colorKey])
|
|
46
46
|
const fromValue = useSharedValue<string>(getCurrentColor())
|
|
47
47
|
const toValue = useSharedValue<string>(getCurrentColor())
|
|
48
48
|
|
|
@@ -76,6 +76,6 @@ export const useUpdateVariantColor = <T extends Record<string, any>>({
|
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
78
|
fromValue,
|
|
79
|
-
toValue
|
|
79
|
+
toValue,
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet } from 'react-native'
|
|
3
|
+
|
|
3
4
|
import * as unistyles from '../web/services'
|
|
4
5
|
import { error, isServer } from '../web/utils'
|
|
5
6
|
import { serialize } from './serialize'
|
|
6
7
|
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
|
|
7
8
|
|
|
8
|
-
export const getServerUnistyles = ({
|
|
9
|
+
export const getServerUnistyles = ({
|
|
10
|
+
includeRNWStyles = true,
|
|
11
|
+
}: ServerUnistylesSettings = DefaultServerUnistylesSettings) => {
|
|
9
12
|
if (!isServer()) {
|
|
10
13
|
throw error('Server styles should only be read on the server')
|
|
11
14
|
}
|
|
@@ -17,10 +20,14 @@ export const getServerUnistyles = ({ includeRNWStyles = true }: ServerUnistylesS
|
|
|
17
20
|
|
|
18
21
|
return (
|
|
19
22
|
<>
|
|
20
|
-
{rnwStyle && <style id=
|
|
21
|
-
<style id=
|
|
23
|
+
{rnwStyle && <style id="rnw-style">{rnwStyle}</style>}
|
|
24
|
+
<style id="unistyles-web">{css}</style>
|
|
22
25
|
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Needs the json quotes to be unescaped */}
|
|
23
|
-
<script
|
|
26
|
+
<script
|
|
27
|
+
id="unistyles-script"
|
|
28
|
+
defer
|
|
29
|
+
dangerouslySetInnerHTML={{ __html: `window.__UNISTYLES_STATE__ = ${serialize(state)}` }}
|
|
30
|
+
/>
|
|
24
31
|
</>
|
|
25
32
|
)
|
|
26
33
|
}
|
package/src/server/index.ts
CHANGED
package/src/server/types.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { useRef } from 'react'
|
|
2
|
+
|
|
2
3
|
import { isServer } from '../web/utils'
|
|
3
4
|
import { getServerUnistyles } from './getServerUnistyles'
|
|
4
5
|
import { hydrateServerUnistyles } from './hydrateServerUnistyles'
|
|
5
6
|
import { resetServerUnistyles } from './resetServerUnistyles'
|
|
6
7
|
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
|
|
7
8
|
|
|
8
|
-
export const useServerUnistyles = (
|
|
9
|
+
export const useServerUnistyles = (
|
|
10
|
+
settings: ServerUnistylesSettings = DefaultServerUnistylesSettings,
|
|
11
|
+
): React.ReactNode | null => {
|
|
9
12
|
const isServerInserted = useRef(false)
|
|
10
13
|
|
|
11
14
|
if (isServer() && !isServerInserted.current) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
|
|
2
3
|
import type { Dimensions, Insets } from '../types'
|
|
3
4
|
|
|
4
5
|
type ColorScheme = 'dark' | 'light' | 'unspecified'
|
|
@@ -20,45 +21,47 @@ export enum UnistyleDependency {
|
|
|
20
21
|
StatusBar = 12,
|
|
21
22
|
NavigationBar = 13,
|
|
22
23
|
Ime = 14,
|
|
23
|
-
Rtl = 15
|
|
24
|
+
Rtl = 15,
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface UnistylesNativeMiniRuntime {
|
|
27
|
-
readonly colorScheme: ColorScheme
|
|
28
|
-
readonly screen: Dimensions
|
|
29
|
-
readonly contentSizeCategory: string
|
|
30
|
-
readonly insets: Insets
|
|
31
|
-
readonly pixelRatio: number
|
|
32
|
-
readonly fontScale: number
|
|
28
|
+
readonly colorScheme: ColorScheme
|
|
29
|
+
readonly screen: Dimensions
|
|
30
|
+
readonly contentSizeCategory: string
|
|
31
|
+
readonly insets: Insets
|
|
32
|
+
readonly pixelRatio: number
|
|
33
|
+
readonly fontScale: number
|
|
33
34
|
readonly rtl: boolean
|
|
34
|
-
readonly statusBar: Dimensions
|
|
35
|
+
readonly statusBar: Dimensions
|
|
35
36
|
readonly navigationBar: Dimensions
|
|
36
|
-
readonly isPortrait: boolean
|
|
37
|
+
readonly isPortrait: boolean
|
|
37
38
|
readonly isLandscape: boolean
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
// represents any native API that can communicate with Unistyles
|
|
41
42
|
// not available from JS
|
|
42
|
-
export interface NativePlatform extends HybridObject<{ ios: 'swift'
|
|
43
|
-
getInsets(): Insets
|
|
44
|
-
getColorScheme(): ColorScheme
|
|
45
|
-
getFontScale(): number
|
|
46
|
-
getPixelRatio(): number
|
|
47
|
-
getOrientation(): Orientation
|
|
48
|
-
getContentSizeCategory(): string
|
|
49
|
-
getScreenDimensions(): Dimensions
|
|
50
|
-
getStatusBarDimensions(): Dimensions
|
|
51
|
-
getNavigationBarDimensions(): Dimensions
|
|
52
|
-
getPrefersRtlDirection(): boolean
|
|
43
|
+
export interface NativePlatform extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
|
|
44
|
+
getInsets(): Insets
|
|
45
|
+
getColorScheme(): ColorScheme
|
|
46
|
+
getFontScale(): number
|
|
47
|
+
getPixelRatio(): number
|
|
48
|
+
getOrientation(): Orientation
|
|
49
|
+
getContentSizeCategory(): string
|
|
50
|
+
getScreenDimensions(): Dimensions
|
|
51
|
+
getStatusBarDimensions(): Dimensions
|
|
52
|
+
getNavigationBarDimensions(): Dimensions
|
|
53
|
+
getPrefersRtlDirection(): boolean
|
|
53
54
|
|
|
54
|
-
setRootViewBackgroundColor(color: number): void
|
|
55
|
-
setNavigationBarHidden?(isHidden: boolean): void
|
|
56
|
-
setStatusBarHidden(isHidden: boolean): void
|
|
57
|
-
setImmersiveMode(isEnabled: boolean): void
|
|
55
|
+
setRootViewBackgroundColor(color: number): void
|
|
56
|
+
setNavigationBarHidden?(isHidden: boolean): void
|
|
57
|
+
setStatusBarHidden(isHidden: boolean): void
|
|
58
|
+
setImmersiveMode(isEnabled: boolean): void
|
|
58
59
|
|
|
59
60
|
// private
|
|
60
|
-
getMiniRuntime(): UnistylesNativeMiniRuntime
|
|
61
|
-
registerPlatformListener(
|
|
62
|
-
|
|
61
|
+
getMiniRuntime(): UnistylesNativeMiniRuntime
|
|
62
|
+
registerPlatformListener(
|
|
63
|
+
callback: (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) => void,
|
|
64
|
+
): void
|
|
65
|
+
registerImeListener(callback: (miniRuntime: UnistylesNativeMiniRuntime) => void): void
|
|
63
66
|
unregisterPlatformListeners(): void
|
|
64
67
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
2
|
|
|
3
3
|
// created from UnistylesRuntime, do not use it directly
|
|
4
|
-
export interface UnistylesNavigationBar extends HybridObject<{ ios: 'c++'
|
|
5
|
-
readonly width: number
|
|
6
|
-
readonly height: number
|
|
4
|
+
export interface UnistylesNavigationBar extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
5
|
+
readonly width: number
|
|
6
|
+
readonly height: number
|
|
7
7
|
|
|
8
8
|
setHidden(isHidden: boolean): void
|
|
9
9
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { NitroModules } from 'react-native-nitro-modules'
|
|
2
|
+
|
|
2
3
|
import type { UnistylesShadowRegistry as UnistylesShadowRegistrySpec } from './ShadowRegistry.nitro'
|
|
3
4
|
import type { ShadowNode, Unistyle, ViewHandle } from './types'
|
|
4
5
|
|
|
5
6
|
interface ShadowRegistry extends UnistylesShadowRegistrySpec {
|
|
6
7
|
// Babel API
|
|
7
|
-
add(handle?: ViewHandle, styles?: Array<Unistyle>): void
|
|
8
|
-
remove(handle?: ViewHandle): void
|
|
8
|
+
add(handle?: ViewHandle, styles?: Array<Unistyle>): void
|
|
9
|
+
remove(handle?: ViewHandle): void
|
|
9
10
|
// JSI
|
|
10
|
-
link(node: ShadowNode, styles?: Array<Unistyle>): void
|
|
11
|
-
unlink(node: ShadowNode): void
|
|
12
|
-
flush(): void
|
|
13
|
-
setScopedTheme(themeName?: string): void
|
|
11
|
+
link(node: ShadowNode, styles?: Array<Unistyle>): void
|
|
12
|
+
unlink(node: ShadowNode): void
|
|
13
|
+
flush(): void
|
|
14
|
+
setScopedTheme(themeName?: string): void
|
|
14
15
|
getScopedTheme(): string | undefined
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const HybridShadowRegistry = NitroModules.createHybridObject<ShadowRegistry>('UnistylesShadowRegistry')
|
|
18
19
|
|
|
19
20
|
const findShadowNodeForHandle = (handle: ViewHandle) => {
|
|
20
|
-
const node =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const node =
|
|
22
|
+
handle?.__internalInstanceHandle?.stateNode?.node ??
|
|
23
|
+
handle?.getScrollResponder?.()?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node ??
|
|
24
|
+
handle?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node ??
|
|
25
|
+
handle?._viewRef?.__internalInstanceHandle?.stateNode?.node ??
|
|
26
|
+
handle?.viewRef?.current?.__internalInstanceHandle?.stateNode?.node ??
|
|
27
|
+
handle?._nativeRef?.__internalInstanceHandle?.stateNode?.node
|
|
26
28
|
|
|
27
29
|
// @ts-ignore we don't know the type of handle
|
|
28
30
|
if (!node && handle?.props?.horizontal && handle?.constructor?.name === 'FlatList') {
|
|
29
|
-
throw new Error(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!node) {
|
|
33
|
-
throw new Error(`Unistyles: Could not find shadow node for one of your components of type ${handle?.constructor?.name ?? 'unknown'}`)
|
|
31
|
+
throw new Error(
|
|
32
|
+
'Unistyles: detected an unsupported FlatList with the horizontal prop. This will cause crashes on Android due to a bug in React Native core. Read more: https://github.com/facebook/react-native/issues/51601',
|
|
33
|
+
)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return node
|
|
@@ -42,33 +42,39 @@ HybridShadowRegistry.add = (handle, styles) => {
|
|
|
42
42
|
return
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const stylesArray = Array.isArray(styles)
|
|
46
|
-
? styles.flat()
|
|
47
|
-
: [styles]
|
|
45
|
+
const stylesArray = Array.isArray(styles) ? styles.flat() : [styles]
|
|
48
46
|
|
|
49
47
|
// filter styles that are undefined or with no keys
|
|
50
48
|
const filteredStyles = stylesArray
|
|
51
|
-
.filter(style => style && Object.keys(style).length > 0)
|
|
49
|
+
.filter((style) => style && Object.keys(style).length > 0)
|
|
52
50
|
.flat()
|
|
53
51
|
.filter(Boolean)
|
|
54
52
|
|
|
55
53
|
if (filteredStyles.length > 0) {
|
|
56
|
-
|
|
54
|
+
const node = findShadowNodeForHandle(handle)
|
|
55
|
+
|
|
56
|
+
if (!node) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`Unistyles: Could not find shadow node for one of your components of type ${handle?.constructor?.name ?? 'unknown'}`,
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
HybridShadowRegistry.link(node, filteredStyles)
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
|
|
60
|
-
HybridShadowRegistry.remove = handle => {
|
|
66
|
+
HybridShadowRegistry.remove = (handle) => {
|
|
61
67
|
if (!handle) {
|
|
62
68
|
return
|
|
63
69
|
}
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
const maybeNode = findShadowNodeForHandle(handle)
|
|
72
|
+
|
|
73
|
+
if (maybeNode) {
|
|
74
|
+
HybridShadowRegistry.unlink(maybeNode)
|
|
75
|
+
}
|
|
66
76
|
}
|
|
67
77
|
|
|
68
|
-
type PrivateMethods =
|
|
69
|
-
| 'add'
|
|
70
|
-
| 'remove'
|
|
71
|
-
| 'link'
|
|
72
|
-
| 'unlink'
|
|
78
|
+
type PrivateMethods = 'add' | 'remove' | 'link' | 'unlink'
|
|
73
79
|
|
|
74
80
|
export const UnistylesShadowRegistry = HybridShadowRegistry as Omit<ShadowRegistry, PrivateMethods>
|
|
@@ -8,33 +8,33 @@ export type ShadowNode = {
|
|
|
8
8
|
|
|
9
9
|
export type ViewHandle = {
|
|
10
10
|
__internalInstanceHandle?: {
|
|
11
|
-
stateNode?: StateNode
|
|
11
|
+
stateNode?: StateNode
|
|
12
12
|
elementType?: string
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
getScrollResponder?: () => {
|
|
15
|
-
getNativeScrollRef?: () =>
|
|
15
|
+
getNativeScrollRef?: () => {
|
|
16
16
|
__internalInstanceHandle?: {
|
|
17
17
|
stateNode?: StateNode
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
getNativeScrollRef?: () =>
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
getNativeScrollRef?: () => {
|
|
22
22
|
__internalInstanceHandle?: {
|
|
23
23
|
stateNode?: StateNode
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
_viewRef?: {
|
|
27
27
|
__internalInstanceHandle?: {
|
|
28
28
|
stateNode?: StateNode
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
viewRef?: {
|
|
32
32
|
current?: {
|
|
33
33
|
__internalInstanceHandle?: {
|
|
34
34
|
stateNode?: StateNode
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
_nativeRef?: {
|
|
39
39
|
__internalInstanceHandle?: {
|
|
40
40
|
stateNode?: StateNode
|
|
@@ -43,7 +43,6 @@ export type ViewHandle = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export type Unistyle = {
|
|
46
|
-
__unid?: number,
|
|
47
46
|
initial?: {
|
|
48
47
|
updater?: () => void
|
|
49
48
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
2
|
|
|
3
3
|
// created from UnistylesRuntime, do not use it directly
|
|
4
|
-
export interface UnistylesStatusBar extends HybridObject<{ ios: 'c++'
|
|
5
|
-
readonly width: number
|
|
6
|
-
readonly height: number
|
|
4
|
+
export interface UnistylesStatusBar extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
5
|
+
readonly width: number
|
|
6
|
+
readonly height: number
|
|
7
7
|
|
|
8
|
-
setHiddenNative(isHidden: boolean): void
|
|
8
|
+
setHiddenNative(isHidden: boolean): void
|
|
9
9
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { StatusBar as NativeStatusBar } from 'react-native'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import type { UnistylesStatusBar as UnistylesStatusBarSpec } from './UnistylesStatusBar.nitro'
|
|
4
4
|
|
|
5
|
+
import { StatusBarStyle } from '../types'
|
|
6
|
+
|
|
5
7
|
export type StatusBarHiddenAnimation = 'none' | 'fade' | 'slide'
|
|
6
8
|
|
|
7
9
|
interface PrivateUnistylesStatusBar extends Omit<UnistylesStatusBarSpec, 'setBackgroundColor' | 'setHidden'> {
|
|
8
|
-
setStyle(style: StatusBarStyle, animated?: boolean): void
|
|
10
|
+
setStyle(style: StatusBarStyle, animated?: boolean): void
|
|
9
11
|
setHidden(isHidden: boolean, animation?: StatusBarHiddenAnimation): void
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -29,8 +31,6 @@ export const attachStatusBarJSMethods = (hybridObject: UnistylesStatusBar) => {
|
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
type PrivateMethods =
|
|
33
|
-
| 'dispose'
|
|
34
|
-
| 'setHiddenNative'
|
|
34
|
+
type PrivateMethods = 'dispose' | 'setHiddenNative'
|
|
35
35
|
|
|
36
36
|
export type UnistylesStatusBar = Omit<PrivateUnistylesStatusBar, PrivateMethods>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
|
|
2
3
|
import type { UnistyleDependency } from '../NativePlatform'
|
|
3
4
|
|
|
4
|
-
export interface UnistylesStyleSheet extends HybridObject<{ ios: 'c++'
|
|
5
|
+
export interface UnistylesStyleSheet extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
5
6
|
readonly hairlineWidth: number
|
|
6
|
-
readonly unid: number
|
|
7
7
|
|
|
8
8
|
addChangeListener(onChanged: (dependencies: Array<UnistyleDependency>) => void): () => void
|
|
9
9
|
}
|