react-native-unistyles 3.0.24 → 3.1.1
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 +7 -6
- 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/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,7 +1,10 @@
|
|
|
1
|
-
import React, { useLayoutEffect } from 'react'
|
|
2
1
|
import type { PropsWithChildren } from 'react'
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
import React, { useLayoutEffect } from 'react'
|
|
4
|
+
|
|
4
5
|
import type { UnistylesThemes } from '../global'
|
|
6
|
+
|
|
7
|
+
import { useUnistyles } from '../core'
|
|
5
8
|
import { UnistylesShadowRegistry } from '../specs'
|
|
6
9
|
import { ApplyScopedTheme } from './ApplyScopedTheme'
|
|
7
10
|
|
|
@@ -9,16 +12,13 @@ interface AdaptiveThemeProps extends PropsWithChildren {
|
|
|
9
12
|
previousScopedTheme?: string
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
export const AdaptiveTheme: React.FunctionComponent<AdaptiveThemeProps> = ({
|
|
13
|
-
children,
|
|
14
|
-
previousScopedTheme
|
|
15
|
-
}) => {
|
|
15
|
+
export const AdaptiveTheme: React.FunctionComponent<AdaptiveThemeProps> = ({ children, previousScopedTheme }) => {
|
|
16
16
|
const { rt } = useUnistyles()
|
|
17
17
|
const name = (rt.colorScheme === 'dark' ? 'light' : 'dark') as keyof UnistylesThemes
|
|
18
18
|
const mappedChildren = [
|
|
19
19
|
<ApplyScopedTheme key={name} name={name} />,
|
|
20
20
|
children,
|
|
21
|
-
<ApplyScopedTheme key=
|
|
21
|
+
<ApplyScopedTheme key="dispose" name={previousScopedTheme as keyof UnistylesThemes | undefined} />,
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
useLayoutEffect(() => {
|
|
@@ -26,9 +26,5 @@ export const AdaptiveTheme: React.FunctionComponent<AdaptiveThemeProps> = ({
|
|
|
26
26
|
UnistylesShadowRegistry.flush()
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
return
|
|
30
|
-
<React.Fragment key={name}>
|
|
31
|
-
{mappedChildren}
|
|
32
|
-
</React.Fragment>
|
|
33
|
-
)
|
|
29
|
+
return <React.Fragment key={name}>{mappedChildren}</React.Fragment>
|
|
34
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react'
|
|
2
|
+
|
|
2
3
|
import { useMedia } from '../hooks'
|
|
3
4
|
|
|
4
5
|
type DisplayProps = { mq: symbol } & PropsWithChildren
|
|
@@ -6,7 +7,5 @@ type DisplayProps = { mq: symbol } & PropsWithChildren
|
|
|
6
7
|
export const Display: React.FunctionComponent<DisplayProps> = ({ children, ...props }) => {
|
|
7
8
|
const { isVisible } = useMedia(props)
|
|
8
9
|
|
|
9
|
-
return isVisible
|
|
10
|
-
? children
|
|
11
|
-
: null
|
|
10
|
+
return isVisible ? children : null
|
|
12
11
|
}
|
package/src/components/Hide.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react'
|
|
2
|
+
|
|
2
3
|
import { useMedia } from '../hooks'
|
|
3
4
|
|
|
4
5
|
type HideProps = { mq: symbol } & PropsWithChildren
|
|
@@ -6,7 +7,5 @@ type HideProps = { mq: symbol } & PropsWithChildren
|
|
|
6
7
|
export const Hide: React.FunctionComponent<HideProps> = ({ children, ...props }) => {
|
|
7
8
|
const { isVisible } = useMedia(props)
|
|
8
9
|
|
|
9
|
-
return !isVisible
|
|
10
|
-
? children
|
|
11
|
-
: null
|
|
10
|
+
return !isVisible ? children : null
|
|
12
11
|
}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import React, { useLayoutEffect } from 'react'
|
|
2
1
|
import type { PropsWithChildren } from 'react'
|
|
2
|
+
|
|
3
|
+
import React, { useLayoutEffect } from 'react'
|
|
4
|
+
|
|
3
5
|
import type { UnistylesThemes } from '../global'
|
|
6
|
+
|
|
4
7
|
import { UnistylesShadowRegistry } from '../specs'
|
|
5
8
|
import { ApplyScopedTheme } from './ApplyScopedTheme'
|
|
6
9
|
|
|
7
10
|
interface NamedThemeProps extends PropsWithChildren {
|
|
8
|
-
name: keyof UnistylesThemes | undefined
|
|
11
|
+
name: keyof UnistylesThemes | undefined
|
|
9
12
|
previousScopedTheme?: string
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
export const NamedTheme: React.FunctionComponent<NamedThemeProps> = ({
|
|
13
|
-
name,
|
|
14
|
-
children,
|
|
15
|
-
previousScopedTheme
|
|
16
|
-
}) => {
|
|
15
|
+
export const NamedTheme: React.FunctionComponent<NamedThemeProps> = ({ name, children, previousScopedTheme }) => {
|
|
17
16
|
const mappedChildren = [
|
|
18
|
-
<ApplyScopedTheme key=
|
|
17
|
+
<ApplyScopedTheme key="apply" name={name} />,
|
|
19
18
|
children,
|
|
20
|
-
<ApplyScopedTheme key=
|
|
19
|
+
<ApplyScopedTheme key="dispose" name={previousScopedTheme as keyof UnistylesThemes | undefined} />,
|
|
21
20
|
]
|
|
22
21
|
|
|
23
22
|
useLayoutEffect(() => {
|
|
@@ -25,9 +24,5 @@ export const NamedTheme: React.FunctionComponent<NamedThemeProps> = ({
|
|
|
25
24
|
UnistylesShadowRegistry.flush()
|
|
26
25
|
})
|
|
27
26
|
|
|
28
|
-
return
|
|
29
|
-
<React.Fragment>
|
|
30
|
-
{mappedChildren}
|
|
31
|
-
</React.Fragment>
|
|
32
|
-
)
|
|
27
|
+
return <React.Fragment>{mappedChildren}</React.Fragment>
|
|
33
28
|
}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
|
|
2
3
|
import type { UnistylesThemes } from '../global'
|
|
4
|
+
|
|
3
5
|
import { UnistylesRuntime, UnistylesShadowRegistry } from '../specs'
|
|
4
6
|
import { AdaptiveTheme } from './AdaptiveTheme'
|
|
5
7
|
import { NamedTheme } from './NamedTheme'
|
|
6
8
|
|
|
7
|
-
type ThemeProps =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
type ThemeProps =
|
|
10
|
+
| {
|
|
11
|
+
name: keyof UnistylesThemes
|
|
12
|
+
invertedAdaptive?: never
|
|
13
|
+
reset?: never
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
name?: never
|
|
17
|
+
invertedAdaptive: boolean
|
|
18
|
+
reset?: never
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
name?: never
|
|
22
|
+
invertedAdaptive?: never
|
|
23
|
+
reset: boolean
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
export const ScopedTheme: React.FunctionComponent<React.PropsWithChildren<ThemeProps>> = ({
|
|
22
27
|
name,
|
|
23
28
|
children,
|
|
24
29
|
invertedAdaptive,
|
|
25
|
-
reset
|
|
30
|
+
reset,
|
|
26
31
|
}) => {
|
|
27
32
|
const hasAdaptiveThemes = UnistylesRuntime.hasAdaptiveThemes
|
|
28
33
|
const isAdaptiveTheme = invertedAdaptive && hasAdaptiveThemes
|
|
@@ -31,25 +36,15 @@ export const ScopedTheme: React.FunctionComponent<React.PropsWithChildren<ThemeP
|
|
|
31
36
|
switch (true) {
|
|
32
37
|
case name !== undefined:
|
|
33
38
|
return (
|
|
34
|
-
<NamedTheme
|
|
35
|
-
name={name as keyof UnistylesThemes}
|
|
36
|
-
previousScopedTheme={previousScopedTheme}
|
|
37
|
-
>
|
|
39
|
+
<NamedTheme name={name as keyof UnistylesThemes} previousScopedTheme={previousScopedTheme}>
|
|
38
40
|
{children}
|
|
39
41
|
</NamedTheme>
|
|
40
42
|
)
|
|
41
43
|
case isAdaptiveTheme:
|
|
42
|
-
return
|
|
43
|
-
<AdaptiveTheme previousScopedTheme={previousScopedTheme}>
|
|
44
|
-
{children}
|
|
45
|
-
</AdaptiveTheme>
|
|
46
|
-
)
|
|
44
|
+
return <AdaptiveTheme previousScopedTheme={previousScopedTheme}>{children}</AdaptiveTheme>
|
|
47
45
|
case reset:
|
|
48
46
|
return (
|
|
49
|
-
<NamedTheme
|
|
50
|
-
name={undefined}
|
|
51
|
-
previousScopedTheme={previousScopedTheme}
|
|
52
|
-
>
|
|
47
|
+
<NamedTheme name={undefined} previousScopedTheme={previousScopedTheme}>
|
|
53
48
|
{children}
|
|
54
49
|
</NamedTheme>
|
|
55
50
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Animated as RNAnimated } from 'react-native'
|
|
2
|
+
|
|
2
3
|
import { FlatList } from './FlatList'
|
|
3
4
|
import { Image } from './Image'
|
|
4
5
|
import { ScrollView } from './ScrollView'
|
|
@@ -13,5 +14,5 @@ export const Animated = {
|
|
|
13
14
|
FlatList: RNAnimated.createAnimatedComponent(FlatList),
|
|
14
15
|
Image: RNAnimated.createAnimatedComponent(Image),
|
|
15
16
|
ScrollView: RNAnimated.createAnimatedComponent(ScrollView),
|
|
16
|
-
SectionList: RNAnimated.createAnimatedComponent(SectionList)
|
|
17
|
+
SectionList: RNAnimated.createAnimatedComponent(SectionList),
|
|
17
18
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { type ComponentProps, forwardRef } from 'react'
|
|
2
2
|
import { type ImageStyle, Image as NativeImage, type StyleProp, type ViewStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import type { UnistylesValues } from '../../types'
|
|
5
|
+
|
|
3
6
|
import { getClassName } from '../../core'
|
|
4
7
|
import { maybeWarnAboutMultipleUnistyles } from '../../core/warn'
|
|
5
|
-
import type { UnistylesValues } from '../../types'
|
|
6
8
|
import { copyComponentProperties } from '../../utils'
|
|
7
9
|
import { checkForProp } from '../../web/utils'
|
|
8
10
|
import { createUnistylesRef } from '../../web/utils/createUnistylesRef'
|
|
@@ -23,12 +25,14 @@ const UnistylesImage = forwardRef<unknown, Props>((props, forwardedRef) => {
|
|
|
23
25
|
return (
|
|
24
26
|
<NativeImage
|
|
25
27
|
{...props}
|
|
26
|
-
style={
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
style={
|
|
29
|
+
[
|
|
30
|
+
classNames,
|
|
31
|
+
// Clear inline width and height extracted from source
|
|
32
|
+
hasWidthStyle && { width: '' },
|
|
33
|
+
hasHeightStyle && { height: '' },
|
|
34
|
+
] as StyleProp<ImageStyle>
|
|
35
|
+
}
|
|
32
36
|
ref={ref}
|
|
33
37
|
/>
|
|
34
38
|
)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { forwardRef } from 'react'
|
|
3
3
|
import { type ImageStyle, ImageBackground as NativeImageBackground, type StyleProp, type ViewStyle } from 'react-native'
|
|
4
|
+
|
|
5
|
+
import type { UnistylesValues } from '../../types'
|
|
6
|
+
|
|
4
7
|
import { getClassName } from '../../core'
|
|
5
8
|
import { maybeWarnAboutMultipleUnistyles } from '../../core/warn'
|
|
6
|
-
import type { UnistylesValues } from '../../types'
|
|
7
9
|
import { copyComponentProperties } from '../../utils'
|
|
8
10
|
import { keyInObject } from '../../web/utils'
|
|
9
11
|
import { createUnistylesRef } from '../../web/utils/createUnistylesRef'
|
|
@@ -28,12 +30,14 @@ const UnistylesImageBackground = forwardRef<unknown, Props>((props, forwardedRef
|
|
|
28
30
|
<NativeImageBackground
|
|
29
31
|
{...props}
|
|
30
32
|
style={styleClassNames as StyleProp<ViewStyle>}
|
|
31
|
-
imageStyle={
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
imageStyle={
|
|
34
|
+
[
|
|
35
|
+
imageClassNames,
|
|
36
|
+
// Clear inline width and height extracted from source
|
|
37
|
+
hasWidthStyle && { width: '' },
|
|
38
|
+
hasHeightStyle && { height: '' },
|
|
39
|
+
] as StyleProp<ImageStyle>
|
|
40
|
+
}
|
|
37
41
|
ref={ref}
|
|
38
42
|
imageRef={imageRef}
|
|
39
43
|
/>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type ComponentType, createElement, forwardRef } from 'react'
|
|
2
1
|
import type { TextProps } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import { type ComponentType, createElement, forwardRef } from 'react'
|
|
4
|
+
|
|
3
5
|
import { createUnistylesElement } from '../../core'
|
|
4
6
|
|
|
5
7
|
// credits to @hirbod
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type ComponentType, createElement, forwardRef } from 'react'
|
|
2
1
|
import type { ViewProps } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import { type ComponentType, createElement, forwardRef } from 'react'
|
|
4
|
+
|
|
3
5
|
import { createUnistylesElement } from '../../core'
|
|
4
6
|
|
|
5
7
|
// credits to @hirbod
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { PressableProps as Props, View } from 'react-native'
|
|
2
|
+
|
|
1
3
|
import React, { forwardRef, useLayoutEffect, useRef } from 'react'
|
|
2
4
|
import { Pressable as NativePressableReactNative } from 'react-native'
|
|
3
|
-
|
|
5
|
+
|
|
4
6
|
import { passForwardedRef } from '../../core'
|
|
5
7
|
import { UnistylesShadowRegistry } from '../../specs'
|
|
6
8
|
|
|
@@ -9,9 +11,7 @@ type PressableProps = Props & {
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const getStyles = (styleProps: Record<string, any> = {}) => {
|
|
12
|
-
const unistyleKey = Object
|
|
13
|
-
.keys(styleProps)
|
|
14
|
-
.find(key => key.startsWith('unistyles_'))
|
|
14
|
+
const unistyleKey = Object.keys(styleProps).find((key) => key.startsWith('unistyles_'))
|
|
15
15
|
|
|
16
16
|
if (!unistyleKey) {
|
|
17
17
|
return styleProps
|
|
@@ -20,7 +20,7 @@ const getStyles = (styleProps: Record<string, any> = {}) => {
|
|
|
20
20
|
return {
|
|
21
21
|
// styles without C++ state
|
|
22
22
|
...styleProps[unistyleKey].uni__getStyles(),
|
|
23
|
-
[unistyleKey]: styleProps[unistyleKey]
|
|
23
|
+
[unistyleKey]: styleProps[unistyleKey],
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -40,7 +40,7 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
|
40
40
|
return (
|
|
41
41
|
<NativePressableReactNative
|
|
42
42
|
{...props}
|
|
43
|
-
ref={ref => {
|
|
43
|
+
ref={(ref) => {
|
|
44
44
|
const isPropStyleAFunction = typeof style === 'function'
|
|
45
45
|
const unistyles = isPropStyleAFunction
|
|
46
46
|
? style.call(style, { pressed: false })
|
|
@@ -60,10 +60,10 @@ export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ..
|
|
|
60
60
|
() => {
|
|
61
61
|
// @ts-expect-error - this is hidden from TS
|
|
62
62
|
UnistylesShadowRegistry.remove(ref)
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
64
|
)
|
|
65
65
|
}}
|
|
66
|
-
style={state => {
|
|
66
|
+
style={(state) => {
|
|
67
67
|
const isPropStyleAFunction = typeof style === 'function'
|
|
68
68
|
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
|
69
69
|
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import type { PressableProps as Props, View } from 'react-native'
|
|
2
|
+
|
|
1
3
|
import React, { forwardRef } from 'react'
|
|
2
4
|
import { Pressable as NativePressableReactNative } from 'react-native'
|
|
3
|
-
|
|
5
|
+
|
|
6
|
+
import type { UnistylesValues } from '../../types'
|
|
7
|
+
|
|
4
8
|
import { getClassName } from '../../core'
|
|
5
9
|
import { UnistylesShadowRegistry } from '../../specs'
|
|
6
|
-
import type { UnistylesValues } from '../../types'
|
|
7
10
|
import { isServer } from '../../web/utils'
|
|
8
11
|
|
|
9
12
|
type Variants = Record<string, string | boolean | undefined>
|
|
10
13
|
type WebPressableState = {
|
|
11
|
-
pressed: boolean
|
|
12
|
-
hovered: boolean
|
|
14
|
+
pressed: boolean
|
|
15
|
+
hovered: boolean
|
|
13
16
|
focused: boolean
|
|
14
17
|
}
|
|
15
18
|
|
|
@@ -17,7 +20,7 @@ type WebPressableStyle = ((state: WebPressableState) => UnistylesValues) | Unist
|
|
|
17
20
|
|
|
18
21
|
type PressableProps = Props & {
|
|
19
22
|
variants?: Variants
|
|
20
|
-
style?: WebPressableStyle
|
|
23
|
+
style?: WebPressableStyle
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export const Pressable = forwardRef<View, PressableProps>(({ style, ...props }, forwardedRef) => {
|
|
@@ -28,23 +31,25 @@ export const Pressable = forwardRef<View, PressableProps>(({ style, ...props },
|
|
|
28
31
|
return (
|
|
29
32
|
<NativePressableReactNative
|
|
30
33
|
{...props}
|
|
31
|
-
ref={
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
ref={
|
|
35
|
+
isServer()
|
|
36
|
+
? undefined
|
|
37
|
+
: (ref) => {
|
|
38
|
+
storedRef = ref as unknown as HTMLElement
|
|
39
|
+
// @ts-expect-error hidden from TS
|
|
40
|
+
UnistylesShadowRegistry.add(storedRef, classNames?.hash)
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
if (typeof forwardedRef === 'function') {
|
|
43
|
+
return forwardedRef(ref)
|
|
44
|
+
}
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
: style
|
|
46
|
+
if (forwardedRef) {
|
|
47
|
+
forwardedRef.current = ref
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
style={(state) => {
|
|
52
|
+
const styleResult = typeof style === 'function' ? style(state as WebPressableState) : style
|
|
48
53
|
const previousScopedTheme = UnistylesShadowRegistry.getScopedTheme()
|
|
49
54
|
|
|
50
55
|
UnistylesShadowRegistry.setScopedTheme(scopedTheme)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React, { useRef } from 'react'
|
|
2
1
|
import type { ScrollView } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import React, { useRef } from 'react'
|
|
4
|
+
|
|
3
5
|
import { UnistylesShadowRegistry } from '../specs'
|
|
4
6
|
import { copyComponentProperties } from '../utils'
|
|
5
7
|
import { passForwardedRef } from './passForwardRef'
|
|
@@ -41,7 +43,7 @@ export const createUnistylesElement = (Component: any) => {
|
|
|
41
43
|
() => {
|
|
42
44
|
// @ts-ignore this is hidden from TS
|
|
43
45
|
UnistylesShadowRegistry.remove(ref)
|
|
44
|
-
}
|
|
46
|
+
},
|
|
45
47
|
)
|
|
46
48
|
}}
|
|
47
49
|
/>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import type { ViewStyle } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
3
5
|
import type { UnistylesValues } from '../types'
|
|
6
|
+
|
|
4
7
|
import { copyComponentProperties } from '../utils'
|
|
5
8
|
import { isServer } from '../web/utils'
|
|
6
9
|
import { createUnistylesRef } from '../web/utils/createUnistylesRef'
|
|
@@ -9,40 +12,34 @@ import { maybeWarnAboutMultipleUnistyles } from './warn'
|
|
|
9
12
|
|
|
10
13
|
const STYLE_PROPS = ['contentContainerStyle', 'columnWrapperStyle'] as const
|
|
11
14
|
|
|
12
|
-
type StyleProp = typeof STYLE_PROPS[number] | 'style'
|
|
15
|
+
type StyleProp = (typeof STYLE_PROPS)[number] | 'style'
|
|
13
16
|
|
|
14
17
|
type ComponentProps = {
|
|
15
18
|
[K in StyleProp]?: UnistylesValues
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
const buildUnistylesProps = (Component: any, props: ComponentProps, forwardedRef: React.ForwardedRef<unknown>) => {
|
|
19
|
-
const componentStyleProps = ['style' as const, ...STYLE_PROPS.filter(styleProp => styleProp in props)]
|
|
20
|
-
const classNames = Object.fromEntries(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
22
|
+
const componentStyleProps = ['style' as const, ...STYLE_PROPS.filter((styleProp) => styleProp in props)]
|
|
23
|
+
const classNames = Object.fromEntries(
|
|
24
|
+
componentStyleProps.map((styleProp) => [styleProp, getClassName(props[styleProp])]),
|
|
25
|
+
)
|
|
26
|
+
const refs = componentStyleProps.map((styleProp) => {
|
|
27
|
+
return createUnistylesRef(classNames[styleProp], styleProp === 'style' ? forwardedRef : undefined)
|
|
26
28
|
})
|
|
27
29
|
|
|
28
|
-
componentStyleProps.forEach(styleProp => {
|
|
30
|
+
componentStyleProps.forEach((styleProp) => {
|
|
29
31
|
maybeWarnAboutMultipleUnistyles(props[styleProp] as ViewStyle, Component.displayName)
|
|
30
32
|
})
|
|
31
33
|
|
|
32
34
|
return {
|
|
33
35
|
...classNames,
|
|
34
|
-
ref: isServer() ? undefined : (componentRef: any) => refs.forEach(ref => ref?.(componentRef))
|
|
36
|
+
ref: isServer() ? undefined : (componentRef: any) => refs.forEach((ref) => ref?.(componentRef)),
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export const createUnistylesElement = (Component: any) => {
|
|
39
41
|
const UnistylesComponent = (props: any) => {
|
|
40
|
-
return (
|
|
41
|
-
<Component
|
|
42
|
-
{...props}
|
|
43
|
-
{...buildUnistylesProps(Component, props, props.ref)}
|
|
44
|
-
/>
|
|
45
|
-
)
|
|
42
|
+
return <Component {...props} {...buildUnistylesProps(Component, props, props.ref)} />
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
return copyComponentProperties(Component, UnistylesComponent)
|