react-native-unistyles 3.0.0-beta.6 → 3.0.0-beta.8
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 +19 -0
- package/android/CMakeLists.txt +2 -1
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +4 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +29 -2
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +4 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +5 -0
- package/cxx/common/Helpers.h +85 -0
- package/cxx/core/HashGenerator.cpp +1 -1
- package/cxx/core/HostUnistyle.cpp +28 -4
- package/cxx/core/HostUnistyle.h +1 -0
- package/cxx/core/UnistyleWrapper.h +6 -6
- package/cxx/core/UnistylesCommitHook.cpp +20 -17
- package/cxx/core/UnistylesMountHook.cpp +2 -2
- package/cxx/core/UnistylesMountHook.h +1 -4
- package/cxx/core/UnistylesRegistry.cpp +8 -6
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -5
- package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +5 -1
- package/cxx/parser/Parser.cpp +79 -14
- package/cxx/shadowTree/ShadowTrafficController.h +10 -4
- package/cxx/shadowTree/ShadowTreeManager.cpp +38 -35
- package/lib/commonjs/components/native/Animated.js +2 -2
- package/lib/commonjs/components/native/Animated.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.js +29 -33
- package/lib/commonjs/components/native/ImageBackground.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 +1 -1
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +17 -10
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.js +5 -5
- package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +5 -1
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +5 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +3 -3
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/warn.js +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +2 -2
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +18 -9
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/hooks/useMedia.native.js +1 -1
- package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js +1 -1
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/useServerUnistyles.js +2 -2
- package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +1 -1
- 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 +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.native.js +3 -3
- package/lib/commonjs/specs/index.native.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +4 -4
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/object/filter.js +3 -3
- package/lib/commonjs/web/convert/object/filter.js.map +1 -1
- package/lib/commonjs/web/convert/object/transform.js +1 -1
- package/lib/commonjs/web/convert/object/transform.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -1
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/registry.js +1 -1
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +1 -1
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +1 -1
- package/lib/commonjs/web/utils/unistyle.js +5 -5
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/native/Animated.js +2 -2
- package/lib/module/components/native/Animated.js.map +1 -1
- package/lib/module/components/native/ImageBackground.js +29 -33
- package/lib/module/components/native/ImageBackground.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 +1 -1
- package/lib/module/components/native/Pressable.js.map +1 -1
- package/lib/module/components/native/Pressable.native.js +17 -10
- package/lib/module/components/native/Pressable.native.js.map +1 -1
- package/lib/module/core/createUnistylesElement.js +3 -3
- package/lib/module/core/createUnistylesElement.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +5 -1
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +5 -1
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +3 -3
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/warn.js +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.js +2 -2
- package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +19 -10
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/hooks/useMedia.native.js +1 -1
- package/lib/module/hooks/useMedia.native.js.map +1 -1
- package/lib/module/mq.js.map +1 -1
- package/lib/module/server/getServerUnistyles.js +1 -1
- package/lib/module/server/getServerUnistyles.js.map +1 -1
- package/lib/module/server/hydrateServerUnistyles.js +1 -1
- package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/module/server/resetServerUnistyles.js +1 -1
- package/lib/module/server/resetServerUnistyles.js.map +1 -1
- package/lib/module/server/useServerUnistyles.js +2 -2
- package/lib/module/server/useServerUnistyles.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +1 -1
- 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 +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.native.js +4 -4
- package/lib/module/specs/index.native.js.map +1 -1
- package/lib/module/web/convert/index.js +5 -5
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +2 -2
- package/lib/module/web/convert/object/boxShadow.js.map +1 -1
- package/lib/module/web/convert/object/filter.js +3 -3
- package/lib/module/web/convert/object/filter.js.map +1 -1
- package/lib/module/web/convert/object/transform.js +1 -1
- package/lib/module/web/convert/object/transform.js.map +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/index.js +1 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/registry.js +1 -1
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +1 -1
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -1
- package/lib/module/web/utils/unistyle.js +5 -5
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +2 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +1 -1
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.native.d.ts +4 -4
- package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +2 -2
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +1 -1
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +5 -5
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +2 -2
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +1 -1
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +2 -2
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +19 -19
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +1 -17
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +35 -0
- package/nitrogen/generated/android/unistyles+autolinking.cmake +16 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -1
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +3 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -3
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +18 -18
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
- package/nitrogen/generated/shared/c++/Dimensions.hpp +2 -1
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Insets.hpp +2 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
- package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +2 -1
- package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +2 -1
- package/package.json +31 -19
- package/plugin/index.d.ts +51 -18
- package/plugin/index.js +791 -189
- package/src/components/native/Animated.tsx +2 -2
- package/src/components/native/ImageBackground.tsx +6 -7
- package/src/components/native/NativeText.native.tsx +1 -1
- package/src/components/native/NativeView.native.tsx +1 -1
- package/src/components/native/Pressable.native.tsx +22 -12
- package/src/components/native/Pressable.tsx +1 -1
- package/src/core/createUnistylesElement.native.tsx +6 -1
- package/src/core/createUnistylesElement.tsx +3 -3
- package/src/core/createUnistylesImageBackground.tsx +6 -1
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +4 -4
- package/src/core/warn.ts +1 -1
- package/src/core/withUnistyles/withUnistyles.native.tsx +47 -19
- package/src/core/withUnistyles/withUnistyles.tsx +4 -4
- package/src/hooks/useMedia.native.ts +1 -1
- package/src/mq.ts +1 -1
- package/src/server/getServerUnistyles.tsx +1 -1
- package/src/server/hydrateServerUnistyles.ts +1 -1
- package/src/server/resetServerUnistyles.ts +1 -1
- package/src/server/useServerUnistyles.tsx +2 -2
- package/src/specs/ShadowRegistry/index.ts +1 -0
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -3
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +5 -5
- package/src/specs/index.native.ts +4 -4
- package/src/types/breakpoints.ts +2 -2
- package/src/types/core.ts +1 -1
- package/src/types/stylesheet.ts +5 -5
- package/src/web/convert/index.ts +5 -5
- package/src/web/convert/object/boxShadow.ts +2 -2
- package/src/web/convert/object/filter.ts +3 -3
- package/src/web/convert/object/transform.ts +2 -2
- package/src/web/convert/types.ts +1 -1
- package/src/web/convert/utils.ts +2 -2
- package/src/web/create.ts +1 -1
- package/src/web/index.ts +3 -3
- package/src/web/registry.ts +2 -2
- package/src/web/runtime.ts +2 -2
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/state.ts +4 -4
- package/src/web/utils/common.ts +1 -1
- package/src/web/utils/unistyle.ts +6 -6
- package/plugin/common.js +0 -142
- package/plugin/consts.js +0 -63
- package/plugin/exotic.js +0 -54
- package/plugin/import.js +0 -51
- package/plugin/ref.js +0 -11
- package/plugin/stylesheet.js +0 -239
- package/plugin/variants.js +0 -66
package/README.md
CHANGED
@@ -18,6 +18,19 @@
|
|
18
18
|
yarn add react-native-unistyles@beta
|
19
19
|
```
|
20
20
|
|
21
|
+
Install dependencies:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
yarn add react-native-edge-to-edge react-native-nitro-modules@0.22.1
|
25
|
+
```
|
26
|
+
|
27
|
+
> Always use fixed version of `react-native-nitro-modules` to avoid unexpected behaviors.
|
28
|
+
|
29
|
+
| react-native-unistyles | react-native-nitro-modules |
|
30
|
+
|------------------------|----------------------------|
|
31
|
+
| 3.0.0.beta.7 | 0.22.1 |
|
32
|
+
| 3.0.0.nightly-20250226 | 0.24.1 |
|
33
|
+
|
21
34
|
Then follow [installation guides](https://unistyl.es/v3/start/getting-started) for your platform.
|
22
35
|
|
23
36
|
## [Documentation](https://unistyl.es/)
|
@@ -74,6 +87,12 @@ Then follow [installation guides](https://unistyl.es/v3/start/getting-started) f
|
|
74
87
|
<a href="https://github.com/4cc3ssX">
|
75
88
|
<img src="https://avatars.githubusercontent.com/u/57473799?v=4" height="70px" width="70px" alt="4cc3ssX" />
|
76
89
|
</a>
|
90
|
+
<a href="https://github.com/dacoto97">
|
91
|
+
<img src="https://avatars.githubusercontent.com/u/16915053?v=4" height="70px" width="70px" alt="dacoto97" />
|
92
|
+
</a>
|
93
|
+
<a href="https://github.com/chinamcafee">
|
94
|
+
<img src="https://avatars.githubusercontent.com/u/3439961?v=4" height="70px" width="70px" alt="chinamcafee" />
|
95
|
+
</a>
|
77
96
|
|
78
97
|
## Past sponsors
|
79
98
|
|
package/android/CMakeLists.txt
CHANGED
@@ -23,7 +23,8 @@ include_directories(
|
|
23
23
|
../cxx/shadowTree
|
24
24
|
)
|
25
25
|
|
26
|
-
|
26
|
+
# Nitro appends all Folly Flags, leaving it empty
|
27
|
+
string(APPEND CMAKE_CXX_FLAGS " ")
|
27
28
|
|
28
29
|
set_target_properties(unistyles PROPERTIES
|
29
30
|
CXX_STANDARD 20
|
@@ -6,11 +6,13 @@ import android.os.Build
|
|
6
6
|
import android.util.DisplayMetrics
|
7
7
|
import android.view.View
|
8
8
|
import android.view.WindowManager
|
9
|
+
import androidx.annotation.Keep
|
9
10
|
import androidx.core.text.TextUtilsCompat
|
10
11
|
import androidx.core.view.ViewCompat
|
11
12
|
import androidx.core.view.WindowCompat
|
12
13
|
import androidx.core.view.WindowInsetsCompat
|
13
14
|
import androidx.core.view.WindowInsetsControllerCompat
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
14
16
|
import com.facebook.react.bridge.LifecycleEventListener
|
15
17
|
import com.facebook.react.bridge.ReactApplicationContext
|
16
18
|
import com.margelo.nitro.unistyles.ColorScheme
|
@@ -22,6 +24,8 @@ import com.margelo.nitro.unistyles.UnistyleDependency
|
|
22
24
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
23
25
|
import java.util.Locale
|
24
26
|
|
27
|
+
@Keep
|
28
|
+
@DoNotStrip
|
25
29
|
class NativePlatformAndroid(private val reactContext: ReactApplicationContext): HybridNativePlatformSpec(), LifecycleEventListener {
|
26
30
|
private val _insets = NativePlatformInsets(reactContext, this::getMiniRuntime) { this.diffMiniRuntime() }
|
27
31
|
private var _miniRuntime: UnistylesNativeMiniRuntime = buildMiniRuntime()
|
@@ -5,9 +5,11 @@ import android.os.Build
|
|
5
5
|
import android.view.View
|
6
6
|
import android.view.Window
|
7
7
|
import android.view.WindowManager
|
8
|
+
import androidx.annotation.Keep
|
8
9
|
import androidx.core.view.ViewCompat
|
9
10
|
import androidx.core.view.WindowInsetsAnimationCompat
|
10
11
|
import androidx.core.view.WindowInsetsCompat
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
11
13
|
import com.facebook.react.bridge.ReactApplicationContext
|
12
14
|
import com.margelo.nitro.unistyles.Insets
|
13
15
|
import com.margelo.nitro.unistyles.UnistyleDependency
|
@@ -15,14 +17,28 @@ import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
|
15
17
|
|
16
18
|
typealias CxxImeListener = (miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
17
19
|
|
20
|
+
@Keep
|
21
|
+
@DoNotStrip
|
18
22
|
class NativePlatformInsets(
|
19
23
|
private val reactContext: ReactApplicationContext,
|
20
24
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
21
25
|
private val diffMiniRuntime: () -> Array<UnistyleDependency>
|
22
26
|
) {
|
27
|
+
private var _shouldListenToImeEvents = false
|
23
28
|
private val _imeListeners: MutableList<CxxImeListener> = mutableListOf()
|
24
29
|
private var _insets: Insets = Insets(0.0, 0.0, 0.0, 0.0, 0.0)
|
25
30
|
|
31
|
+
init {
|
32
|
+
// get initial insets
|
33
|
+
reactContext.currentActivity?.let { activity ->
|
34
|
+
val insets = ViewCompat.getRootWindowInsets(activity.window.decorView)
|
35
|
+
|
36
|
+
insets?.let { windowInsets ->
|
37
|
+
setInsets(windowInsets, activity.window, null, true)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
26
42
|
fun onDestroy() {
|
27
43
|
this.removeImeListeners()
|
28
44
|
}
|
@@ -39,7 +55,7 @@ class NativePlatformInsets(
|
|
39
55
|
)
|
40
56
|
}
|
41
57
|
|
42
|
-
fun setInsets(insetsCompat: WindowInsetsCompat, window: Window, animatedBottomInsets: Double
|
58
|
+
fun setInsets(insetsCompat: WindowInsetsCompat, window: Window, animatedBottomInsets: Double?, skipUpdate: Boolean = false) {
|
43
59
|
// below Android 11, we need to use window flags to detect status bar visibility
|
44
60
|
val isStatusBarVisible = when(Build.VERSION.SDK_INT) {
|
45
61
|
in 30..Int.MAX_VALUE -> {
|
@@ -86,6 +102,10 @@ class NativePlatformInsets(
|
|
86
102
|
imeInsets
|
87
103
|
)
|
88
104
|
|
105
|
+
if (skipUpdate) {
|
106
|
+
return
|
107
|
+
}
|
108
|
+
|
89
109
|
diffMiniRuntime()
|
90
110
|
|
91
111
|
if (shouldEmitImeEvent) {
|
@@ -94,6 +114,8 @@ class NativePlatformInsets(
|
|
94
114
|
}
|
95
115
|
|
96
116
|
fun startInsetsListener() {
|
117
|
+
_shouldListenToImeEvents = true
|
118
|
+
|
97
119
|
reactContext.currentActivity?.let { activity ->
|
98
120
|
activity.findViewById<View>(android.R.id.content)?.let { mainView ->
|
99
121
|
ViewCompat.setOnApplyWindowInsetsListener(mainView) { _, insets ->
|
@@ -111,6 +133,10 @@ class NativePlatformInsets(
|
|
111
133
|
insets: WindowInsetsCompat,
|
112
134
|
runningAnimations: List<WindowInsetsAnimationCompat>
|
113
135
|
): WindowInsetsCompat {
|
136
|
+
if (!_shouldListenToImeEvents) {
|
137
|
+
return insets
|
138
|
+
}
|
139
|
+
|
114
140
|
runningAnimations.firstOrNull()?.let {
|
115
141
|
val bottomInset = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom.toDouble() - this@NativePlatformInsets._insets.bottom
|
116
142
|
val nextBottomInset = if (bottomInset < 0) {
|
@@ -141,9 +167,10 @@ class NativePlatformInsets(
|
|
141
167
|
reactContext.currentActivity?.let { activity ->
|
142
168
|
activity.window?.decorView?.let { view ->
|
143
169
|
ViewCompat.setOnApplyWindowInsetsListener(view, null)
|
144
|
-
ViewCompat.setWindowInsetsAnimationCallback(view, null)
|
145
170
|
}
|
146
171
|
}
|
172
|
+
|
173
|
+
_shouldListenToImeEvents = false
|
147
174
|
}
|
148
175
|
|
149
176
|
fun addImeListener(listener: CxxImeListener) {
|
@@ -6,12 +6,16 @@ import android.content.Intent
|
|
6
6
|
import android.content.IntentFilter
|
7
7
|
import android.os.Handler
|
8
8
|
import android.os.Looper
|
9
|
+
import androidx.annotation.Keep
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
9
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
10
12
|
import com.margelo.nitro.unistyles.UnistyleDependency
|
11
13
|
import com.margelo.nitro.unistyles.UnistylesNativeMiniRuntime
|
12
14
|
|
13
15
|
typealias CxxDependencyListener = (dependencies: Array<UnistyleDependency>, miniRuntime: UnistylesNativeMiniRuntime) -> Unit
|
14
16
|
|
17
|
+
@Keep
|
18
|
+
@DoNotStrip
|
15
19
|
class NativePlatformListener(
|
16
20
|
private val reactContext: ReactApplicationContext,
|
17
21
|
private val getMiniRuntime: () -> UnistylesNativeMiniRuntime,
|
@@ -11,6 +11,7 @@ import com.facebook.react.turbomodule.core.interfaces.TurboModuleWithJSIBindings
|
|
11
11
|
import com.facebook.react.uimanager.UIManagerHelper
|
12
12
|
import com.facebook.react.uimanager.common.UIManagerType
|
13
13
|
import com.margelo.nitro.unistyles.HybridNativePlatformSpec
|
14
|
+
import com.margelo.nitro.unistyles.unistylesOnLoad.Companion.initializeNative
|
14
15
|
|
15
16
|
@Suppress("KotlinJniMissingFunction")
|
16
17
|
class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistylesSpec(reactContext), TurboModuleWithJSIBindings {
|
@@ -20,6 +21,10 @@ class UnistylesModule(reactContext: ReactApplicationContext): NativeTurboUnistyl
|
|
20
21
|
|
21
22
|
companion object {
|
22
23
|
const val NAME = NativeTurboUnistylesSpec.NAME
|
24
|
+
|
25
|
+
init {
|
26
|
+
initializeNative()
|
27
|
+
}
|
23
28
|
}
|
24
29
|
|
25
30
|
init {
|
package/cxx/common/Helpers.h
CHANGED
@@ -225,4 +225,89 @@ inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vec
|
|
225
225
|
return result;
|
226
226
|
}
|
227
227
|
|
228
|
+
inline void debugPrintJSIObject(jsi::Runtime& rt, std::string& name, jsi::Object& obj) {
|
229
|
+
auto console = rt.global().getPropertyAsObject(rt, "console");
|
230
|
+
auto log = console.getPropertyAsFunction(rt, "log");
|
231
|
+
auto parser = [&](const std::string& key, jsi::Value& value){
|
232
|
+
if (value.isBool()) {
|
233
|
+
std::string output = key + ": " + (value.getBool() ? "true" : "false");
|
234
|
+
log.call(rt, output);
|
235
|
+
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
|
239
|
+
if (value.isNumber()) {
|
240
|
+
std::string output = key + ": " + std::to_string(value.getNumber());
|
241
|
+
log.call(rt, output);
|
242
|
+
|
243
|
+
return;
|
244
|
+
}
|
245
|
+
|
246
|
+
if (value.isString()) {
|
247
|
+
std::string output = key + ": " + value.getString(rt).utf8(rt);
|
248
|
+
log.call(rt, output);
|
249
|
+
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
|
253
|
+
if (value.isUndefined()) {
|
254
|
+
std::string output = key + ": undefined";
|
255
|
+
log.call(rt, output);
|
256
|
+
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
260
|
+
if (value.isNull()) {
|
261
|
+
std::string output = key + ": null";
|
262
|
+
log.call(rt, output);
|
263
|
+
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
};
|
267
|
+
|
268
|
+
log.call(rt, "===" + name + "===");
|
269
|
+
|
270
|
+
enumerateJSIObject(rt, obj, [&](const std::string& key, jsi::Value& value){
|
271
|
+
if (value.isObject()) {
|
272
|
+
if (value.asObject(rt).isArray(rt)) {
|
273
|
+
iterateJSIArray(rt, value.asObject(rt).asArray(rt), [&](size_t i, jsi::Value& nestedValue){
|
274
|
+
std::string printableKey = key + ": Array[" + std::to_string(i) + "]";
|
275
|
+
|
276
|
+
log.call(rt, printableKey);
|
277
|
+
|
278
|
+
if (nestedValue.isObject()) {
|
279
|
+
enumerateJSIObject(rt, nestedValue.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
280
|
+
parser(nestedKey, nestedValue);
|
281
|
+
});
|
282
|
+
} else {
|
283
|
+
parser(printableKey, nestedValue);
|
284
|
+
}
|
285
|
+
|
286
|
+
std::string endKey = key + ": Array[end]";
|
287
|
+
|
288
|
+
log.call(rt, endKey);
|
289
|
+
});
|
290
|
+
}
|
291
|
+
|
292
|
+
if (value.asObject(rt).isFunction(rt)) {
|
293
|
+
std::string output = key + ": [Function]";
|
294
|
+
|
295
|
+
log.call(rt, output);
|
296
|
+
|
297
|
+
return;
|
298
|
+
}
|
299
|
+
|
300
|
+
enumerateJSIObject(rt, value.asObject(rt), [&](const std::string& nestedKey, jsi::Value& nestedValue){
|
301
|
+
parser(nestedKey, nestedValue);
|
302
|
+
});
|
303
|
+
|
304
|
+
return;
|
305
|
+
}
|
306
|
+
|
307
|
+
parser(key, value);
|
308
|
+
});
|
309
|
+
|
310
|
+
log.call(rt, "===/" + name + "===");
|
311
|
+
}
|
312
|
+
|
228
313
|
}
|
@@ -17,7 +17,7 @@ std::string HashGenerator::generateHash(const std::string& input) {
|
|
17
17
|
std::stringstream ss;
|
18
18
|
ss << std::hex << std::setfill('0') << std::setw(8) << (combinedHash & 0xFFFFFFFF);
|
19
19
|
|
20
|
-
return "
|
20
|
+
return "unistyles_" + ss.str();
|
21
21
|
}
|
22
22
|
|
23
23
|
}
|
@@ -39,14 +39,40 @@ jsi::Value HostUnistyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId
|
|
39
39
|
auto& unistyle = this->_stylesheet->unistyles[propertyName];
|
40
40
|
|
41
41
|
// check if Unistyles recomputed new style in the background
|
42
|
-
// (
|
42
|
+
// (when no node was mounted), if so we need to simply rebuild unistyle to get fresh data
|
43
43
|
if (unistyle->isDirty) {
|
44
|
+
this->_cache.erase(propertyName);
|
45
|
+
|
44
46
|
auto parser = parser::Parser(this->_unistylesRuntime);
|
45
47
|
|
46
48
|
parser.rebuildUnistyle(rt, unistyle, this->_variants, std::nullopt);
|
47
49
|
}
|
48
50
|
|
49
|
-
|
51
|
+
if (unistyle->type == UnistyleType::DynamicFunction) {
|
52
|
+
// for dynamic functions we will also bind "this"
|
53
|
+
auto styleFn = valueFromUnistyle(rt, this->_unistylesRuntime, unistyle, this->_variants);
|
54
|
+
|
55
|
+
// construct newThis
|
56
|
+
jsi::Object newThis = jsi::Object(rt);
|
57
|
+
newThis.setProperty(rt, helpers::STYLESHEET_VARIANTS.c_str(), helpers::variantsToValue(rt, this->_variants));
|
58
|
+
|
59
|
+
auto functionPrototype = rt.global()
|
60
|
+
.getPropertyAsObject(rt, "Function")
|
61
|
+
.getPropertyAsObject(rt, "prototype")
|
62
|
+
.getPropertyAsFunction(rt, "bind");
|
63
|
+
|
64
|
+
return functionPrototype.callWithThis(rt, styleFn.asObject(rt), newThis);
|
65
|
+
}
|
66
|
+
|
67
|
+
if (this->_cache.contains(propertyName)) {
|
68
|
+
return jsi::Value(rt, this->_cache[propertyName]);
|
69
|
+
}
|
70
|
+
|
71
|
+
auto style = valueFromUnistyle(rt, this->_unistylesRuntime, unistyle, this->_variants);
|
72
|
+
|
73
|
+
this->_cache.emplace(propertyName, jsi::Value(rt, style));
|
74
|
+
|
75
|
+
return style;
|
50
76
|
}
|
51
77
|
|
52
78
|
void HostUnistyle::set(jsi::Runtime& rt, const jsi::PropNameID& propNameId, const jsi::Value& value) {}
|
@@ -73,8 +99,6 @@ jsi::Function HostUnistyle::createAddVariantsProxyFunction(jsi::Runtime& rt) {
|
|
73
99
|
}
|
74
100
|
});
|
75
101
|
|
76
|
-
this->_variants = variants;
|
77
|
-
|
78
102
|
auto style = std::make_shared<core::HostUnistyle>(this->_stylesheet, this->_unistylesRuntime, variants);
|
79
103
|
auto styleHostObject = jsi::Object::createFromHostObject(rt, style);
|
80
104
|
|
package/cxx/core/HostUnistyle.h
CHANGED
@@ -35,7 +35,7 @@ inline static Unistyle::Shared unistyleFromStaticStyleSheet(jsi::Runtime& rt, js
|
|
35
35
|
|
36
36
|
inline static std::vector<std::string> getUnistylesHashKeys(jsi::Runtime& rt, jsi::Object& object) {
|
37
37
|
std::vector<std::string> matchingKeys{};
|
38
|
-
const std::string prefix = "
|
38
|
+
const std::string prefix = "unistyles_";
|
39
39
|
|
40
40
|
auto propertyNames = object.getPropertyNames(rt);
|
41
41
|
size_t length = propertyNames.length(rt);
|
@@ -82,13 +82,13 @@ inline static std::vector<Unistyle::Shared> unistylesFromNonExistentNativeState(
|
|
82
82
|
|
83
83
|
You likely altered unistyle hash key and we're not able to recover C++ state attached to this node.)");
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
// someone merged unistyles, and will be warned in JS
|
87
87
|
// the best we can do is to return first unistyle
|
88
88
|
if (unistyles.size() > 1) {
|
89
89
|
return {unistyles.at(0)};
|
90
90
|
}
|
91
|
-
|
91
|
+
|
92
92
|
return unistyles;
|
93
93
|
}
|
94
94
|
|
@@ -137,7 +137,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
137
137
|
auto parsedArguments = arguments.has_value()
|
138
138
|
? helpers::parseDynamicFunctionArguments(rt, arguments.value())
|
139
139
|
: std::optional<std::vector<folly::dynamic>>{};
|
140
|
-
|
140
|
+
|
141
141
|
if (arguments.has_value()) {
|
142
142
|
// this is required for HybridShadowRegistry::link
|
143
143
|
helpers::defineHiddenProperty(rt, secrets, helpers::ARGUMENTS.c_str(), arguments.value());
|
@@ -148,7 +148,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
148
148
|
|
149
149
|
// this is required for withUnistyles
|
150
150
|
helpers::defineHiddenProperty(rt, secrets, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
|
151
|
-
|
151
|
+
|
152
152
|
// this is required for withUnistyles
|
153
153
|
auto hostFn = jsi::Function::createFromHostFunction(
|
154
154
|
rt,
|
@@ -160,7 +160,7 @@ inline static jsi::Value objectFromUnistyle(jsi::Runtime& rt, std::shared_ptr<Hy
|
|
160
160
|
|
161
161
|
return jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
|
162
162
|
});
|
163
|
-
|
163
|
+
|
164
164
|
helpers::defineHiddenProperty(rt, secrets, helpers::GET_STYLES.c_str(), std::move(hostFn));
|
165
165
|
|
166
166
|
obj.setProperty(rt, unistyleID, secrets);
|
@@ -29,21 +29,24 @@ RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
|
29
29
|
// this is React Native / Reanimated commit
|
30
30
|
// merge Unistyles updates before it completes
|
31
31
|
auto& registry = core::UnistylesRegistry::get();
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
32
|
+
|
33
|
+
return registry.trafficController.withLock([&](){
|
34
|
+
auto& shadowLeafUpdates = registry.trafficController.getUpdates();
|
35
|
+
|
36
|
+
// oops, no updates from Unistyles yet, skip it!
|
37
|
+
if (shadowLeafUpdates.size() == 0) {
|
38
|
+
return newRootShadowNode;
|
39
|
+
}
|
40
|
+
|
41
|
+
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates);
|
42
|
+
|
43
|
+
registry.trafficController.stopUnistylesTraffic();
|
44
|
+
|
45
|
+
// we have few updates, so merge it
|
46
|
+
return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
47
|
+
*rootNode,
|
48
|
+
shadowLeafUpdates,
|
49
|
+
affectedNodes
|
50
|
+
));
|
51
|
+
});
|
49
52
|
}
|
@@ -22,7 +22,7 @@ void core::UnistylesMountHook::shadowTreeDidMount(RootShadowNode::Shared const &
|
|
22
22
|
// one more time merge Unistyles changes
|
23
23
|
auto& registry = core::UnistylesRegistry::get();
|
24
24
|
|
25
|
-
if (
|
26
|
-
|
25
|
+
if (registry.trafficController.shouldStop()) {
|
26
|
+
registry.trafficController.resumeUnistylesTraffic();
|
27
27
|
}
|
28
28
|
}
|
@@ -3,15 +3,13 @@
|
|
3
3
|
#include <react/renderer/uimanager/UIManager.h>
|
4
4
|
#include <react/renderer/uimanager/UIManagerMountHook.h>
|
5
5
|
#include "ShadowTreeManager.h"
|
6
|
-
#include "HybridUnistylesRuntime.h"
|
7
6
|
|
8
7
|
namespace margelo::nitro::unistyles::core {
|
9
8
|
|
10
9
|
using namespace facebook::react;
|
11
10
|
|
12
11
|
struct UnistylesMountHook : public UIManagerMountHook {
|
13
|
-
UnistylesMountHook(std::shared_ptr<UIManager> uiManager
|
14
|
-
: _uiManager{uiManager}, _unistylesRuntime{unistylesRuntime} {
|
12
|
+
UnistylesMountHook(std::shared_ptr<UIManager> uiManager): _uiManager{uiManager} {
|
15
13
|
_uiManager->registerMountHook(*this);
|
16
14
|
}
|
17
15
|
|
@@ -21,7 +19,6 @@ struct UnistylesMountHook : public UIManagerMountHook {
|
|
21
19
|
|
22
20
|
private:
|
23
21
|
std::shared_ptr<UIManager> _uiManager;
|
24
|
-
std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
|
25
22
|
};
|
26
23
|
|
27
24
|
}
|
@@ -108,12 +108,14 @@ void core::UnistylesRegistry::removeDuplicatedUnistyles(jsi::Runtime& rt, const
|
|
108
108
|
}
|
109
109
|
|
110
110
|
void core::UnistylesRegistry::unlinkShadowNodeWithUnistyles(jsi::Runtime& rt, const ShadowNodeFamily* shadowNodeFamily) {
|
111
|
-
this->
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
this->_shadowRegistry.
|
116
|
-
|
111
|
+
this->trafficController.withLock([this, &rt, shadowNodeFamily](){
|
112
|
+
this->_shadowRegistry[&rt].erase(shadowNodeFamily);
|
113
|
+
this->trafficController.removeShadowNode(shadowNodeFamily);
|
114
|
+
|
115
|
+
if (this->_shadowRegistry[&rt].empty()) {
|
116
|
+
this->_shadowRegistry.erase(&rt);
|
117
|
+
}
|
118
|
+
});
|
117
119
|
}
|
118
120
|
|
119
121
|
std::shared_ptr<core::StyleSheet> core::UnistylesRegistry::addStyleSheet(jsi::Runtime& rt, int unid, core::StyleSheetType type, jsi::Object&& rawValue) {
|
@@ -49,7 +49,6 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
49
49
|
}
|
50
50
|
|
51
51
|
auto parser = parser::Parser(this->_unistylesRuntime);
|
52
|
-
auto parsedStyleSheet = jsi::Value::undefined();
|
53
52
|
std::vector<std::shared_ptr<core::UnistyleData>> unistylesData{};
|
54
53
|
|
55
54
|
// create unistyleData based on wrappers
|
@@ -77,10 +76,8 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
|
|
77
76
|
);
|
78
77
|
|
79
78
|
// before linking we need to check if given unistyle is affected by scoped theme
|
80
|
-
if (scopedTheme.has_value()) {
|
81
|
-
|
82
|
-
parsedStyleSheet = parser.getParsedStyleSheetForScopedTheme(rt, unistyle, scopedTheme.value());
|
83
|
-
}
|
79
|
+
if (scopedTheme.has_value() && unistyle->styleKey != helpers::EXOTIC_STYLE_KEY) {
|
80
|
+
auto parsedStyleSheet = parser.getParsedStyleSheetForScopedTheme(rt, unistyle, scopedTheme.value());
|
84
81
|
|
85
82
|
// if so we need to force update
|
86
83
|
parser.rebuildUnistyleWithScopedTheme(rt, parsedStyleSheet, unistyleData);
|
@@ -261,7 +261,7 @@ void HybridStyleSheet::registerHooks(jsi::Runtime& rt) {
|
|
261
261
|
core::UnistylesRegistry::get().trafficController.restore();
|
262
262
|
|
263
263
|
this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager);
|
264
|
-
this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager
|
264
|
+
this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager);
|
265
265
|
}
|
266
266
|
|
267
267
|
void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependency> dependencies) {
|
@@ -73,9 +73,13 @@ void HybridUnistylesRuntime::setTheme(const std::string &themeName) {
|
|
73
73
|
helpers::assertThat(*_rt, !this->getHasAdaptiveThemes(), "Unistyles: You're trying to set theme to: '" + themeName + "', but adaptiveThemes are enabled.");
|
74
74
|
|
75
75
|
auto& state = core::UnistylesRegistry::get().getState(*_rt);
|
76
|
+
auto currentThemeName = state.getCurrentThemeName();
|
76
77
|
|
77
78
|
state.setTheme(themeName);
|
78
|
-
|
79
|
+
|
80
|
+
if (currentThemeName.value() != themeName) {
|
81
|
+
this->_onDependenciesChange({UnistyleDependency::THEME, UnistyleDependency::THEMENAME});
|
82
|
+
}
|
79
83
|
};
|
80
84
|
|
81
85
|
void HybridUnistylesRuntime::setAdaptiveThemes(bool isEnabled) {
|