react-native-unistyles 3.5.3 → 3.7.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/README.md +6 -8
- package/android/build.gradle +42 -0
- package/android/src/legacy/java/com/unistyles/NativePlatform+extraWindows.kt +16 -0
- package/android/src/main/cxx/NativeUnistylesModule.cpp +5 -11
- package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +82 -39
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +73 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +2 -13
- package/android/src/rn86/java/com/unistyles/NativePlatform+extraWindows.kt +28 -0
- package/cxx/common/PerformanceTracing.h +85 -0
- package/cxx/converters/BackgroundImageConverter.cpp +198 -11
- package/cxx/converters/BackgroundImageConverter.h +1 -0
- package/cxx/converters/BackgroundLayerConverter.cpp +523 -0
- package/cxx/converters/BackgroundLayerConverter.h +14 -0
- package/cxx/converters/FontVariationSettingsConverter.cpp +104 -0
- package/cxx/converters/FontVariationSettingsConverter.h +17 -0
- package/cxx/core/HostUnistyle.cpp +6 -0
- package/cxx/core/UnistyleWrapper.h +16 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +13 -0
- package/cxx/hybridObjects/HybridStyleSheet.cpp +11 -0
- package/cxx/hybridObjects/HybridStyleSheet.h +1 -0
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +10 -30
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
- package/cxx/parser/Parser.cpp +92 -5
- package/cxx/shadowTree/ShadowTreeDiagnostics.cpp +74 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +3 -0
- package/ios/NativePlatform+ios.swift +22 -11
- package/ios/NativePlatformListener+ios.swift +9 -0
- package/lib/commonjs/components/NamedTheme.js +4 -4
- package/lib/commonjs/components/NamedTheme.js.map +1 -1
- package/lib/commonjs/components/ScopedThemeContext.js +3 -1
- package/lib/commonjs/components/ScopedThemeContext.js.map +1 -1
- package/lib/commonjs/components/native/deep/ActivityIndicator.js +19 -0
- package/lib/commonjs/components/native/deep/ActivityIndicator.js.map +1 -0
- package/lib/commonjs/components/native/deep/Animated.js +19 -0
- package/lib/commonjs/components/native/deep/Animated.js.map +1 -0
- package/lib/commonjs/components/native/deep/FlatList.js +19 -0
- package/lib/commonjs/components/native/deep/FlatList.js.map +1 -0
- package/lib/commonjs/components/native/deep/Image.js +19 -0
- package/lib/commonjs/components/native/deep/Image.js.map +1 -0
- package/lib/commonjs/components/native/deep/ImageBackground.js +19 -0
- package/lib/commonjs/components/native/deep/ImageBackground.js.map +1 -0
- package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js +19 -0
- package/lib/commonjs/components/native/deep/KeyboardAvoidingView.js.map +1 -0
- package/lib/commonjs/components/native/deep/Pressable.js +19 -0
- package/lib/commonjs/components/native/deep/Pressable.js.map +1 -0
- package/lib/commonjs/components/native/deep/RefreshControl.js +19 -0
- package/lib/commonjs/components/native/deep/RefreshControl.js.map +1 -0
- package/lib/commonjs/components/native/deep/SafeAreaView.js +19 -0
- package/lib/commonjs/components/native/deep/SafeAreaView.js.map +1 -0
- package/lib/commonjs/components/native/deep/ScrollView.js +19 -0
- package/lib/commonjs/components/native/deep/ScrollView.js.map +1 -0
- package/lib/commonjs/components/native/deep/SectionList.js +19 -0
- package/lib/commonjs/components/native/deep/SectionList.js.map +1 -0
- package/lib/commonjs/components/native/deep/Switch.js +19 -0
- package/lib/commonjs/components/native/deep/Switch.js.map +1 -0
- package/lib/commonjs/components/native/deep/Text.js +19 -0
- package/lib/commonjs/components/native/deep/Text.js.map +1 -0
- package/lib/commonjs/components/native/deep/TextInput.js +19 -0
- package/lib/commonjs/components/native/deep/TextInput.js.map +1 -0
- package/lib/commonjs/components/native/deep/TextNativeComponent.js +28 -0
- package/lib/commonjs/components/native/deep/TextNativeComponent.js.map +1 -0
- package/lib/commonjs/components/native/deep/TouchableHighlight.js +19 -0
- package/lib/commonjs/components/native/deep/TouchableHighlight.js.map +1 -0
- package/lib/commonjs/components/native/deep/TouchableOpacity.js +19 -0
- package/lib/commonjs/components/native/deep/TouchableOpacity.js.map +1 -0
- package/lib/commonjs/components/native/deep/View.js +19 -0
- package/lib/commonjs/components/native/deep/View.js.map +1 -0
- package/lib/commonjs/components/native/deep/ViewNativeComponent.js +26 -0
- package/lib/commonjs/components/native/deep/ViewNativeComponent.js.map +1 -0
- package/lib/commonjs/components/native/deep/VirtualizedList.js +19 -0
- package/lib/commonjs/components/native/deep/VirtualizedList.js.map +1 -0
- package/lib/commonjs/components/native/index.js +43 -0
- package/lib/commonjs/components/native/index.js.map +1 -0
- package/lib/commonjs/core/createUnistylesActivityIndicator.js +13 -3
- package/lib/commonjs/core/createUnistylesActivityIndicator.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +6 -0
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +26 -19
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/createUnistylesTouchableHighlight.js +6 -0
- package/lib/commonjs/core/createUnistylesTouchableHighlight.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +15 -0
- package/lib/commonjs/core/getClassname.js.map +1 -1
- package/lib/commonjs/core/hasUnistyles.js +26 -0
- package/lib/commonjs/core/hasUnistyles.js.map +1 -0
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +10 -7
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +22 -3
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/mocks.js +27 -3
- package/lib/commonjs/mocks.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +69 -76
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js +65 -0
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js.map +1 -0
- package/lib/commonjs/specs/ShadowRegistry/tracing.js +26 -0
- package/lib/commonjs/specs/ShadowRegistry/tracing.js.map +1 -0
- package/lib/commonjs/unifiber/src/adapters/reanimated.js +157 -0
- package/lib/commonjs/unifiber/src/adapters/reanimated.js.map +1 -0
- package/lib/commonjs/unifiber/src/adapters/registry.js +67 -0
- package/lib/commonjs/unifiber/src/adapters/registry.js.map +1 -0
- package/lib/commonjs/unifiber/src/diagnostics.js +59 -0
- package/lib/commonjs/unifiber/src/diagnostics.js.map +1 -0
- package/lib/commonjs/unifiber/src/fiber.js +199 -0
- package/lib/commonjs/unifiber/src/fiber.js.map +1 -0
- package/lib/commonjs/unifiber/src/host.js +214 -0
- package/lib/commonjs/unifiber/src/host.js.map +1 -0
- package/lib/commonjs/unifiber/src/index.js +38 -0
- package/lib/commonjs/unifiber/src/index.js.map +1 -0
- package/lib/commonjs/utils.js +52 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +19 -1
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/module.d.ts +3 -0
- package/lib/commonjs/web/convert/object/backgroundLayers.js +30 -0
- package/lib/commonjs/web/convert/object/backgroundLayers.js.map +1 -0
- package/lib/commonjs/web/convert/object/fontVariationSettings.js +12 -0
- package/lib/commonjs/web/convert/object/fontVariationSettings.js.map +1 -0
- package/lib/commonjs/web/convert/object/index.js +22 -0
- package/lib/commonjs/web/convert/object/index.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +7 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/registry.js +6 -4
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +9 -6
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +9 -3
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/NamedTheme.js +4 -4
- package/lib/module/components/NamedTheme.js.map +1 -1
- package/lib/module/components/ScopedThemeContext.js +3 -1
- package/lib/module/components/ScopedThemeContext.js.map +1 -1
- package/lib/module/components/native/deep/ActivityIndicator.js +5 -0
- package/lib/module/components/native/deep/ActivityIndicator.js.map +1 -0
- package/lib/module/components/native/deep/Animated.js +5 -0
- package/lib/module/components/native/deep/Animated.js.map +1 -0
- package/lib/module/components/native/deep/FlatList.js +5 -0
- package/lib/module/components/native/deep/FlatList.js.map +1 -0
- package/lib/module/components/native/deep/Image.js +5 -0
- package/lib/module/components/native/deep/Image.js.map +1 -0
- package/lib/module/components/native/deep/ImageBackground.js +5 -0
- package/lib/module/components/native/deep/ImageBackground.js.map +1 -0
- package/lib/module/components/native/deep/KeyboardAvoidingView.js +5 -0
- package/lib/module/components/native/deep/KeyboardAvoidingView.js.map +1 -0
- package/lib/module/components/native/deep/Pressable.js +5 -0
- package/lib/module/components/native/deep/Pressable.js.map +1 -0
- package/lib/module/components/native/deep/RefreshControl.js +5 -0
- package/lib/module/components/native/deep/RefreshControl.js.map +1 -0
- package/lib/module/components/native/deep/SafeAreaView.js +5 -0
- package/lib/module/components/native/deep/SafeAreaView.js.map +1 -0
- package/lib/module/components/native/deep/ScrollView.js +5 -0
- package/lib/module/components/native/deep/ScrollView.js.map +1 -0
- package/lib/module/components/native/deep/SectionList.js +5 -0
- package/lib/module/components/native/deep/SectionList.js.map +1 -0
- package/lib/module/components/native/deep/Switch.js +5 -0
- package/lib/module/components/native/deep/Switch.js.map +1 -0
- package/lib/module/components/native/deep/Text.js +5 -0
- package/lib/module/components/native/deep/Text.js.map +1 -0
- package/lib/module/components/native/deep/TextInput.js +5 -0
- package/lib/module/components/native/deep/TextInput.js.map +1 -0
- package/lib/module/components/native/deep/TextNativeComponent.js +8 -0
- package/lib/module/components/native/deep/TextNativeComponent.js.map +1 -0
- package/lib/module/components/native/deep/TouchableHighlight.js +5 -0
- package/lib/module/components/native/deep/TouchableHighlight.js.map +1 -0
- package/lib/module/components/native/deep/TouchableOpacity.js +5 -0
- package/lib/module/components/native/deep/TouchableOpacity.js.map +1 -0
- package/lib/module/components/native/deep/View.js +5 -0
- package/lib/module/components/native/deep/View.js.map +1 -0
- package/lib/module/components/native/deep/ViewNativeComponent.js +8 -0
- package/lib/module/components/native/deep/ViewNativeComponent.js.map +1 -0
- package/lib/module/components/native/deep/VirtualizedList.js +5 -0
- package/lib/module/components/native/deep/VirtualizedList.js.map +1 -0
- package/lib/module/components/native/index.js +43 -0
- package/lib/module/components/native/index.js.map +1 -0
- package/lib/module/core/createUnistylesActivityIndicator.js +13 -3
- package/lib/module/core/createUnistylesActivityIndicator.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +6 -0
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +26 -19
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/createUnistylesTouchableHighlight.js +6 -0
- package/lib/module/core/createUnistylesTouchableHighlight.js.map +1 -1
- package/lib/module/core/getClassname.js +16 -1
- package/lib/module/core/getClassname.js.map +1 -1
- package/lib/module/core/hasUnistyles.js +21 -0
- package/lib/module/core/hasUnistyles.js.map +1 -0
- package/lib/module/core/withUnistyles/withUnistyles.js +9 -6
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +24 -5
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/mocks.js +27 -3
- package/lib/module/mocks.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +69 -76
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/styleSource.js +60 -0
- package/lib/module/specs/ShadowRegistry/styleSource.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/tracing.js +21 -0
- package/lib/module/specs/ShadowRegistry/tracing.js.map +1 -0
- package/lib/module/unifiber/src/adapters/reanimated.js +152 -0
- package/lib/module/unifiber/src/adapters/reanimated.js.map +1 -0
- package/lib/module/unifiber/src/adapters/registry.js +62 -0
- package/lib/module/unifiber/src/adapters/registry.js.map +1 -0
- package/lib/module/unifiber/src/diagnostics.js +52 -0
- package/lib/module/unifiber/src/diagnostics.js.map +1 -0
- package/lib/module/unifiber/src/fiber.js +183 -0
- package/lib/module/unifiber/src/fiber.js.map +1 -0
- package/lib/module/unifiber/src/host.js +191 -0
- package/lib/module/unifiber/src/host.js.map +1 -0
- package/lib/module/unifiber/src/index.js +33 -0
- package/lib/module/unifiber/src/index.js.map +1 -0
- package/lib/module/utils.js +50 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/index.js +22 -3
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/module.d.ts +3 -0
- package/lib/module/web/convert/object/backgroundLayers.js +25 -0
- package/lib/module/web/convert/object/backgroundLayers.js.map +1 -0
- package/lib/module/web/convert/object/fontVariationSettings.js +7 -0
- package/lib/module/web/convert/object/fontVariationSettings.js.map +1 -0
- package/lib/module/web/convert/object/index.js +2 -0
- package/lib/module/web/convert/object/index.js.map +1 -1
- package/lib/module/web/convert/utils.js +4 -0
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/registry.js +6 -4
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +9 -6
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +10 -4
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/ScopedThemeContext.d.ts +2 -1
- package/lib/typescript/src/components/ScopedThemeContext.d.ts.map +1 -1
- package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/ActivityIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/Animated.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/Animated.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/FlatList.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/FlatList.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/Image.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/Image.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/ImageBackground.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/ImageBackground.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/KeyboardAvoidingView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/Pressable.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/RefreshControl.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/RefreshControl.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/SafeAreaView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/ScrollView.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/ScrollView.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/SectionList.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/SectionList.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/Switch.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/Switch.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/Text.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/Text.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/TextInput.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/TextInput.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts +3 -0
- package/lib/typescript/src/components/native/deep/TextNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/TouchableHighlight.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/TouchableOpacity.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/View.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/View.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts +3 -0
- package/lib/typescript/src/components/native/deep/ViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts +2 -0
- package/lib/typescript/src/components/native/deep/VirtualizedList.d.ts.map +1 -0
- package/lib/typescript/src/components/native/index.d.ts +4 -0
- package/lib/typescript/src/components/native/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scopeChildren.d.ts +1 -1
- package/lib/typescript/src/core/createUnistylesActivityIndicator.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/createUnistylesTouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
- package/lib/typescript/src/core/hasUnistyles.d.ts +2 -0
- package/lib/typescript/src/core/hasUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +6 -3
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +7 -4
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts +11 -0
- package/lib/typescript/src/specs/ShadowRegistry/styleSource.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/tracing.d.ts +2 -0
- package/lib/typescript/src/specs/ShadowRegistry/tracing.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +4 -41
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts +17 -0
- package/lib/typescript/src/unifiber/src/adapters/reanimated.d.ts.map +1 -0
- package/lib/typescript/src/unifiber/src/adapters/registry.d.ts +23 -0
- package/lib/typescript/src/unifiber/src/adapters/registry.d.ts.map +1 -0
- package/lib/typescript/src/unifiber/src/diagnostics.d.ts +10 -0
- package/lib/typescript/src/unifiber/src/diagnostics.d.ts.map +1 -0
- package/lib/typescript/src/unifiber/src/fiber.d.ts +48 -0
- package/lib/typescript/src/unifiber/src/fiber.d.ts.map +1 -0
- package/lib/typescript/src/unifiber/src/host.d.ts +32 -0
- package/lib/typescript/src/unifiber/src/host.d.ts.map +1 -0
- package/lib/typescript/src/unifiber/src/index.d.ts +49 -0
- package/lib/typescript/src/unifiber/src/index.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +1 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/backgroundLayers.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/backgroundLayers.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/fontVariationSettings.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/fontVariationSettings.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/index.d.ts +2 -0
- package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +2 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -0
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/metro/babel-transformer.js +1102 -0
- package/metro/index.d.ts +31 -0
- package/metro/index.js +170 -0
- package/package.json +50 -32
- package/plugin/index.d.ts +7 -0
- package/plugin/index.js +115 -33
- package/src/components/NamedTheme.tsx +5 -5
- package/src/components/ScopedThemeContext.ts +6 -2
- package/src/components/native/deep/ActivityIndicator.ts +2 -0
- package/src/components/native/deep/Animated.ts +2 -0
- package/src/components/native/deep/FlatList.ts +2 -0
- package/src/components/native/deep/Image.ts +2 -0
- package/src/components/native/deep/ImageBackground.ts +2 -0
- package/src/components/native/deep/KeyboardAvoidingView.ts +2 -0
- package/src/components/native/deep/Pressable.ts +2 -0
- package/src/components/native/deep/RefreshControl.ts +2 -0
- package/src/components/native/deep/SafeAreaView.ts +2 -0
- package/src/components/native/deep/ScrollView.ts +2 -0
- package/src/components/native/deep/SectionList.ts +2 -0
- package/src/components/native/deep/Switch.ts +2 -0
- package/src/components/native/deep/Text.ts +2 -0
- package/src/components/native/deep/TextInput.ts +2 -0
- package/src/components/native/deep/TextNativeComponent.ts +5 -0
- package/src/components/native/deep/TouchableHighlight.ts +2 -0
- package/src/components/native/deep/TouchableOpacity.ts +2 -0
- package/src/components/native/deep/View.ts +2 -0
- package/src/components/native/deep/ViewNativeComponent.ts +5 -0
- package/src/components/native/deep/VirtualizedList.ts +2 -0
- package/src/components/native/index.ts +41 -0
- package/src/core/createUnistylesActivityIndicator.tsx +11 -4
- package/src/core/createUnistylesElement.native.tsx +5 -0
- package/src/core/createUnistylesImageBackground.tsx +33 -25
- package/src/core/createUnistylesTouchableHighlight.tsx +5 -0
- package/src/core/getClassname.ts +10 -1
- package/src/core/hasUnistyles.ts +20 -0
- package/src/core/withUnistyles/withUnistyles.native.tsx +28 -6
- package/src/core/withUnistyles/withUnistyles.tsx +6 -6
- package/src/mocks.ts +14 -5
- package/src/specs/ShadowRegistry/index.ts +62 -103
- package/src/specs/ShadowRegistry/styleSource.ts +78 -0
- package/src/specs/ShadowRegistry/tracing.ts +23 -0
- package/src/specs/ShadowRegistry/types.ts +3 -43
- package/src/unifiber/LICENSE +21 -0
- package/src/unifiber/README.md +92 -0
- package/src/unifiber/src/adapters/reanimated.ts +204 -0
- package/src/unifiber/src/adapters/registry.ts +102 -0
- package/src/unifiber/src/diagnostics.ts +55 -0
- package/src/unifiber/src/fiber.ts +262 -0
- package/src/unifiber/src/host.ts +236 -0
- package/src/unifiber/src/index.ts +43 -0
- package/src/utils.ts +51 -0
- package/src/web/convert/index.ts +39 -3
- package/src/web/convert/object/backgroundLayers.ts +33 -0
- package/src/web/convert/object/fontVariationSettings.ts +7 -0
- package/src/web/convert/object/index.ts +2 -0
- package/src/web/convert/utils.ts +11 -0
- package/src/web/registry.ts +7 -8
- package/src/web/runtime.ts +7 -7
- package/src/web/utils/unistyle.ts +11 -4
- package/lib/commonjs/web/convert/module.d.js +0 -2
- package/lib/commonjs/web/convert/module.d.js.map +0 -1
- package/lib/module/web/convert/module.d.js +0 -2
- package/lib/module/web/convert/module.d.js.map +0 -1
- package/lib/typescript/src/__tests__/mocks.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/mocks.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/passForwardRef.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/scoped-theme.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/shadow-registry.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/web-child-selector.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/web-child-selector.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/web-listener.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/web-listener.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/web-pointer-events.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/web-pointer-events.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/web-runtime.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/web-runtime.spec.d.ts.map +0 -1
- package/lib/typescript/src/__tests__/withUnistyles.spec.d.ts +0 -2
- package/lib/typescript/src/__tests__/withUnistyles.spec.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SafeAreaView","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/SafeAreaView.ts"],"mappings":";;AAAA;AACA,SAASA,YAAY,EAAEA,YAAY,IAAIC,OAAO,QAAQ,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScrollView","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/ScrollView.ts"],"mappings":";;AAAA;AACA,SAASA,UAAU,EAAEA,UAAU,IAAIC,OAAO,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SectionList","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/SectionList.ts"],"mappings":";;AAAA;AACA,SAASA,WAAW,EAAEA,WAAW,IAAIC,OAAO,QAAQ,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Switch","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/Switch.ts"],"mappings":";;AAAA;AACA,SAASA,MAAM,EAAEA,MAAM,IAAIC,OAAO,QAAQ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Text","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/Text.ts"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEA,IAAI,IAAIC,OAAO,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TextInput","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/TextInput.ts"],"mappings":";;AAAA;AACA,SAASA,SAAS,EAAEA,SAAS,IAAIC,OAAO,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves direct imports of react-native/Libraries/Text/TextNativeComponent here,
|
|
4
|
+
// its other exports (eg. NativeVirtualText) stay untouched
|
|
5
|
+
// @ts-ignore deep imports are typed only by some React Native versions
|
|
6
|
+
export * from 'react-native/Libraries/Text/TextNativeComponent';
|
|
7
|
+
export { NativeText } from '../NativeText';
|
|
8
|
+
//# sourceMappingURL=TextNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeText"],"sourceRoot":"../../../../../src","sources":["components/native/deep/TextNativeComponent.ts"],"mappings":";;AAAA;AACA;AACA;AACA,cAAc,iDAAiD;AAC/D,SAASA,UAAU,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves direct imports of the TouchableHighlight module of react-native or react-native-web here
|
|
4
|
+
export { TouchableHighlight, TouchableHighlight as default } from '../TouchableHighlight';
|
|
5
|
+
//# sourceMappingURL=TouchableHighlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TouchableHighlight","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/TouchableHighlight.ts"],"mappings":";;AAAA;AACA,SAASA,kBAAkB,EAAEA,kBAAkB,IAAIC,OAAO,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves direct imports of the TouchableOpacity module of react-native or react-native-web here
|
|
4
|
+
export { TouchableOpacity, TouchableOpacity as default } from '../TouchableOpacity';
|
|
5
|
+
//# sourceMappingURL=TouchableOpacity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TouchableOpacity","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/TouchableOpacity.ts"],"mappings":";;AAAA;AACA,SAASA,gBAAgB,EAAEA,gBAAgB,IAAIC,OAAO,QAAQ,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/View.ts"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEA,IAAI,IAAIC,OAAO,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves direct imports of react-native/Libraries/Components/View/ViewNativeComponent here,
|
|
4
|
+
// its other exports stay untouched
|
|
5
|
+
// @ts-ignore deep imports are typed only by some React Native versions
|
|
6
|
+
export * from 'react-native/Libraries/Components/View/ViewNativeComponent';
|
|
7
|
+
export { NativeView as default } from '../NativeView';
|
|
8
|
+
//# sourceMappingURL=ViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeView","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/ViewNativeComponent.ts"],"mappings":";;AAAA;AACA;AACA;AACA,cAAc,4DAA4D;AAC1E,SAASA,UAAU,IAAIC,OAAO,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves direct imports of the VirtualizedList module of react-native or react-native-web here
|
|
4
|
+
export { VirtualizedList, VirtualizedList as default } from '../VirtualizedList';
|
|
5
|
+
//# sourceMappingURL=VirtualizedList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["VirtualizedList","default"],"sourceRoot":"../../../../../src","sources":["components/native/deep/VirtualizedList.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,EAAEA,eAAe,IAAIC,OAAO,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// react-native-unistyles/metro resolves every `react-native` import (react-native-web on web) to this module,
|
|
4
|
+
// so it exposes every export of react-native and swaps the components Unistyles can update.
|
|
5
|
+
// Imports from this folder are Unistyles' own, they reach the real react-native
|
|
6
|
+
const ReactNative = require('react-native');
|
|
7
|
+
|
|
8
|
+
// lazy, like react-native's own exports
|
|
9
|
+
const UNISTYLES_COMPONENTS = {
|
|
10
|
+
ActivityIndicator: () => require('./ActivityIndicator').ActivityIndicator,
|
|
11
|
+
Animated: () => require('./Animated').Animated,
|
|
12
|
+
FlatList: () => require('./FlatList').FlatList,
|
|
13
|
+
Image: () => require('./Image').Image,
|
|
14
|
+
ImageBackground: () => require('./ImageBackground').ImageBackground,
|
|
15
|
+
KeyboardAvoidingView: () => require('./KeyboardAvoidingView').KeyboardAvoidingView,
|
|
16
|
+
Pressable: () => require('./Pressable').Pressable,
|
|
17
|
+
RefreshControl: () => require('./RefreshControl').RefreshControl,
|
|
18
|
+
SafeAreaView: () => require('./SafeAreaView').SafeAreaView,
|
|
19
|
+
ScrollView: () => require('./ScrollView').ScrollView,
|
|
20
|
+
SectionList: () => require('./SectionList').SectionList,
|
|
21
|
+
Switch: () => require('./Switch').Switch,
|
|
22
|
+
Text: () => require('./Text').Text,
|
|
23
|
+
TextInput: () => require('./TextInput').TextInput,
|
|
24
|
+
TouchableHighlight: () => require('./TouchableHighlight').TouchableHighlight,
|
|
25
|
+
TouchableOpacity: () => require('./TouchableOpacity').TouchableOpacity,
|
|
26
|
+
View: () => require('./View').View,
|
|
27
|
+
VirtualizedList: () => require('./VirtualizedList').VirtualizedList,
|
|
28
|
+
unstable_NativeText: () => require('./NativeText').NativeText,
|
|
29
|
+
unstable_NativeView: () => require('./NativeView').NativeView
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Object.keys doesn't call react-native's getters. Unistyles components are added even if missing,
|
|
33
|
+
// react-native-web and React Native before 0.83 don't export unstable_NativeView / unstable_NativeText
|
|
34
|
+
const exportNames = new Set(Object.keys(ReactNative).concat(Object.keys(UNISTYLES_COMPONENTS)));
|
|
35
|
+
exportNames.forEach(name => {
|
|
36
|
+
// CommonJS without the __esModule flag, like react-native, so a default import still gets every export
|
|
37
|
+
// @ts-ignore module is provided by Metro
|
|
38
|
+
Object.defineProperty(module.exports, name, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: UNISTYLES_COMPONENTS[name] ?? (() => ReactNative[name])
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNative","require","UNISTYLES_COMPONENTS","ActivityIndicator","Animated","FlatList","Image","ImageBackground","KeyboardAvoidingView","Pressable","RefreshControl","SafeAreaView","ScrollView","SectionList","Switch","Text","TextInput","TouchableHighlight","TouchableOpacity","View","VirtualizedList","unstable_NativeText","NativeText","unstable_NativeView","NativeView","exportNames","Set","Object","keys","concat","forEach","name","defineProperty","module","exports","enumerable","get"],"sourceRoot":"../../../../src","sources":["components/native/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,WAAoC,GAAGC,OAAO,CAAC,cAAc,CAAC;;AAEpE;AACA,MAAMC,oBAAmD,GAAG;EACxDC,iBAAiB,EAAEA,CAAA,KAAMF,OAAO,CAAC,qBAAqB,CAAC,CAACE,iBAAiB;EACzEC,QAAQ,EAAEA,CAAA,KAAMH,OAAO,CAAC,YAAY,CAAC,CAACG,QAAQ;EAC9CC,QAAQ,EAAEA,CAAA,KAAMJ,OAAO,CAAC,YAAY,CAAC,CAACI,QAAQ;EAC9CC,KAAK,EAAEA,CAAA,KAAML,OAAO,CAAC,SAAS,CAAC,CAACK,KAAK;EACrCC,eAAe,EAAEA,CAAA,KAAMN,OAAO,CAAC,mBAAmB,CAAC,CAACM,eAAe;EACnEC,oBAAoB,EAAEA,CAAA,KAAMP,OAAO,CAAC,wBAAwB,CAAC,CAACO,oBAAoB;EAClFC,SAAS,EAAEA,CAAA,KAAMR,OAAO,CAAC,aAAa,CAAC,CAACQ,SAAS;EACjDC,cAAc,EAAEA,CAAA,KAAMT,OAAO,CAAC,kBAAkB,CAAC,CAACS,cAAc;EAChEC,YAAY,EAAEA,CAAA,KAAMV,OAAO,CAAC,gBAAgB,CAAC,CAACU,YAAY;EAC1DC,UAAU,EAAEA,CAAA,KAAMX,OAAO,CAAC,cAAc,CAAC,CAACW,UAAU;EACpDC,WAAW,EAAEA,CAAA,KAAMZ,OAAO,CAAC,eAAe,CAAC,CAACY,WAAW;EACvDC,MAAM,EAAEA,CAAA,KAAMb,OAAO,CAAC,UAAU,CAAC,CAACa,MAAM;EACxCC,IAAI,EAAEA,CAAA,KAAMd,OAAO,CAAC,QAAQ,CAAC,CAACc,IAAI;EAClCC,SAAS,EAAEA,CAAA,KAAMf,OAAO,CAAC,aAAa,CAAC,CAACe,SAAS;EACjDC,kBAAkB,EAAEA,CAAA,KAAMhB,OAAO,CAAC,sBAAsB,CAAC,CAACgB,kBAAkB;EAC5EC,gBAAgB,EAAEA,CAAA,KAAMjB,OAAO,CAAC,oBAAoB,CAAC,CAACiB,gBAAgB;EACtEC,IAAI,EAAEA,CAAA,KAAMlB,OAAO,CAAC,QAAQ,CAAC,CAACkB,IAAI;EAClCC,eAAe,EAAEA,CAAA,KAAMnB,OAAO,CAAC,mBAAmB,CAAC,CAACmB,eAAe;EACnEC,mBAAmB,EAAEA,CAAA,KAAMpB,OAAO,CAAC,cAAc,CAAC,CAACqB,UAAU;EAC7DC,mBAAmB,EAAEA,CAAA,KAAMtB,OAAO,CAAC,cAAc,CAAC,CAACuB;AACvD,CAAC;;AAED;AACA;AACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC5B,WAAW,CAAC,CAAC6B,MAAM,CAACF,MAAM,CAACC,IAAI,CAAC1B,oBAAoB,CAAC,CAAC,CAAC;AAE/FuB,WAAW,CAACK,OAAO,CAAEC,IAAI,IAAK;EAC1B;EACA;EACAJ,MAAM,CAACK,cAAc,CAACC,MAAM,CAACC,OAAO,EAAEH,IAAI,EAAE;IACxCI,UAAU,EAAE,IAAI;IAChBC,GAAG,EAAElC,oBAAoB,CAAC6B,IAAI,CAAC,KAAK,MAAM/B,WAAW,CAAC+B,IAAI,CAAC;EAC/D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
import { isAndroid } from '../common';
|
|
5
4
|
import { ScopedThemeContext } from '../components/ScopedThemeContext';
|
|
6
5
|
import { UnistylesShadowRegistry } from '../specs';
|
|
6
|
+
import { Fiber } from '../unifiber/src';
|
|
7
7
|
import { copyComponentProperties } from '../utils';
|
|
8
|
+
import { hasUnistyles } from './hasUnistyles';
|
|
8
9
|
import { passForwardedRef } from './passForwardRef';
|
|
9
10
|
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const {
|
|
13
|
+
getHostFor,
|
|
14
|
+
getParentHost
|
|
15
|
+
} = Fiber;
|
|
11
16
|
const getWrapperHandle = ref => {
|
|
12
|
-
const spinner = ref
|
|
17
|
+
const spinner = getHostFor(ref);
|
|
13
18
|
return {
|
|
14
|
-
__internalInstanceHandle:
|
|
19
|
+
__internalInstanceHandle: spinner && getParentHost(spinner)
|
|
15
20
|
};
|
|
16
21
|
};
|
|
17
22
|
export const createUnistylesActivityIndicator = Component => {
|
|
18
23
|
const UnistylesActivityIndicator = props => {
|
|
19
24
|
const scope = useContext(ScopedThemeContext);
|
|
25
|
+
if (!hasUnistyles(props.style)) {
|
|
26
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
27
|
+
...props
|
|
28
|
+
});
|
|
29
|
+
}
|
|
20
30
|
return /*#__PURE__*/_jsx(Component, {
|
|
21
31
|
...props,
|
|
22
32
|
ref: ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","
|
|
1
|
+
{"version":3,"names":["React","useContext","ScopedThemeContext","UnistylesShadowRegistry","Fiber","copyComponentProperties","hasUnistyles","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","getHostFor","getParentHost","getWrapperHandle","ref","spinner","__internalInstanceHandle","createUnistylesActivityIndicator","Component","UnistylesActivityIndicator","props","scope","style","wrapperHandle","add","remove"],"sourceRoot":"../../../src","sources":["core/createUnistylesActivityIndicator.tsx"],"mappings":";;AAEA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,MAAM;EAAEC,UAAU;EAAEC;AAAc,CAAC,GAAGR,KAAK;AAE3C,MAAMS,gBAAgB,GAAIC,GAAY,IAAK;EACvC,MAAMC,OAAO,GAAGJ,UAAU,CAACG,GAAG,CAAC;EAE/B,OAAO;IACHE,wBAAwB,EAAED,OAAO,IAAIH,aAAa,CAACG,OAAO;EAC9D,CAAC;AACL,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAIC,SAAmC,IAAK;EACrF,MAAMC,0BAA0B,GAAIC,KAAU,IAAK;IAC/C,MAAMC,KAAK,GAAGpB,UAAU,CAACC,kBAAkB,CAAC;IAE5C,IAAI,CAACI,YAAY,CAACc,KAAK,CAACE,KAAK,CAAC,EAAE;MAC5B,oBAAOZ,IAAA,CAACQ,SAAS;QAAA,GAAKE;MAAK,CAAG,CAAC;IACnC;IAEA,oBACIV,IAAA,CAACQ,SAAS;MAAA,GACFE,KAAK;MACTN,GAAG,EAAGA,GAAY,IAAK;QACnBN,+BAA+B,CAACY,KAAK,CAACE,KAAK,EAAE,mBAAmB,CAAC;QAEjE,MAAMC,aAAa,GAAGV,gBAAgB,CAACC,GAAG,CAAC;QAE3C,OAAOP,gBAAgB,CACnBO,GAAG,EACHM,KAAK,CAACN,GAAG,EACT,MAAM;UACF;UACAX,uBAAuB,CAACqB,GAAG,CAACD,aAAa,EAAEH,KAAK,CAACE,KAAK,EAAED,KAAK,CAAC;QAClE,CAAC,EACD,MAAM;UACF;UACAlB,uBAAuB,CAACsB,MAAM,CAACF,aAAa,CAAC;QACjD,CACJ,CAAC;MACL;IAAE,CACL,CAAC;EAEV,CAAC;EAED,OAAOlB,uBAAuB,CAACa,SAAS,EAAEC,0BAA0B,CAAC;AACzE,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import React, { useContext, useRef } from 'react';
|
|
|
4
4
|
import { ScopedThemeContext } from '../components/ScopedThemeContext';
|
|
5
5
|
import { UnistylesShadowRegistry } from '../specs';
|
|
6
6
|
import { copyComponentProperties } from '../utils';
|
|
7
|
+
import { hasUnistyles } from './hasUnistyles';
|
|
7
8
|
import { passForwardedRef } from './passForwardRef';
|
|
8
9
|
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -11,6 +12,11 @@ export const createUnistylesElement = Component => {
|
|
|
11
12
|
const UnistylesComponent = props => {
|
|
12
13
|
const scrollViewRef = useRef(null);
|
|
13
14
|
const scope = useContext(ScopedThemeContext);
|
|
15
|
+
if (!hasUnistyles(props.style)) {
|
|
16
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
14
20
|
return /*#__PURE__*/_jsx(Component, {
|
|
15
21
|
...props,
|
|
16
22
|
ref: ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","useRef","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesElement","Component","UnistylesComponent","props","scrollViewRef","scope","
|
|
1
|
+
{"version":3,"names":["React","useContext","useRef","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","hasUnistyles","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesElement","Component","UnistylesComponent","props","scrollViewRef","scope","style","ref","displayName","isScrollView","current","remove","add"],"sourceRoot":"../../../src","sources":["core/createUnistylesElement.native.tsx"],"mappings":";;AAEA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAEjD,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,sBAAsB,GAAIC,SAAc,IAAK;EACtD,MAAMC,kBAAkB,GAAIC,KAAU,IAAK;IACvC,MAAMC,aAAa,GAAGb,MAAM,CAAa,IAAI,CAAC;IAC9C,MAAMc,KAAK,GAAGf,UAAU,CAACE,kBAAkB,CAAC;IAE5C,IAAI,CAACG,YAAY,CAACQ,KAAK,CAACG,KAAK,CAAC,EAAE;MAC5B,oBAAOP,IAAA,CAACE,SAAS;QAAA,GAAKE;MAAK,CAAG,CAAC;IACnC;IAEA,oBACIJ,IAAA,CAACE,SAAS;MAAA,GACFE,KAAK;MACTI,GAAG,EAAGA,GAAY,IAAK;QACnBV,+BAA+B,CAACM,KAAK,CAACG,KAAK,EAAEL,SAAS,CAACO,WAAW,CAAC;;QAEnE;QACA;QACA,MAAMC,YAAY,GAAGR,SAAS,CAACO,WAAW,KAAK,YAAY;QAE3D,IAAIC,YAAY,IAAIF,GAAG,EAAE;UACrBH,aAAa,CAACM,OAAO,GAAGH,GAAiB;QAC7C;QAEA,IAAIE,YAAY,IAAI,CAACF,GAAG,EAAE;UACtB;UACAd,uBAAuB,CAACkB,MAAM,CAACP,aAAa,CAACM,OAAO,CAAC;UACrDN,aAAa,CAACM,OAAO,GAAG,IAAI;UAE5B;QACJ;QAEA,OAAOd,gBAAgB,CACnBW,GAAG,EACHJ,KAAK,CAACI,GAAG,EACT,MAAM;UACF;UACAd,uBAAuB,CAACmB,GAAG,CAACL,GAAG,EAAEJ,KAAK,CAACG,KAAK,EAAED,KAAK,CAAC;QACxD,CAAC,EACD,MAAM;UACF;UACAZ,uBAAuB,CAACkB,MAAM,CAACJ,GAAG,CAAC;QACvC,CACJ,CAAC;MACL;IAAE,CACL,CAAC;EAEV,CAAC;EAED,OAAOb,uBAAuB,CAACO,SAAS,EAAEC,kBAAkB,CAAC;AACjE,CAAC","ignoreList":[]}
|
|
@@ -4,38 +4,45 @@ import React, { useContext } from 'react';
|
|
|
4
4
|
import { ScopedThemeContext } from '../components/ScopedThemeContext';
|
|
5
5
|
import { UnistylesShadowRegistry } from '../specs';
|
|
6
6
|
import { copyComponentProperties } from '../utils';
|
|
7
|
+
import { hasUnistyles } from './hasUnistyles';
|
|
7
8
|
import { passForwardedRef } from './passForwardRef';
|
|
8
9
|
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
export const createUnistylesImageBackground = Component => {
|
|
11
|
-
const UnistylesImageBackground =
|
|
12
|
+
const UnistylesImageBackground = ({
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const forwardedRef = ref ?? null;
|
|
12
17
|
const scope = useContext(ScopedThemeContext);
|
|
13
18
|
|
|
14
19
|
// @ts-expect-error we don't know the type of the component
|
|
15
20
|
maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground');
|
|
16
21
|
// @ts-ignore we don't know the type of the component
|
|
17
22
|
maybeWarnAboutMultipleUnistyles(props.imageStyle, 'ImageBackground');
|
|
23
|
+
const linkRef = ref => {
|
|
24
|
+
return passForwardedRef(ref, forwardedRef, () => {
|
|
25
|
+
// @ts-expect-error - this is hidden from TS
|
|
26
|
+
UnistylesShadowRegistry.add(ref, props.style, scope);
|
|
27
|
+
}, () => {
|
|
28
|
+
// @ts-expect-error - this is hidden from TS
|
|
29
|
+
UnistylesShadowRegistry.remove(ref);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const linkImageRef = ref => {
|
|
33
|
+
// @ts-expect-error web types are not compatible with RN styles
|
|
34
|
+
UnistylesShadowRegistry.add(ref, props.imageStyle, scope);
|
|
35
|
+
return () => {
|
|
36
|
+
// @ts-ignore this is hidden from TS
|
|
37
|
+
UnistylesShadowRegistry.remove(ref);
|
|
38
|
+
};
|
|
39
|
+
};
|
|
18
40
|
return /*#__PURE__*/_jsx(Component, {
|
|
19
41
|
...props,
|
|
20
|
-
ref:
|
|
21
|
-
|
|
22
|
-
// @ts-expect-error - this is hidden from TS
|
|
23
|
-
UnistylesShadowRegistry.add(ref, props.style, scope);
|
|
24
|
-
}, () => {
|
|
25
|
-
// @ts-expect-error - this is hidden from TS
|
|
26
|
-
UnistylesShadowRegistry.remove(ref);
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
imageRef: ref => {
|
|
30
|
-
// @ts-expect-error web types are not compatible with RN styles
|
|
31
|
-
UnistylesShadowRegistry.add(ref, props.imageStyle, scope);
|
|
32
|
-
return () => {
|
|
33
|
-
// @ts-ignore this is hidden from TS
|
|
34
|
-
UnistylesShadowRegistry.remove(ref);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
42
|
+
ref: hasUnistyles(props.style) ? linkRef : forwardedRef,
|
|
43
|
+
imageRef: hasUnistyles(props.imageStyle) ? linkImageRef : props.imageRef
|
|
37
44
|
});
|
|
38
|
-
}
|
|
45
|
+
};
|
|
39
46
|
return copyComponentProperties(Component, UnistylesImageBackground);
|
|
40
47
|
};
|
|
41
48
|
//# sourceMappingURL=createUnistylesImageBackground.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesImageBackground","Component","UnistylesImageBackground","
|
|
1
|
+
{"version":3,"names":["React","useContext","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","hasUnistyles","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesImageBackground","Component","UnistylesImageBackground","ref","props","forwardedRef","scope","style","imageStyle","linkRef","add","remove","linkImageRef","imageRef"],"sourceRoot":"../../../src","sources":["core/createUnistylesImageBackground.tsx"],"mappings":";;AAEA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,8BAA8B,GAAIC,SAAiC,IAAK;EACjF,MAAMC,wBAAwB,GAAGA,CAAC;IAC9BC,GAAG;IACH,GAAGC;EAC+D,CAAC,KAAK;IACxE,MAAMC,YAAiD,GAAGF,GAAG,IAAI,IAAI;IACrE,MAAMG,KAAK,GAAGf,UAAU,CAACC,kBAAkB,CAAC;;IAE5C;IACAK,+BAA+B,CAACO,KAAK,CAACG,KAAK,EAAE,iBAAiB,CAAC;IAC/D;IACAV,+BAA+B,CAACO,KAAK,CAACI,UAAU,EAAE,iBAAiB,CAAC;IAEpE,MAAMC,OAAO,GAAIN,GAA2B,IAAK;MAC7C,OAAOP,gBAAgB,CACnBO,GAAG,EACHE,YAAY,EACZ,MAAM;QACF;QACAZ,uBAAuB,CAACiB,GAAG,CAACP,GAAG,EAAEC,KAAK,CAACG,KAAK,EAAED,KAAK,CAAC;MACxD,CAAC,EACD,MAAM;QACF;QACAb,uBAAuB,CAACkB,MAAM,CAACR,GAAG,CAAC;MACvC,CACJ,CAAC;IACL,CAAC;IACD,MAAMS,YAAY,GAAIT,GAAY,IAAK;MACnC;MACAV,uBAAuB,CAACiB,GAAG,CAACP,GAAG,EAAEC,KAAK,CAACI,UAAU,EAAEF,KAAK,CAAC;MAEzD,OAAO,MAAM;QACT;QACAb,uBAAuB,CAACkB,MAAM,CAACR,GAAG,CAAC;MACvC,CAAC;IACL,CAAC;IAED,oBACIJ,IAAA,CAACE,SAAS;MAAA,GACFG,KAAK;MACTD,GAAG,EAAER,YAAY,CAACS,KAAK,CAACG,KAAK,CAAC,GAAGE,OAAO,GAAGJ,YAAa;MACxDQ,QAAQ,EAAElB,YAAY,CAACS,KAAK,CAACI,UAAU,CAAC,GAAGI,YAAY,GAAGR,KAAK,CAACS;IAAS,CAC5E,CAAC;EAEV,CAAC;EAED,OAAOnB,uBAAuB,CAACO,SAAS,EAAEC,wBAAwB,CAAC;AACvE,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import React, { useCallback, useContext, useLayoutEffect, useRef, useState } fro
|
|
|
4
4
|
import { ScopedThemeContext } from '../components/ScopedThemeContext';
|
|
5
5
|
import { UnistylesShadowRegistry } from '../specs';
|
|
6
6
|
import { copyComponentProperties } from '../utils';
|
|
7
|
+
import { hasUnistyles } from './hasUnistyles';
|
|
7
8
|
import { passForwardedRef } from './passForwardRef';
|
|
8
9
|
import { maybeWarnAboutMultipleUnistyles } from './warn';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -36,6 +37,11 @@ export const createUnistylesTouchableHighlight = Component => {
|
|
|
36
37
|
UnistylesShadowRegistry.remove(ref);
|
|
37
38
|
});
|
|
38
39
|
}, [props, scope]);
|
|
40
|
+
if (!hasUnistyles(props.style)) {
|
|
41
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
39
45
|
return /*#__PURE__*/_jsx(Component, {
|
|
40
46
|
...props,
|
|
41
47
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useContext","useLayoutEffect","useRef","useState","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesTouchableHighlight","Component","UnistylesTouchableHighlight","props","scope","relinkRef","undefined","hiddenUnderlays","setHiddenUnderlays","current","ref","style","remove","add","onHideUnderlay","count"],"sourceRoot":"../../../src","sources":["core/createUnistylesTouchableHighlight.tsx"],"mappings":";;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEzF,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,iCAAiC,GAAIC,SAAoC,IAAK;EACvF,MAAMC,2BAA2B,GAAIC,KAAU,IAAK;IAChD,MAAMC,KAAK,
|
|
1
|
+
{"version":3,"names":["React","useCallback","useContext","useLayoutEffect","useRef","useState","ScopedThemeContext","UnistylesShadowRegistry","copyComponentProperties","hasUnistyles","passForwardedRef","maybeWarnAboutMultipleUnistyles","jsx","_jsx","createUnistylesTouchableHighlight","Component","UnistylesTouchableHighlight","props","scope","relinkRef","undefined","hiddenUnderlays","setHiddenUnderlays","current","ref","style","remove","add","onHideUnderlay","count"],"sourceRoot":"../../../src","sources":["core/createUnistylesTouchableHighlight.tsx"],"mappings":";;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEzF,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,uBAAuB,QAAQ,UAAU;AAClD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,+BAA+B,QAAQ,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,iCAAiC,GAAIC,SAAoC,IAAK;EACvF,MAAMC,2BAA2B,GAAIC,KAAU,IAAK;IAChD,MAAMC,KAAK,GAAGhB,UAAU,CAACI,kBAAkB,CAAC;IAC5C,MAAMa,SAAS,GAAGf,MAAM,CAAagB,SAAS,CAAC;IAC/C,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGjB,QAAQ,CAAC,CAAC,CAAC;IAEzDF,eAAe,CAAC,MAAM;MAClB,IAAIkB,eAAe,GAAG,CAAC,EAAE;QACrBF,SAAS,CAACI,OAAO,GAAG,CAAC;MACzB;IACJ,CAAC,EAAE,CAACF,eAAe,CAAC,CAAC;;IAErB;IACA,MAAMG,GAAG,GAAGvB,WAAW,CAClBuB,GAAY,IAAK;MACdb,+BAA+B,CAACM,KAAK,CAACQ,KAAK,EAAE,oBAAoB,CAAC;MAElEN,SAAS,CAACI,OAAO,GAAG,MAAM;QACtB;QACAhB,uBAAuB,CAACmB,MAAM,CAACF,GAAG,CAAC;QACnC;QACAjB,uBAAuB,CAACoB,GAAG,CAACH,GAAG,EAAEP,KAAK,CAACQ,KAAK,EAAEP,KAAK,CAAC;MACxD,CAAC;MAED,OAAOR,gBAAgB,CACnBc,GAAG,EACHP,KAAK,CAACO,GAAG,EACT,MAAM;QACF;QACAjB,uBAAuB,CAACoB,GAAG,CAACH,GAAG,EAAEP,KAAK,CAACQ,KAAK,EAAEP,KAAK,CAAC;MACxD,CAAC,EACD,MAAM;QACFC,SAAS,CAACI,OAAO,GAAGH,SAAS;QAC7B;QACAb,uBAAuB,CAACmB,MAAM,CAACF,GAAG,CAAC;MACvC,CACJ,CAAC;IACL,CAAC,EACD,CAACP,KAAK,EAAEC,KAAK,CACjB,CAAC;IAED,IAAI,CAACT,YAAY,CAACQ,KAAK,CAACQ,KAAK,CAAC,EAAE;MAC5B,oBAAOZ,IAAA,CAACE,SAAS;QAAA,GAAKE;MAAK,CAAG,CAAC;IACnC;IAEA,oBACIJ,IAAA,CAACE,SAAS;MAAA,GACFE,KAAK;MACTO,GAAG,EAAEA,GAAI;MACTI,cAAc,EAAEA,CAAA,KAAM;QAClBN,kBAAkB,CAAEO,KAAK,IAAKA,KAAK,GAAG,CAAC,CAAC;QACxCZ,KAAK,CAACW,cAAc,GAAG,CAAC;MAC5B;IAAE,CACL,CAAC;EAEV,CAAC;EAED,OAAOpB,uBAAuB,CAACO,SAAS,EAAEC,2BAA2B,CAAC;AAC1E,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import * as unistyles from '../web/services';
|
|
4
|
-
import { checkForAnimated } from '../web/utils';
|
|
4
|
+
import { checkForAnimated, isGeneratedUnistyle } from '../web/utils';
|
|
5
5
|
export const getClassName = (unistyle, forChild) => {
|
|
6
6
|
if (!unistyle) {
|
|
7
7
|
return undefined;
|
|
@@ -9,6 +9,21 @@ export const getClassName = (unistyle, forChild) => {
|
|
|
9
9
|
const flattenedStyles = Array.isArray(unistyle) ? unistyle.flat(Number.POSITIVE_INFINITY) : [unistyle];
|
|
10
10
|
const animatedStyles = flattenedStyles.filter(checkForAnimated);
|
|
11
11
|
const regularStyles = flattenedStyles.filter(style => !checkForAnimated(style));
|
|
12
|
+
const [firstStyle, ...otherStyles] = regularStyles;
|
|
13
|
+
|
|
14
|
+
// Already processed by an outer Unistyles component, e.g. createUnistylesElement(Animated.View),
|
|
15
|
+
// styles added after it (like Reanimated's initial animated values) stay inline
|
|
16
|
+
if (firstStyle && isGeneratedUnistyle(firstStyle) && firstStyle.hash) {
|
|
17
|
+
const {
|
|
18
|
+
hash,
|
|
19
|
+
injectedClassName
|
|
20
|
+
} = firstStyle;
|
|
21
|
+
return [{
|
|
22
|
+
$$css: true,
|
|
23
|
+
hash,
|
|
24
|
+
injectedClassName
|
|
25
|
+
}, otherStyles.concat(animatedStyles)];
|
|
26
|
+
}
|
|
12
27
|
const {
|
|
13
28
|
hash,
|
|
14
29
|
injectedClassName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["unistyles","checkForAnimated","getClassName","unistyle","forChild","undefined","flattenedStyles","Array","isArray","flat","Number","POSITIVE_INFINITY","animatedStyles","filter","regularStyles","style","hash","injectedClassName","services","shadowRegistry","addStyles"
|
|
1
|
+
{"version":3,"names":["unistyles","checkForAnimated","isGeneratedUnistyle","getClassName","unistyle","forChild","undefined","flattenedStyles","Array","isArray","flat","Number","POSITIVE_INFINITY","animatedStyles","filter","regularStyles","style","firstStyle","otherStyles","hash","injectedClassName","$$css","concat","services","shadowRegistry","addStyles"],"sourceRoot":"../../../src","sources":["core/getClassname.ts"],"mappings":";;AAEA,OAAO,KAAKA,SAAS,MAAM,iBAAiB;AAC5C,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,cAAc;AAEpE,OAAO,MAAMC,YAAY,GAAGA,CAACC,QAA8D,EAAEC,QAAkB,KAAK;EAChH,IAAI,CAACD,QAAQ,EAAE;IACX,OAAOE,SAAS;EACpB;EAEA,MAAMC,eAAe,GAAGC,KAAK,CAACC,OAAO,CAACL,QAAQ,CAAC,GAAGA,QAAQ,CAACM,IAAI,CAACC,MAAM,CAACC,iBAAiB,CAAC,GAAG,CAACR,QAAQ,CAAC;EACtG,MAAMS,cAAc,GAAGN,eAAe,CAACO,MAAM,CAACb,gBAAgB,CAAC;EAC/D,MAAMc,aAAa,GAAGR,eAAe,CAACO,MAAM,CAAEE,KAAK,IAAK,CAACf,gBAAgB,CAACe,KAAK,CAAC,CAAC;EACjF,MAAM,CAACC,UAAU,EAAE,GAAGC,WAAW,CAAC,GAAGH,aAAa;;EAElD;EACA;EACA,IAAIE,UAAU,IAAIf,mBAAmB,CAACe,UAAU,CAAC,IAAIA,UAAU,CAACE,IAAI,EAAE;IAClE,MAAM;MAAEA,IAAI;MAAEC;IAAkB,CAAC,GAAGH,UAAU;IAE9C,OAAO,CAAC;MAAEI,KAAK,EAAE,IAAI;MAAEF,IAAI;MAAEC;IAAkB,CAAC,EAAEF,WAAW,CAACI,MAAM,CAACT,cAAc,CAAC,CAAC;EACzF;EAEA,MAAM;IAAEM,IAAI;IAAEC;EAAkB,CAAC,GAAGpB,SAAS,CAACuB,QAAQ,CAACC,cAAc,CAACC,SAAS,CAACV,aAAa,EAAEV,QAAQ,CAAC;EAExG,OAAOc,IAAI,GAAI,CAAC;IAAEE,KAAK,EAAE,IAAI;IAAEF,IAAI;IAAEC;EAAkB,CAAC,EAAEP,cAAc,CAAC,GAAaP,SAAS;AACnG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// whether a style prop (also nested arrays) holds a unistyle, the only styles Unistyles updates
|
|
4
|
+
// a view without one renders like a React Native view, it never links
|
|
5
|
+
export const hasUnistyles = style => {
|
|
6
|
+
if (Array.isArray(style)) {
|
|
7
|
+
return style.some(hasUnistyles);
|
|
8
|
+
}
|
|
9
|
+
if (!style || typeof style !== 'object') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// own keys only, like the registry. A unistyle starts with its `unistyles_` key, so it exits early
|
|
14
|
+
for (const key in style) {
|
|
15
|
+
if (key.startsWith('unistyles_') && Object.prototype.hasOwnProperty.call(style, key)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=hasUnistyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasUnistyles","style","Array","isArray","some","key","startsWith","Object","prototype","hasOwnProperty","call"],"sourceRoot":"../../../src","sources":["core/hasUnistyles.ts"],"mappings":";;AAAA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,KAAc,IAAc;EACrD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACG,IAAI,CAACJ,YAAY,CAAC;EACnC;EAEA,IAAI,CAACC,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACrC,OAAO,KAAK;EAChB;;EAEA;EACA,KAAK,MAAMI,GAAG,IAAIJ,KAAK,EAAE;IACrB,IAAII,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,IAAIC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACT,KAAK,EAAEI,GAAG,CAAC,EAAE;MAClF,OAAO,IAAI;IACf;EACJ;EAEA,OAAO,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { deepMergeObjects } from '../../utils';
|
|
5
5
|
import { getClassName } from '../getClassname';
|
|
6
6
|
import { useProxifiedUnistyles } from '../useProxifiedUnistyles';
|
|
@@ -11,9 +11,12 @@ import { maybeWarnAboutMultipleUnistyles } from '../warn';
|
|
|
11
11
|
// @ts-expect-error
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const withUnistyles = (Component, mappings) => {
|
|
14
|
-
return
|
|
14
|
+
return ({
|
|
15
|
+
ref,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
15
18
|
const narrowedProps = props;
|
|
16
|
-
const
|
|
19
|
+
const [classNames, animatedStyles] = getClassName(narrowedProps.style, true) ?? [];
|
|
17
20
|
const contentContainerStyleClassNames = getClassName(narrowedProps.contentContainerStyle);
|
|
18
21
|
const {
|
|
19
22
|
proxifiedRuntime,
|
|
@@ -32,7 +35,8 @@ export const withUnistyles = (Component, mappings) => {
|
|
|
32
35
|
...deepMergeObjects(mappingsProps, unistyleProps, props),
|
|
33
36
|
...(narrowedProps.style ? {
|
|
34
37
|
// Override default component styles with undefined values to reset them
|
|
35
|
-
|
|
38
|
+
// animated styles can't be a class, so they stay inline
|
|
39
|
+
style: animatedStyles?.length ? [emptyStyles, ...animatedStyles] : emptyStyles
|
|
36
40
|
} : {}),
|
|
37
41
|
...(narrowedProps.contentContainerStyle ? {
|
|
38
42
|
contentContainerStyle: contentContainerStyleClassNames
|
|
@@ -46,7 +50,6 @@ export const withUnistyles = (Component, mappings) => {
|
|
|
46
50
|
// prettier-ignore
|
|
47
51
|
maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
|
|
48
52
|
const NativeComponent = Component;
|
|
49
|
-
const [classNames] = styleClassNames ?? [];
|
|
50
53
|
return /*#__PURE__*/_jsx("div", {
|
|
51
54
|
className: classNames?.hash,
|
|
52
55
|
style: {
|
|
@@ -57,6 +60,6 @@ export const withUnistyles = (Component, mappings) => {
|
|
|
57
60
|
ref: ref
|
|
58
61
|
}, uniPropsKey || mappingsKey)
|
|
59
62
|
});
|
|
60
|
-
}
|
|
63
|
+
};
|
|
61
64
|
};
|
|
62
65
|
//# sourceMappingURL=withUnistyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","deepMergeObjects","getClassName","useProxifiedUnistyles","maybeWarnAboutMultipleUnistyles","jsx","_jsx","withUnistyles","Component","mappings","ref","props","narrowedProps","classNames","animatedStyles","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","key","mappingsKey","mappingsProps","uniPropsKey","unistyleProps","uniProps","emptyStyles","Object","fromEntries","entries","getOwnPropertyDescriptors","filter","startsWith","map","undefined","combinedProps","length","displayName","name","NativeComponent","className","hash","display","children"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAgF,OAAO;AAKnG,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,+BAA+B,QAAQ,SAAS;;AAEzD;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA,OAAO,MAAMC,aAAa,GAAGA,CACzBC,SAAqB,EACrBC,QAA8B,KAC7B;EAUD,OAAO,CAAC;IAAEC,GAAG;IAAE,GAAGC;EAA2E,CAAC,KAAK;IAC/F,MAAMC,aAAa,GAAGD,KAA4C;IAClE,MAAM,CAACE,UAAU,EAAEC,cAAc,CAAC,GAAGZ,YAAY,CAACU,aAAa,CAACG,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;IAClF,MAAMC,+BAA+B,GAAGd,YAAY,CAACU,aAAa,CAACK,qBAAqB,CAAC;IACzF,MAAM;MAAEC,gBAAgB;MAAEC;IAAe,CAAC,GAAGhB,qBAAqB,CAAC,CAAC;IAEpE,MAAM;MAAEiB,GAAG,EAAEC,WAAW;MAAE,GAAGC;IAAc,CAAC,GAAGb,QAAQ,GAAGA,QAAQ,CAACU,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzG,MAAM;MAAEE,GAAG,EAAEG,WAAW;MAAE,GAAGC;IAAc,CAAC,GAAGZ,aAAa,CAACa,QAAQ,GAC/Db,aAAa,CAACa,QAAQ,CAACN,cAAc,EAAED,gBAAgB,CAAC,GACxD,CAAC,CAAC;IAER,MAAMQ,WAAW,GAAGd,aAAa,CAACG,KAAK,GACjCY,MAAM,CAACC,WAAW,CACdD,MAAM,CAACE,OAAO,CAACF,MAAM,CAACG,yBAAyB,CAAClB,aAAa,CAACG,KAAK,CAAC,CAAC,CAChEgB,MAAM,CAAC,CAAC,CAACX,GAAG,CAAC,KAAK,CAACA,GAAG,CAACY,UAAU,CAAC,WAAW,CAAC,IAAI,CAACZ,GAAG,CAACY,UAAU,CAAC,GAAG,CAAC,CAAC,CACvEC,GAAG,CAAC,CAAC,CAACb,GAAG,CAAC,KAAK,CAACA,GAAG,EAAEc,SAAS,CAAC,CACxC,CAAC,GACDA,SAAS;IAEf,MAAMC,aAAa,GAAG;MAClB,GAAGlC,gBAAgB,CAACqB,aAAa,EAAEE,aAAa,EAAEb,KAAK,CAAC;MACxD,IAAIC,aAAa,CAACG,KAAK,GACjB;QACI;QACA;QACAA,KAAK,EAAED,cAAc,EAAEsB,MAAM,GAAG,CAACV,WAAW,EAAE,GAAGZ,cAAc,CAAC,GAAGY;MACvE,CAAC,GACD,CAAC,CAAC,CAAC;MACT,IAAId,aAAa,CAACK,qBAAqB,GACjC;QACIA,qBAAqB,EAAED;MAC3B,CAAC,GACD,CAAC,CAAC;IACZ,CAAQ;;IAER;IACA;IACAZ,+BAA+B,CAACQ,aAAa,CAACG,KAAK,EAAE,iBAAiBP,SAAS,CAAC6B,WAAW,IAAI7B,SAAS,CAAC8B,IAAI,IAAI,SAAS,GAAG,CAAC;IAC9H;IACA;IACAlC,+BAA+B,CAACQ,aAAa,CAACK,qBAAqB,EAAE,iBAAiBT,SAAS,CAAC6B,WAAW,IAAI7B,SAAS,CAAC8B,IAAI,IAAI,SAAS,GAAG,CAAC;IAE9I,MAAMC,eAAe,GAAG/B,SAA0B;IAElD,oBACIF,IAAA;MAAKkC,SAAS,EAAE3B,UAAU,EAAE4B,IAAK;MAAC1B,KAAK,EAAE;QAAE2B,OAAO,EAAE;MAAW,CAAE;MAAAC,QAAA,eAC7DrC,IAAA,CAACiC,eAAe;QAAA,GAAsCJ,aAAa;QAAEzB,GAAG,EAAEA;MAAI,GAAxDa,WAAW,IAAIF,WAA2C;IAAC,CAChF,CAAC;EAEd,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useContext, useEffect } from 'react';
|
|
4
4
|
import { ScopedThemeContext } from '../../components/ScopedThemeContext';
|
|
5
5
|
import { UnistylesShadowRegistry } from '../../specs';
|
|
6
|
-
import { deepMergeObjects } from '../../utils';
|
|
6
|
+
import { deepMergeObjects, isAnimatedStyleHandle } from '../../utils';
|
|
7
7
|
import { useProxifiedUnistyles } from '../useProxifiedUnistyles';
|
|
8
8
|
import { maybeWarnAboutMultipleUnistyles } from '../warn';
|
|
9
9
|
|
|
@@ -11,6 +11,22 @@ import { maybeWarnAboutMultipleUnistyles } from '../warn';
|
|
|
11
11
|
|
|
12
12
|
// @ts-expect-error
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
// Reanimated finds animated styles by their keys, merged with other styles they would hide them
|
|
15
|
+
// so keep every animated style as a separate entry and merge only the styles between them, in order
|
|
16
|
+
const mergeAroundAnimatedStyles = secrets => secrets.reduce((acc, secret) => {
|
|
17
|
+
const style = secret.uni__getStyles();
|
|
18
|
+
const lastStyle = acc.at(-1);
|
|
19
|
+
if (isAnimatedStyleHandle(style)) {
|
|
20
|
+
return acc.concat([style]);
|
|
21
|
+
}
|
|
22
|
+
if (lastStyle && !isAnimatedStyleHandle(lastStyle)) {
|
|
23
|
+
Object.assign(lastStyle, style);
|
|
24
|
+
return acc;
|
|
25
|
+
}
|
|
26
|
+
return acc.concat([{
|
|
27
|
+
...style
|
|
28
|
+
}]);
|
|
29
|
+
}, []);
|
|
14
30
|
export const getSecrets = (styleProps = {}) => {
|
|
15
31
|
const styles = Array.isArray(styleProps) ? styleProps.flat(Infinity) : [styleProps];
|
|
16
32
|
const secrets = styles.filter(Boolean).reduce((acc, style) => {
|
|
@@ -21,12 +37,15 @@ export const getSecrets = (styleProps = {}) => {
|
|
|
21
37
|
}]);
|
|
22
38
|
}, []);
|
|
23
39
|
return {
|
|
24
|
-
styles: secrets.reduce((acc, secret) => Object.assign(acc, secret.uni__getStyles()), {}),
|
|
40
|
+
styles: styles.some(isAnimatedStyleHandle) ? mergeAroundAnimatedStyles(secrets) : secrets.reduce((acc, secret) => Object.assign(acc, secret.uni__getStyles()), {}),
|
|
25
41
|
dependencies: secrets.flatMap(secret => secret.uni__dependencies)
|
|
26
42
|
};
|
|
27
43
|
};
|
|
28
44
|
export const withUnistyles = (Component, mappings) => {
|
|
29
|
-
return
|
|
45
|
+
return ({
|
|
46
|
+
ref,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
30
49
|
const narrowedProps = props;
|
|
31
50
|
const NativeComponent = Component;
|
|
32
51
|
|
|
@@ -83,6 +102,6 @@ export const withUnistyles = (Component, mappings) => {
|
|
|
83
102
|
...finalProps,
|
|
84
103
|
ref: ref
|
|
85
104
|
}, uniPropsKey || mappingsKey);
|
|
86
|
-
}
|
|
105
|
+
};
|
|
87
106
|
};
|
|
88
107
|
//# sourceMappingURL=withUnistyles.native.js.map
|