react-native-unistyles 3.8.2 → 3.9.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 +3 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +8 -2
- package/cxx/core/Unistyle.h +2 -0
- package/cxx/core/UnistyleWrapper.h +2 -1
- package/cxx/core/UnistylesRegistry.cpp +12 -0
- package/cxx/core/UnistylesRegistry.h +2 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +23 -1
- package/cxx/parser/Parser.cpp +9 -0
- package/cxx/shadowTree/NativeProps.h +47 -14
- package/lib/commonjs/components/ScopedTheme.js +22 -8
- package/lib/commonjs/components/ScopedTheme.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +4 -3
- package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +3 -7
- package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +7 -10
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js +3 -7
- package/lib/commonjs/specs/ShadowRegistry/styleSource.js.map +1 -1
- package/lib/commonjs/web/registry.js +3 -3
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/module/components/ScopedTheme.js +21 -7
- package/lib/module/components/ScopedTheme.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/listener.native.js +4 -3
- package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -1
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
- package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
- package/lib/module/core/withUnistyles/withUnistyles.native.js +3 -7
- package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +7 -10
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/styleSource.js +3 -7
- package/lib/module/specs/ShadowRegistry/styleSource.js.map +1 -1
- package/lib/module/web/registry.js +3 -3
- package/lib/module/web/registry.js.map +1 -1
- package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts +1 -1
- package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -1
- 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.map +1 -1
- package/metro/index.d.ts +1 -1
- package/metro/index.js +8 -4
- package/package.json +5 -4
- package/plugin/index.d.ts +20 -0
- package/plugin/index.js +33 -2
- package/repack-plugin/index.d.ts +41 -0
- package/repack-plugin/index.js +294 -9
- package/src/components/ScopedTheme.tsx +23 -7
- package/src/core/useProxifiedUnistyles/listener.native.ts +8 -3
- package/src/core/useProxifiedUnistyles/types.ts +1 -1
- package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +2 -2
- package/src/core/withUnistyles/withUnistyles.native.tsx +3 -7
- package/src/specs/ShadowRegistry/index.ts +8 -11
- package/src/specs/ShadowRegistry/styleSource.ts +3 -7
- package/src/web/registry.ts +3 -3
|
@@ -176,23 +176,20 @@ HybridShadowRegistry.add = (handle, styles, scope) => {
|
|
|
176
176
|
)
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
const previousScopedTheme = scope ? HybridShadowRegistry.getScopedTheme() : undefined
|
|
179
|
+
const previousScopedTheme = HybridShadowRegistry.getScopedTheme()
|
|
181
180
|
|
|
182
|
-
|
|
183
|
-
HybridShadowRegistry.setScopedTheme(scope.name)
|
|
184
|
-
}
|
|
181
|
+
HybridShadowRegistry.setScopedTheme(scope?.name)
|
|
185
182
|
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
try {
|
|
184
|
+
HybridShadowRegistry.link(node, filteredStyles)
|
|
185
|
+
owners.link(host)
|
|
186
|
+
} finally {
|
|
187
|
+
HybridShadowRegistry.setScopedTheme(previousScopedTheme)
|
|
188
|
+
}
|
|
188
189
|
|
|
189
190
|
if (!handle.__internalInstanceHandle) {
|
|
190
191
|
linkedHosts.set(handle, host)
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
-
if (scope) {
|
|
194
|
-
HybridShadowRegistry.setScopedTheme(previousScopedTheme)
|
|
195
|
-
}
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
195
|
|
|
@@ -50,18 +50,14 @@ export const createUnistylesStyleSource = (scopedTheme: ScopedThemeAccess) => {
|
|
|
50
50
|
|
|
51
51
|
hasUnistyles = true
|
|
52
52
|
|
|
53
|
-
const previousScopedTheme =
|
|
53
|
+
const previousScopedTheme = scopedTheme.get()
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
scopedTheme.set(scope.name)
|
|
57
|
-
}
|
|
55
|
+
scopedTheme.set(scope?.name)
|
|
58
56
|
|
|
59
57
|
try {
|
|
60
58
|
Object.assign(fresh, style[key]?.uni__getStyles?.())
|
|
61
59
|
} finally {
|
|
62
|
-
|
|
63
|
-
scopedTheme.set(previousScopedTheme)
|
|
64
|
-
}
|
|
60
|
+
scopedTheme.set(previousScopedTheme)
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
}
|
package/src/web/registry.ts
CHANGED
|
@@ -167,13 +167,13 @@ export class UnistylesRegistry {
|
|
|
167
167
|
stylesCounter.delete(ref)
|
|
168
168
|
|
|
169
169
|
if (stylesCounter.size === 0) {
|
|
170
|
-
// Safe to drop now: connect creates a new Set
|
|
170
|
+
// Safe to drop now: connect creates a new Set, which the cleanup below checks
|
|
171
171
|
this.stylesCounter.delete(hash)
|
|
172
172
|
|
|
173
173
|
// Move this to the end of the event loop so the element is removed from the DOM
|
|
174
174
|
return Promise.resolve().then(() => {
|
|
175
|
-
//
|
|
176
|
-
if (document.querySelector(`.${hash}`)) {
|
|
175
|
+
// Keep the style while an element uses it, even one connected outside the DOM, eg. in a portal attached later
|
|
176
|
+
if (this.stylesCounter.has(hash) || document.querySelector(`.${hash}`)) {
|
|
177
177
|
return false
|
|
178
178
|
}
|
|
179
179
|
|