react-native-unistyles 3.0.0-nightly-20250513 → 3.0.0-nightly-20250526
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 +10 -7
- package/android/src/main/cxx/NativeUnistylesModule.cpp +3 -7
- package/android/src/main/cxx/NativeUnistylesModule.h +0 -4
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +1 -7
- package/cxx/core/UnistylesCommitShadowNode.h +0 -21
- package/cxx/core/UnistylesRegistry.cpp +45 -43
- package/cxx/hybridObjects/HybridStyleSheet.cpp +0 -13
- package/cxx/hybridObjects/HybridStyleSheet.h +2 -7
- package/cxx/parser/Parser.cpp +150 -107
- package/cxx/shadowTree/ShadowTreeManager.cpp +36 -33
- package/cxx/shadowTree/ShadowTreeManager.h +0 -1
- package/ios/UnistylesModuleOnLoad.h +1 -5
- package/ios/UnistylesModuleOnLoad.mm +5 -13
- package/lib/commonjs/components/ScopedTheme.js +1 -2
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/components/native/Image.js +1 -2
- package/lib/commonjs/components/native/Image.js.map +1 -1
- package/lib/commonjs/components/native/ImageBackground.js +1 -2
- package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.js +1 -2
- package/lib/commonjs/components/native/Pressable.js.map +1 -1
- package/lib/commonjs/components/native/Pressable.native.js +1 -2
- package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesElement.native.js +2 -28
- package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
- package/lib/commonjs/core/createUnistylesImageBackground.js +6 -21
- package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/commonjs/core/getClassname.js +1 -2
- package/lib/commonjs/core/getClassname.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js +1 -2
- package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.js +1 -2
- package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +1 -2
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/commonjs/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/commonjs/server/getServerUnistyles.js +1 -2
- package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/hydrateServerUnistyles.js +1 -2
- package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
- package/lib/commonjs/server/resetServerUnistyles.js +1 -2
- package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
- package/lib/commonjs/web/create.js +1 -2
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/css/core.js +6 -1
- package/lib/commonjs/web/css/core.js.map +1 -1
- package/lib/commonjs/web/index.js +1 -2
- package/lib/commonjs/web/index.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/utils/createUnistylesRef.js +1 -2
- package/lib/commonjs/web/utils/createUnistylesRef.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +1 -2
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/core/createUnistylesElement.native.js +1 -26
- package/lib/module/core/createUnistylesElement.native.js.map +1 -1
- package/lib/module/core/createUnistylesImageBackground.js +5 -19
- package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.js.map +1 -1
- package/lib/module/reanimated/useAnimatedTheme.native.js.map +1 -1
- package/lib/module/web/css/core.js +6 -1
- package/lib/module/web/css/core.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/typescript/plugin/src/consts.d.ts +17 -0
- package/lib/typescript/plugin/src/consts.d.ts.map +1 -0
- package/lib/typescript/repack-plugin/src/index.d.ts +18 -0
- package/lib/typescript/repack-plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/repack-plugin/src/loader.d.ts +9 -0
- package/lib/typescript/repack-plugin/src/loader.d.ts.map +1 -0
- package/lib/typescript/src/components/native/Animated.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
- package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
- package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/core/warn.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/hooks/useMedia.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts +3 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.d.ts.map +1 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts +3 -1
- package/lib/typescript/src/reanimated/useAnimatedTheme.native.d.ts.map +1 -1
- package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/server/serialize.d.ts.map +1 -1
- package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/css/core.d.ts.map +1 -1
- package/lib/typescript/src/web/css/state.d.ts.map +1 -1
- package/lib/typescript/src/web/css/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/createUnistylesRef.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/lib/typescript/src/web/variants.d.ts.map +1 -1
- package/lib/typescript/src/web-only/getWebProps.d.ts.map +1 -1
- package/package.json +32 -21
- package/plugin/index.d.ts +5 -4
- package/plugin/index.js +9 -1
- package/reanimated/package.json +6 -0
- package/repack-plugin/index.d.ts +19 -0
- package/repack-plugin/index.js +152 -0
- package/src/core/createUnistylesElement.native.tsx +1 -29
- package/src/core/createUnistylesImageBackground.tsx +7 -22
- package/src/index.ts +8 -0
- package/src/reanimated/useAnimatedTheme.native.ts +3 -3
- package/src/reanimated/useAnimatedTheme.ts +3 -3
- package/src/web/css/core.ts +9 -1
- package/src/web/shadowRegistry.ts +1 -1
- package/web/package.json +6 -0
- package/cxx/core/UnistylesCommitHook.cpp +0 -59
- package/cxx/core/UnistylesCommitHook.h +0 -27
- package/cxx/core/UnistylesMountHook.cpp +0 -26
- package/cxx/core/UnistylesMountHook.h +0 -24
- package/lib/module/package.json +0 -1
@@ -1,43 +1,15 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
import { UnistylesShadowRegistry } from '../specs'
|
3
3
|
import { copyComponentProperties } from '../utils'
|
4
4
|
import { passForwardedRef } from './passForwardRef'
|
5
5
|
import { maybeWarnAboutMultipleUnistyles } from './warn'
|
6
6
|
|
7
|
-
const getNativeRef = (Component: any, ref: any) => {
|
8
|
-
switch (Component.name) {
|
9
|
-
case 'KeyboardAvoidingView':
|
10
|
-
return ref.viewRef?.current
|
11
|
-
case 'FlatList':
|
12
|
-
return ref.getNativeScrollRef?.()
|
13
|
-
case 'VirtualizedList':
|
14
|
-
return ref.getScrollRef?.()
|
15
|
-
default:
|
16
|
-
return ref
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
7
|
export const createUnistylesElement = (Component: any) => {
|
21
8
|
const UnistylesComponent = React.forwardRef((props, forwardedRef) => {
|
22
|
-
const storedRef = useRef<unknown>(null)
|
23
|
-
|
24
|
-
useLayoutEffect(() => {
|
25
|
-
return () => {
|
26
|
-
if (storedRef.current) {
|
27
|
-
// @ts-ignore
|
28
|
-
UnistylesShadowRegistry.remove(storedRef.current)
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}, [])
|
32
|
-
|
33
9
|
return (
|
34
10
|
<Component
|
35
11
|
{...props}
|
36
12
|
ref={(ref: unknown) => {
|
37
|
-
if (ref) {
|
38
|
-
storedRef.current = getNativeRef(Component, ref)
|
39
|
-
}
|
40
|
-
|
41
13
|
// @ts-ignore we don't know the type of the component
|
42
14
|
maybeWarnAboutMultipleUnistyles(props.style, Component.displayName)
|
43
15
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import React
|
2
|
-
import type {
|
1
|
+
import React from 'react'
|
2
|
+
import type { ImageBackground, ImageBackgroundProps } from 'react-native'
|
3
3
|
import { UnistylesShadowRegistry } from '../specs'
|
4
4
|
import { copyComponentProperties } from '../utils'
|
5
5
|
import { passForwardedRef } from './passForwardRef'
|
@@ -7,17 +7,6 @@ import { maybeWarnAboutMultipleUnistyles } from './warn'
|
|
7
7
|
|
8
8
|
export const createUnistylesImageBackground = (Component: typeof ImageBackground) => {
|
9
9
|
const UnistylesImageBackground = React.forwardRef<ImageBackground, ImageBackgroundProps>((props, forwardedRef) => {
|
10
|
-
const storedImageRef = useRef<Image | null>(null)
|
11
|
-
|
12
|
-
useLayoutEffect(() => {
|
13
|
-
return () => {
|
14
|
-
if (storedImageRef.current) {
|
15
|
-
// @ts-ignore
|
16
|
-
UnistylesShadowRegistry.remove(storedImageRef.current)
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}, [])
|
20
|
-
|
21
10
|
// @ts-expect-error we don't know the type of the component
|
22
11
|
maybeWarnAboutMultipleUnistyles(props.style, 'ImageBackground')
|
23
12
|
// @ts-ignore we don't know the type of the component
|
@@ -37,21 +26,17 @@ export const createUnistylesImageBackground = (Component: typeof ImageBackground
|
|
37
26
|
() => {
|
38
27
|
// @ts-expect-error - this is hidden from TS
|
39
28
|
UnistylesShadowRegistry.remove(ref)
|
40
|
-
|
41
|
-
if (storedImageRef.current) {
|
42
|
-
// @ts-expect-error - this is hidden from TS
|
43
|
-
UnistylesShadowRegistry.remove(storedImageRef.current)
|
44
|
-
}
|
45
29
|
}
|
46
30
|
)
|
47
31
|
}}
|
48
32
|
imageRef={ref => {
|
49
|
-
if (ref) {
|
50
|
-
storedImageRef.current = ref
|
51
|
-
}
|
52
|
-
|
53
33
|
// @ts-expect-error web types are not compatible with RN styles
|
54
34
|
UnistylesShadowRegistry.add(ref, props.imageStyle)
|
35
|
+
|
36
|
+
return () => {
|
37
|
+
// @ts-ignore this is hidden from TS
|
38
|
+
UnistylesShadowRegistry.remove(ref)
|
39
|
+
}
|
55
40
|
}}
|
56
41
|
/>
|
57
42
|
)
|
package/src/index.ts
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
const [majorReactVersions] = React.version.split('.').map(Number.parseInt)
|
4
|
+
|
5
|
+
if (majorReactVersions === undefined || majorReactVersions < 19) {
|
6
|
+
throw new Error('Unistyles 🦄: To enable full Fabric power you need to use React 19.0.0 or higher')
|
7
|
+
}
|
8
|
+
|
1
9
|
export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs'
|
2
10
|
export { mq } from './mq'
|
3
11
|
export type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { useEffect } from 'react'
|
2
|
-
import { useSharedValue } from 'react-native-reanimated'
|
2
|
+
import { type SharedValue, useSharedValue } from 'react-native-reanimated'
|
3
3
|
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
|
4
4
|
import type { UnistylesTheme } from '../types'
|
5
5
|
|
6
6
|
export const useAnimatedTheme = () => {
|
7
|
-
const theme = useSharedValue
|
7
|
+
const theme = useSharedValue(UnistylesRuntime.getTheme())
|
8
8
|
|
9
9
|
useEffect(() => {
|
10
10
|
// @ts-ignore this is hidden from TS
|
@@ -17,5 +17,5 @@ export const useAnimatedTheme = () => {
|
|
17
17
|
return () => dispose()
|
18
18
|
}, [])
|
19
19
|
|
20
|
-
return theme
|
20
|
+
return theme as SharedValue<UnistylesTheme>
|
21
21
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { useEffect } from 'react'
|
2
|
-
import { useSharedValue } from 'react-native-reanimated'
|
2
|
+
import { type SharedValue, useSharedValue } from 'react-native-reanimated'
|
3
3
|
import { UnistyleDependency, UnistylesRuntime } from '../specs'
|
4
4
|
import type { UnistylesTheme } from '../types'
|
5
5
|
import { services } from '../web/services'
|
6
6
|
|
7
7
|
export const useAnimatedTheme = () => {
|
8
|
-
const theme = useSharedValue
|
8
|
+
const theme = useSharedValue(UnistylesRuntime.getTheme())
|
9
9
|
|
10
10
|
useEffect(() => {
|
11
11
|
const dispose = services.listener.addListeners([UnistyleDependency.Theme], () => theme.set(UnistylesRuntime.getTheme()))
|
@@ -15,5 +15,5 @@ export const useAnimatedTheme = () => {
|
|
15
15
|
}
|
16
16
|
}, [])
|
17
17
|
|
18
|
-
return theme
|
18
|
+
return theme as SharedValue<UnistylesTheme>
|
19
19
|
}
|
package/src/web/css/core.ts
CHANGED
@@ -34,8 +34,16 @@ export const convertToCSS = (hash: string, value: Record<string, any>, state: CS
|
|
34
34
|
}
|
35
35
|
|
36
36
|
if (typeof styleValue === 'object') {
|
37
|
-
const allBreakpoints = Object.keys(value)
|
38
37
|
Object.entries(styleValue).forEach(([breakpointStyleKey, breakpointStyleValue]) => {
|
38
|
+
const allBreakpoints = Object.entries(value)
|
39
|
+
.filter(([_, value]) => {
|
40
|
+
if (typeof value !== 'object' || value === null) {
|
41
|
+
return false
|
42
|
+
}
|
43
|
+
|
44
|
+
return breakpointStyleKey in value
|
45
|
+
})
|
46
|
+
.map(([key]) => key)
|
39
47
|
const mediaQuery = getMediaQuery(styleKey, allBreakpoints)
|
40
48
|
|
41
49
|
state.set({
|
@@ -20,7 +20,7 @@ export class UnistylesShadowRegistry {
|
|
20
20
|
constructor(private services: UnistylesServices) {}
|
21
21
|
|
22
22
|
add = (ref: any, hash?: string) => {
|
23
|
-
if (!(ref instanceof HTMLElement) || !hash) {
|
23
|
+
if (isServer() || !(ref instanceof HTMLElement) || !hash) {
|
24
24
|
return
|
25
25
|
}
|
26
26
|
|
package/web/package.json
ADDED
@@ -1,59 +0,0 @@
|
|
1
|
-
#include "UnistylesCommitHook.h"
|
2
|
-
|
3
|
-
using namespace margelo::nitro::unistyles;
|
4
|
-
using namespace facebook::react;
|
5
|
-
|
6
|
-
core::UnistylesCommitHook::~UnistylesCommitHook() noexcept {
|
7
|
-
_uiManager->unregisterCommitHook(*this);
|
8
|
-
}
|
9
|
-
|
10
|
-
void core::UnistylesCommitHook::commitHookWasRegistered(const UIManager &uiManager) noexcept {}
|
11
|
-
void core::UnistylesCommitHook::commitHookWasUnregistered(const UIManager &uiManager) noexcept {}
|
12
|
-
|
13
|
-
RootShadowNode::Unshared core::UnistylesCommitHook::shadowTreeWillCommit(
|
14
|
-
const ShadowTree &shadowTree,
|
15
|
-
const RootShadowNode::Shared &oldRootShadowNode,
|
16
|
-
const RootShadowNode::Unshared &newRootShadowNode
|
17
|
-
) noexcept {
|
18
|
-
RootShadowNode::Unshared rootNode = newRootShadowNode;
|
19
|
-
auto unistylesRootNode = std::reinterpret_pointer_cast<core::UnistylesCommitShadowNode>(newRootShadowNode);
|
20
|
-
|
21
|
-
// this is Unistyles commit, we don't need to override it
|
22
|
-
if (unistylesRootNode->hasUnistylesCommitTrait()) {
|
23
|
-
unistylesRootNode->removeUnistylesCommitTrait();
|
24
|
-
unistylesRootNode->addUnistylesMountTrait();
|
25
|
-
|
26
|
-
return newRootShadowNode;
|
27
|
-
}
|
28
|
-
|
29
|
-
auto& registry = core::UnistylesRegistry::get();
|
30
|
-
|
31
|
-
if (registry.trafficController.shouldStop()) {
|
32
|
-
registry.trafficController.resumeUnistylesTraffic();
|
33
|
-
|
34
|
-
return newRootShadowNode;
|
35
|
-
}
|
36
|
-
|
37
|
-
// this is React Native / Reanimated commit
|
38
|
-
// merge Unistyles updates before it completes
|
39
|
-
|
40
|
-
return registry.trafficController.withLock([&](){
|
41
|
-
auto& shadowLeafUpdates = registry.trafficController.getUpdates();
|
42
|
-
|
43
|
-
// oops, no updates from Unistyles yet, skip it!
|
44
|
-
if (shadowLeafUpdates.size() == 0) {
|
45
|
-
return newRootShadowNode;
|
46
|
-
}
|
47
|
-
|
48
|
-
auto affectedNodes = shadow::ShadowTreeManager::findAffectedNodes(*rootNode, shadowLeafUpdates);
|
49
|
-
|
50
|
-
registry.trafficController.stopUnistylesTraffic();
|
51
|
-
|
52
|
-
// we have few updates, so merge it
|
53
|
-
return std::static_pointer_cast<RootShadowNode>(shadow::ShadowTreeManager::cloneShadowTree(
|
54
|
-
*rootNode,
|
55
|
-
shadowLeafUpdates,
|
56
|
-
affectedNodes
|
57
|
-
));
|
58
|
-
});
|
59
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include <react/renderer/uimanager/UIManager.h>
|
4
|
-
#include <react/renderer/uimanager/UIManagerCommitHook.h>
|
5
|
-
#include "ShadowTreeManager.h"
|
6
|
-
#include "ShadowTrafficController.h"
|
7
|
-
|
8
|
-
namespace margelo::nitro::unistyles::core {
|
9
|
-
|
10
|
-
using namespace facebook::react;
|
11
|
-
|
12
|
-
struct UnistylesCommitHook : public UIManagerCommitHook {
|
13
|
-
UnistylesCommitHook(std::shared_ptr<UIManager> uiManager) : _uiManager{uiManager} {
|
14
|
-
_uiManager->registerCommitHook(*this);
|
15
|
-
}
|
16
|
-
|
17
|
-
~UnistylesCommitHook() noexcept override;
|
18
|
-
|
19
|
-
void commitHookWasRegistered(const UIManager &uiManager) noexcept override;
|
20
|
-
void commitHookWasUnregistered(const UIManager &uiManager) noexcept override;
|
21
|
-
RootShadowNode::Unshared shadowTreeWillCommit(const ShadowTree &shadowTree, const RootShadowNode::Shared &oldRootShadowNode, const RootShadowNode::Unshared &newRootShadowNode) noexcept override;
|
22
|
-
|
23
|
-
private:
|
24
|
-
std::shared_ptr<UIManager> _uiManager;
|
25
|
-
};
|
26
|
-
|
27
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#include "UnistylesMountHook.h"
|
2
|
-
|
3
|
-
using namespace margelo::nitro::unistyles;
|
4
|
-
using namespace facebook::react;
|
5
|
-
|
6
|
-
core::UnistylesMountHook::~UnistylesMountHook() noexcept {
|
7
|
-
_uiManager->unregisterMountHook(*this);
|
8
|
-
}
|
9
|
-
|
10
|
-
void core::UnistylesMountHook::shadowTreeDidMount(RootShadowNode::Shared const &rootShadowNode, double mountTime) noexcept {
|
11
|
-
auto rootNode = std::const_pointer_cast<RootShadowNode>(rootShadowNode);
|
12
|
-
auto unistylesRootNode = std::reinterpret_pointer_cast<core::UnistylesCommitShadowNode>(rootNode);
|
13
|
-
|
14
|
-
// if this is Unistyles commit, do nothing
|
15
|
-
if (unistylesRootNode->hasUnistylesMountTrait()) {
|
16
|
-
unistylesRootNode->removeUnistylesMountTrait();
|
17
|
-
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
|
21
|
-
// this is React Native or Reanimated commit
|
22
|
-
// one more time merge Unistyles changes
|
23
|
-
auto& registry = core::UnistylesRegistry::get();
|
24
|
-
|
25
|
-
registry.trafficController.stopUnistylesTraffic();
|
26
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
#pragma once
|
2
|
-
|
3
|
-
#include <react/renderer/uimanager/UIManager.h>
|
4
|
-
#include <react/renderer/uimanager/UIManagerMountHook.h>
|
5
|
-
#include "ShadowTreeManager.h"
|
6
|
-
|
7
|
-
namespace margelo::nitro::unistyles::core {
|
8
|
-
|
9
|
-
using namespace facebook::react;
|
10
|
-
|
11
|
-
struct UnistylesMountHook : public UIManagerMountHook {
|
12
|
-
UnistylesMountHook(std::shared_ptr<UIManager> uiManager): _uiManager{uiManager} {
|
13
|
-
_uiManager->registerMountHook(*this);
|
14
|
-
}
|
15
|
-
|
16
|
-
~UnistylesMountHook() noexcept override;
|
17
|
-
|
18
|
-
void shadowTreeDidMount(RootShadowNode::Shared const &rootShadowNode, double mountTime) noexcept override;
|
19
|
-
|
20
|
-
private:
|
21
|
-
std::shared_ptr<UIManager> _uiManager;
|
22
|
-
};
|
23
|
-
|
24
|
-
}
|
package/lib/module/package.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"type":"module"}
|