react-native-unistyles 2.8.1 → 2.8.3
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/unistyles/Platform.kt +6 -1
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js +19 -0
- package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js.map +1 -1
- package/lib/commonjs/utils/parseColor.js +5 -0
- package/lib/commonjs/utils/parseColor.js.map +1 -1
- package/lib/module/core/mocks/UnistylesMockedRuntime.js +19 -0
- package/lib/module/core/mocks/UnistylesMockedRuntime.js.map +1 -1
- package/lib/module/utils/parseColor.js +5 -0
- package/lib/module/utils/parseColor.js.map +1 -1
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts +25 -0
- package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts.map +1 -1
- package/lib/typescript/src/utils/parseColor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/mocks/UnistylesMockedRuntime.ts +20 -0
- package/src/utils/parseColor.ts +6 -0
- package/windows/ReactNativeUnistyles/packages.lock.json +31 -31
@@ -99,7 +99,12 @@ class Platform(private val reactApplicationContext: ReactApplicationContext) {
|
|
99
99
|
|
100
100
|
val insets = insetsCompat.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
101
101
|
|
102
|
-
|
102
|
+
// reports inset bottom as 0 when keyboard is visible
|
103
|
+
// otherwise it will break other libraries that manipulates bottom insets
|
104
|
+
val imeInsets = insetsCompat.getInsets(WindowInsetsCompat.Type.ime())
|
105
|
+
val insetsBottom = if (imeInsets.bottom > 0) 0 else insets.bottom
|
106
|
+
|
107
|
+
this.insets = Insets(statusBarTopInset, insetsBottom, insets.left, insets.right)
|
103
108
|
}
|
104
109
|
|
105
110
|
fun getInsets(): Insets {
|
@@ -13,6 +13,25 @@ class UnistylesMockedRuntime {
|
|
13
13
|
this.unistylesRegistry = unistylesRegistry;
|
14
14
|
this.unistylesRegistry = unistylesRegistry;
|
15
15
|
}
|
16
|
+
get miniRuntime() {
|
17
|
+
return {
|
18
|
+
contentSizeCategory: this.contentSizeCategory,
|
19
|
+
breakpoint: this.breakpoint,
|
20
|
+
screen: this.screen,
|
21
|
+
insets: this.insets,
|
22
|
+
statusBar: {
|
23
|
+
width: this.statusBar.width,
|
24
|
+
height: this.statusBar.height
|
25
|
+
},
|
26
|
+
navigationBar: {
|
27
|
+
width: this.navigationBar.width,
|
28
|
+
height: this.navigationBar.height
|
29
|
+
},
|
30
|
+
orientation: this.orientation,
|
31
|
+
pixelRatio: this.pixelRatio,
|
32
|
+
fontScale: this.fontScale
|
33
|
+
};
|
34
|
+
}
|
16
35
|
get colorScheme() {
|
17
36
|
return 'dark';
|
18
37
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","
|
1
|
+
{"version":3,"names":["_common","require","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","ScreenOrientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled","exports"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AADA;;AAOO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,O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EAC9CE,0BAA0B,GAAIC,KAAsB,IAAK,CAAC,CAAC;EAC3DC,gBAAgB,GAAIC,SAAkB,IAAK,CAAC,CAAC;AACxD;AAACC,OAAA,CAAAjD,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.parseColor = void 0;
|
7
|
+
var _common = require("../common");
|
7
8
|
const parseAlpha = alpha => {
|
8
9
|
if (alpha > 1 || alpha < 0) {
|
9
10
|
return 1;
|
@@ -22,7 +23,11 @@ const parseColor = (color, alpha = 1) => {
|
|
22
23
|
if (color.startsWith('#') && color.length === 7) {
|
23
24
|
return [color, parseAlpha(alpha)];
|
24
25
|
}
|
26
|
+
if (_common.isIOS && color === 'transparent') {
|
27
|
+
return ['#000000', 0];
|
28
|
+
}
|
25
29
|
|
30
|
+
// todo remove this with Unistyles 3.0
|
26
31
|
// named colors
|
27
32
|
return [color, 1];
|
28
33
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseAlpha","alpha","parseColor","color","startsWith","length","exports"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":";;;;;;AAEA,
|
1
|
+
{"version":3,"names":["_common","require","parseAlpha","alpha","parseColor","color","startsWith","length","isIOS","exports"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,UAAU,GAAIC,KAAa,IAAK;EAClC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;IACxB,OAAO,CAAC;EACZ;EAEA,OAAOA,KAAK;AAChB,CAAC;AAEM,MAAMC,UAAU,GAAGA,CAACC,KAAa,EAAEF,KAAa,GAAG,CAAC,KAAuB;EAC9E,IAAI,CAACE,KAAK,EAAE;IACR,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;EAClB;;EAEA;EACA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAE,CAAC,CAAC;EACrB;EAEA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAEH,UAAU,CAACC,KAAK,CAAC,CAAC;EACrC;EAEA,IAAIK,aAAK,IAAIH,KAAK,KAAK,aAAa,EAAE;IAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;EACzB;;EAEA;EACA;EACA,OAAO,CAACA,KAAK,EAAE,CAAC,CAAC;AACrB,CAAC;AAAAI,OAAA,CAAAL,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -6,6 +6,25 @@ export class UnistylesMockedRuntime {
|
|
6
6
|
this.unistylesRegistry = unistylesRegistry;
|
7
7
|
this.unistylesRegistry = unistylesRegistry;
|
8
8
|
}
|
9
|
+
get miniRuntime() {
|
10
|
+
return {
|
11
|
+
contentSizeCategory: this.contentSizeCategory,
|
12
|
+
breakpoint: this.breakpoint,
|
13
|
+
screen: this.screen,
|
14
|
+
insets: this.insets,
|
15
|
+
statusBar: {
|
16
|
+
width: this.statusBar.width,
|
17
|
+
height: this.statusBar.height
|
18
|
+
},
|
19
|
+
navigationBar: {
|
20
|
+
width: this.navigationBar.width,
|
21
|
+
height: this.navigationBar.height
|
22
|
+
},
|
23
|
+
orientation: this.orientation,
|
24
|
+
pixelRatio: this.pixelRatio,
|
25
|
+
fontScale: this.fontScale
|
26
|
+
};
|
27
|
+
}
|
9
28
|
get colorScheme() {
|
10
29
|
return 'dark';
|
11
30
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","top","right","bottom","left","setColor","setHidden","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin","setRootViewBackgroundColor","color","setImmersiveMode","isEnabled"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":"AAAA;AACA,SAASA,iBAAiB,QAAQ,cAAc;AAMhD,OAAO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,MAAM;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AAE;MACVD,KAAK,EAAE,GAAG;MACVsB,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;MAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC;IACtB,CAAC;EACL;EAEA,IAAWrB,aAAaA,CAAA,EAAG;IACvB,OAAO;MACHD,MAAM,EAAE,CAAC;MACTD,KAAK,EAAE,CAAC;MACRsB,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;MAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC;IACtB,CAAC;EACL;EAEA,IAAWpB,WAAWA,CAAA,EAAG;IACrB,OAAOd,iBAAiB,CAACmC,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK,IAAI;EAChDC,WAAW,GAAGA,CAACD,IAA2B,EAAEE,KAA6C,KAAK,CAAC,CAAC;EAChGC,iBAAiB,GAAIC,OAAgB,IAAK,CAAC,CAAC;EAC5CC,SAAS,GAAIC,MAAuB,IAAK,CAAC,CAAC;EAC3CC,YAAY,GAAID,MAAuB,IAAK,CAAC,CAAC;EAC9CE,0BAA0B,GAAIC,KAAsB,IAAK,CAAC,CAAC;EAC3DC,gBAAgB,GAAIC,SAAkB,IAAK,CAAC,CAAC;AACxD","ignoreList":[]}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { isIOS } from '../common';
|
1
2
|
const parseAlpha = alpha => {
|
2
3
|
if (alpha > 1 || alpha < 0) {
|
3
4
|
return 1;
|
@@ -16,7 +17,11 @@ export const parseColor = (color, alpha = 1) => {
|
|
16
17
|
if (color.startsWith('#') && color.length === 7) {
|
17
18
|
return [color, parseAlpha(alpha)];
|
18
19
|
}
|
20
|
+
if (isIOS && color === 'transparent') {
|
21
|
+
return ['#000000', 0];
|
22
|
+
}
|
19
23
|
|
24
|
+
// todo remove this with Unistyles 3.0
|
20
25
|
// named colors
|
21
26
|
return [color, 1];
|
22
27
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseAlpha","alpha","parseColor","color","startsWith","length"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["isIOS","parseAlpha","alpha","parseColor","color","startsWith","length"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":"AACA,SAASA,KAAK,QAAQ,WAAW;AAEjC,MAAMC,UAAU,GAAIC,KAAa,IAAK;EAClC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;IACxB,OAAO,CAAC;EACZ;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAACC,KAAa,EAAEF,KAAa,GAAG,CAAC,KAAuB;EAC9E,IAAI,CAACE,KAAK,EAAE;IACR,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;EAClB;;EAEA;EACA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAE,CAAC,CAAC;EACrB;EAEA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAEH,UAAU,CAACC,KAAK,CAAC,CAAC;EACrC;EAEA,IAAIF,KAAK,IAAII,KAAK,KAAK,aAAa,EAAE;IAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;EACzB;;EAEA;EACA;EACA,OAAO,CAACA,KAAK,EAAE,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
@@ -6,6 +6,31 @@ export declare class UnistylesMockedRuntime {
|
|
6
6
|
private unistylesRegistry;
|
7
7
|
private unistylesRegistry;
|
8
8
|
constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
|
9
|
+
get miniRuntime(): {
|
10
|
+
contentSizeCategory: string;
|
11
|
+
breakpoint: number | keyof import("../../global").UnistylesBreakpoints | undefined;
|
12
|
+
screen: {
|
13
|
+
width: number;
|
14
|
+
height: number;
|
15
|
+
};
|
16
|
+
insets: {
|
17
|
+
top: number;
|
18
|
+
right: number;
|
19
|
+
bottom: number;
|
20
|
+
left: number;
|
21
|
+
};
|
22
|
+
statusBar: {
|
23
|
+
width: number;
|
24
|
+
height: number;
|
25
|
+
};
|
26
|
+
navigationBar: {
|
27
|
+
width: number;
|
28
|
+
height: number;
|
29
|
+
};
|
30
|
+
orientation: "portrait";
|
31
|
+
pixelRatio: number;
|
32
|
+
fontScale: number;
|
33
|
+
};
|
9
34
|
get colorScheme(): string;
|
10
35
|
get hasAdaptiveThemes(): boolean;
|
11
36
|
get themeName(): undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,qBAAa,sBAAsB;IAGnB,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;IAF/E,OAAO,CAAC,iBAAiB,CAAyB;gBAE9B,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAIjG,IAAW,WAAW,WAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,cAInB;IAED,IAAW,mBAAmB,WAE7B;IAED,IAAW,UAAU,2EAUpB;IAED,IAAW,WAAW,gDAErB;IAED,IAAW,cAAc,sBAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,MAAM;;;;;MAOhB;IAED,IAAW,UAAU,WAEpB;IAED,IAAW,SAAS,WAEnB;IAED,IAAW,SAAS;;;;;MAOnB;IAED,IAAW,aAAa;;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AAe,aAAS;IAChD,WAAW,SAAU,MAAM,eAAe,SAAS,eAAe,CAAC,MAAM,eAAe,CAAC,UAAO;IAChG,iBAAiB,YAAa,OAAO,UAAO;IAC5C,SAAS,WAAY,eAAe,UAAO;IAC3C,YAAY,WAAY,eAAe,UAAO;IAC9C,0BAA0B,WAAY,KAAK,GAAG,MAAM,UAAO;IAC3D,gBAAgB,cAAe,OAAO,UAAO;CACvD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parseColor.d.ts","sourceRoot":"","sources":["../../../../src/utils/parseColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;
|
1
|
+
{"version":3,"file":"parseColor.d.ts","sourceRoot":"","sources":["../../../../src/utils/parseColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAWrC,eAAO,MAAM,UAAU,WAAY,KAAK,UAAS,MAAM,KAAO,CAAC,MAAM,EAAE,MAAM,CAqB5E,CAAA"}
|
package/package.json
CHANGED
@@ -12,6 +12,26 @@ export class UnistylesMockedRuntime {
|
|
12
12
|
this.unistylesRegistry = unistylesRegistry as unknown as UnistylesMockedRegistry
|
13
13
|
}
|
14
14
|
|
15
|
+
public get miniRuntime() {
|
16
|
+
return {
|
17
|
+
contentSizeCategory: this.contentSizeCategory,
|
18
|
+
breakpoint: this.breakpoint,
|
19
|
+
screen: this.screen,
|
20
|
+
insets: this.insets,
|
21
|
+
statusBar: {
|
22
|
+
width: this.statusBar.width,
|
23
|
+
height: this.statusBar.height
|
24
|
+
},
|
25
|
+
navigationBar: {
|
26
|
+
width: this.navigationBar.width,
|
27
|
+
height: this.navigationBar.height
|
28
|
+
},
|
29
|
+
orientation: this.orientation,
|
30
|
+
pixelRatio: this.pixelRatio,
|
31
|
+
fontScale: this.fontScale
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
15
35
|
public get colorScheme() {
|
16
36
|
return 'dark'
|
17
37
|
}
|
package/src/utils/parseColor.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { Color } from '../types'
|
2
|
+
import { isIOS } from '../common'
|
2
3
|
|
3
4
|
const parseAlpha = (alpha: number) => {
|
4
5
|
if (alpha > 1 || alpha < 0) {
|
@@ -22,6 +23,11 @@ export const parseColor = (color?: Color, alpha: number = 1): [string, number] =
|
|
22
23
|
return [color, parseAlpha(alpha)]
|
23
24
|
}
|
24
25
|
|
26
|
+
if (isIOS && color === 'transparent') {
|
27
|
+
return ['#000000', 0]
|
28
|
+
}
|
29
|
+
|
30
|
+
// todo remove this with Unistyles 3.0
|
25
31
|
// named colors
|
26
32
|
return [color, 1]
|
27
33
|
}
|
@@ -4,17 +4,17 @@
|
|
4
4
|
"native,Version=v0.0": {
|
5
5
|
"Microsoft.ReactNative": {
|
6
6
|
"type": "Direct",
|
7
|
-
"requested": "[0.
|
8
|
-
"resolved": "0.
|
9
|
-
"contentHash": "
|
7
|
+
"requested": "[0.74.9, )",
|
8
|
+
"resolved": "0.74.9",
|
9
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
10
10
|
},
|
11
11
|
"Microsoft.ReactNative.Cxx": {
|
12
12
|
"type": "Direct",
|
13
|
-
"requested": "[0.
|
14
|
-
"resolved": "0.
|
15
|
-
"contentHash": "
|
13
|
+
"requested": "[0.74.9, )",
|
14
|
+
"resolved": "0.74.9",
|
15
|
+
"contentHash": "C+Z2fmjDc7SJXeOWyD/9ImqooU7yX3ALB1Yno2UNYo+Li2SImeG6DdEfcNfSCS2fek1R3znpd6yNEkar/t1n5w==",
|
16
16
|
"dependencies": {
|
17
|
-
"Microsoft.ReactNative": "0.
|
17
|
+
"Microsoft.ReactNative": "0.74.9"
|
18
18
|
}
|
19
19
|
},
|
20
20
|
"Microsoft.UI.Xaml": {
|
@@ -28,9 +28,9 @@
|
|
28
28
|
},
|
29
29
|
"Microsoft.Windows.CppWinRT": {
|
30
30
|
"type": "Direct",
|
31
|
-
"requested": "[2.0.
|
32
|
-
"resolved": "2.0.
|
33
|
-
"contentHash": "
|
31
|
+
"requested": "[2.0.230706.1, )",
|
32
|
+
"resolved": "2.0.230706.1",
|
33
|
+
"contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ=="
|
34
34
|
},
|
35
35
|
"Microsoft.Web.WebView2": {
|
36
36
|
"type": "Transitive",
|
@@ -41,9 +41,9 @@
|
|
41
41
|
"native,Version=v0.0/win10-arm": {
|
42
42
|
"Microsoft.ReactNative": {
|
43
43
|
"type": "Direct",
|
44
|
-
"requested": "[0.
|
45
|
-
"resolved": "0.
|
46
|
-
"contentHash": "
|
44
|
+
"requested": "[0.74.9, )",
|
45
|
+
"resolved": "0.74.9",
|
46
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
47
47
|
},
|
48
48
|
"Microsoft.Web.WebView2": {
|
49
49
|
"type": "Transitive",
|
@@ -54,9 +54,9 @@
|
|
54
54
|
"native,Version=v0.0/win10-arm-aot": {
|
55
55
|
"Microsoft.ReactNative": {
|
56
56
|
"type": "Direct",
|
57
|
-
"requested": "[0.
|
58
|
-
"resolved": "0.
|
59
|
-
"contentHash": "
|
57
|
+
"requested": "[0.74.9, )",
|
58
|
+
"resolved": "0.74.9",
|
59
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
60
60
|
},
|
61
61
|
"Microsoft.Web.WebView2": {
|
62
62
|
"type": "Transitive",
|
@@ -67,9 +67,9 @@
|
|
67
67
|
"native,Version=v0.0/win10-arm64-aot": {
|
68
68
|
"Microsoft.ReactNative": {
|
69
69
|
"type": "Direct",
|
70
|
-
"requested": "[0.
|
71
|
-
"resolved": "0.
|
72
|
-
"contentHash": "
|
70
|
+
"requested": "[0.74.9, )",
|
71
|
+
"resolved": "0.74.9",
|
72
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
73
73
|
},
|
74
74
|
"Microsoft.Web.WebView2": {
|
75
75
|
"type": "Transitive",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
"native,Version=v0.0/win10-x64": {
|
81
81
|
"Microsoft.ReactNative": {
|
82
82
|
"type": "Direct",
|
83
|
-
"requested": "[0.
|
84
|
-
"resolved": "0.
|
85
|
-
"contentHash": "
|
83
|
+
"requested": "[0.74.9, )",
|
84
|
+
"resolved": "0.74.9",
|
85
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
86
86
|
},
|
87
87
|
"Microsoft.Web.WebView2": {
|
88
88
|
"type": "Transitive",
|
@@ -93,9 +93,9 @@
|
|
93
93
|
"native,Version=v0.0/win10-x64-aot": {
|
94
94
|
"Microsoft.ReactNative": {
|
95
95
|
"type": "Direct",
|
96
|
-
"requested": "[0.
|
97
|
-
"resolved": "0.
|
98
|
-
"contentHash": "
|
96
|
+
"requested": "[0.74.9, )",
|
97
|
+
"resolved": "0.74.9",
|
98
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
99
99
|
},
|
100
100
|
"Microsoft.Web.WebView2": {
|
101
101
|
"type": "Transitive",
|
@@ -106,9 +106,9 @@
|
|
106
106
|
"native,Version=v0.0/win10-x86": {
|
107
107
|
"Microsoft.ReactNative": {
|
108
108
|
"type": "Direct",
|
109
|
-
"requested": "[0.
|
110
|
-
"resolved": "0.
|
111
|
-
"contentHash": "
|
109
|
+
"requested": "[0.74.9, )",
|
110
|
+
"resolved": "0.74.9",
|
111
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
112
112
|
},
|
113
113
|
"Microsoft.Web.WebView2": {
|
114
114
|
"type": "Transitive",
|
@@ -119,9 +119,9 @@
|
|
119
119
|
"native,Version=v0.0/win10-x86-aot": {
|
120
120
|
"Microsoft.ReactNative": {
|
121
121
|
"type": "Direct",
|
122
|
-
"requested": "[0.
|
123
|
-
"resolved": "0.
|
124
|
-
"contentHash": "
|
122
|
+
"requested": "[0.74.9, )",
|
123
|
+
"resolved": "0.74.9",
|
124
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
125
125
|
},
|
126
126
|
"Microsoft.Web.WebView2": {
|
127
127
|
"type": "Transitive",
|