react-native-unistyles 3.0.0-alpha.25 → 3.0.0-alpha.26
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/core/UnistylesRegistry.cpp +10 -10
- package/cxx/core/UnistylesState.cpp +4 -0
- package/cxx/hybridObjects/HybridStyleSheet.cpp +11 -5
- package/cxx/hybridObjects/HybridStyleSheet.h +5 -0
- package/ios/UnistylesModuleOnLoad.h +10 -1
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js +1 -0
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/index.js +0 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js +1 -0
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -16
- package/src/specs/StyleSheet/index.ts +4 -1
@@ -88,16 +88,16 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
|
|
88
88
|
}
|
89
89
|
|
90
90
|
void core::UnistylesRegistry::unlinkShadowNodeWithUnistyles(jsi::Runtime& rt, const ShadowNodeFamily* shadowNodeFamily) {
|
91
|
-
this->_shadowRegistry[&rt]
|
91
|
+
this->_shadowRegistry[&rt].erase(shadowNodeFamily);
|
92
92
|
}
|
93
93
|
|
94
94
|
core::Unistyle::Shared core::UnistylesRegistry::findUnistyleFromKey(jsi::Runtime& rt, std::string styleKey, int tag) {
|
95
95
|
auto targetStyleSheet = this->_styleSheetRegistry[&rt][tag];
|
96
|
-
|
96
|
+
|
97
97
|
if (targetStyleSheet == nullptr) {
|
98
98
|
return nullptr;
|
99
99
|
}
|
100
|
-
|
100
|
+
|
101
101
|
return targetStyleSheet.get()->unistyles[styleKey];
|
102
102
|
}
|
103
103
|
|
@@ -152,26 +152,26 @@ core::DependencyMap core::UnistylesRegistry::buildDependencyMap(jsi::Runtime& rt
|
|
152
152
|
|
153
153
|
std::vector<std::shared_ptr<core::StyleSheet>> core::UnistylesRegistry::getStyleSheetsToRefresh(jsi::Runtime& rt, bool themeDidChange, bool runtimeDidChange) {
|
154
154
|
std::vector<std::shared_ptr<core::StyleSheet>> stylesheetsToRefresh{};
|
155
|
-
|
155
|
+
|
156
156
|
if (!themeDidChange && !runtimeDidChange) {
|
157
157
|
return stylesheetsToRefresh;
|
158
158
|
}
|
159
|
-
|
159
|
+
|
160
160
|
auto& styleSheets = this->_styleSheetRegistry[&rt];
|
161
|
-
|
161
|
+
|
162
162
|
std::for_each(styleSheets.begin(), styleSheets.end(), [&](std::pair<int, std::shared_ptr<core::StyleSheet>> pair){
|
163
163
|
auto& [_, styleSheet] = pair;
|
164
|
-
|
164
|
+
|
165
165
|
if (styleSheet->type == StyleSheetType::ThemableWithMiniRuntime && runtimeDidChange) {
|
166
166
|
stylesheetsToRefresh.emplace_back(styleSheet);
|
167
|
-
|
167
|
+
|
168
168
|
return;
|
169
169
|
}
|
170
|
-
|
170
|
+
|
171
171
|
if (styleSheet->type == StyleSheetType::Themable && themeDidChange) {
|
172
172
|
stylesheetsToRefresh.emplace_back(styleSheet);
|
173
173
|
}
|
174
174
|
});
|
175
|
-
|
175
|
+
|
176
176
|
return stylesheetsToRefresh;
|
177
177
|
}
|
@@ -57,6 +57,10 @@ jsi::Object core::UnistylesState::getJSThemeByName(std::string& themeName) {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
void core::UnistylesState::computeCurrentBreakpoint(int screenWidth) {
|
60
|
+
if (this->_sortedBreakpointPairs.size() == 0) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
|
60
64
|
this->_currentBreakpointName = helpers::getBreakpointFromScreenWidth(
|
61
65
|
screenWidth,
|
62
66
|
this->_sortedBreakpointPairs
|
@@ -42,11 +42,7 @@ jsi::Value HybridStyleSheet::configure(jsi::Runtime &rt, const jsi::Value &thisV
|
|
42
42
|
helpers::assertThat(rt, count == 1, "StyleSheet.configure expected to be called with one argument.");
|
43
43
|
helpers::assertThat(rt, arguments[0].isObject(), "StyleSheet.configure expected to be called with object.");
|
44
44
|
|
45
|
-
// create new state
|
46
45
|
auto config = arguments[0].asObject(rt);
|
47
|
-
auto& registry = core::UnistylesRegistry::get();
|
48
|
-
|
49
|
-
registry.createState(rt);
|
50
46
|
|
51
47
|
helpers::enumerateJSIObject(rt, config, [&](const std::string& propertyName, jsi::Value& propertyValue){
|
52
48
|
if (propertyName == "settings") {
|
@@ -71,9 +67,19 @@ jsi::Value HybridStyleSheet::configure(jsi::Runtime &rt, const jsi::Value &thisV
|
|
71
67
|
});
|
72
68
|
|
73
69
|
verifyAndSelectTheme(rt);
|
70
|
+
|
71
|
+
return jsi::Value::undefined();
|
72
|
+
}
|
73
|
+
|
74
|
+
jsi::Value HybridStyleSheet::init(jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) {
|
75
|
+
// create new state
|
76
|
+
auto& registry = core::UnistylesRegistry::get();
|
77
|
+
|
78
|
+
registry.createState(rt);
|
79
|
+
|
74
80
|
loadExternalMethods(thisVal, rt);
|
75
81
|
registerHooks(rt);
|
76
|
-
|
82
|
+
|
77
83
|
return jsi::Value::undefined();
|
78
84
|
}
|
79
85
|
|
@@ -32,11 +32,16 @@ struct HybridStyleSheet: public HybridUnistylesStyleSheetSpec {
|
|
32
32
|
const jsi::Value& thisValue,
|
33
33
|
const jsi::Value* args,
|
34
34
|
size_t count);
|
35
|
+
jsi::Value init(jsi::Runtime& rt,
|
36
|
+
const jsi::Value& thisValue,
|
37
|
+
const jsi::Value* args,
|
38
|
+
size_t count);
|
35
39
|
|
36
40
|
void loadHybridMethods() override {
|
37
41
|
HybridUnistylesStyleSheetSpec::loadHybridMethods();
|
38
42
|
|
39
43
|
registerHybrids(this, [](Prototype& prototype) {
|
44
|
+
prototype.registerRawHybridMethod("init", 1, &HybridStyleSheet::init);
|
40
45
|
prototype.registerRawHybridMethod("create", 1, &HybridStyleSheet::create);
|
41
46
|
prototype.registerRawHybridMethod("configure", 1, &HybridStyleSheet::configure);
|
42
47
|
});
|
@@ -1,7 +1,16 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
4
|
+
#error "Unistyles 3.0 requires your project to have New Architecture enabled."
|
5
|
+
#endif
|
6
|
+
|
7
|
+
#if __has_include(<ReactCommon/RCTTurboModuleWithJSIBindings.h>)
|
8
|
+
#import <ReactCommon/RCTTurboModuleWithJSIBindings.h>
|
9
|
+
#else
|
10
|
+
#error "Unistyles 3.0 requires your project to use React Native 0.75 or higher."
|
11
|
+
#endif
|
12
|
+
|
3
13
|
#import <React/RCTEventEmitter.h>
|
4
|
-
#import <ReactCommon/RCTTurboModuleWithJSIBindings.h>
|
5
14
|
#import "TurboUnistyles/TurboUnistyles.h"
|
6
15
|
#import <React/RCTSurfacePresenter.h>
|
7
16
|
#import <React/RCTScheduler.h>
|
package/lib/commonjs/index.js
CHANGED
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "useTheme", {
|
|
26
26
|
return _core.useTheme;
|
27
27
|
}
|
28
28
|
});
|
29
|
-
var _react = _interopRequireDefault(require("react"));
|
30
29
|
var _specs = require("./specs");
|
31
30
|
Object.keys(_specs).forEach(function (key) {
|
32
31
|
if (key === "default" || key === "__esModule") return;
|
@@ -41,17 +40,4 @@ Object.keys(_specs).forEach(function (key) {
|
|
41
40
|
});
|
42
41
|
var _mq = require("./mq");
|
43
42
|
var _core = require("./core");
|
44
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
45
|
-
// TODO: export Native createUnistylesComponent
|
46
|
-
// can't import it this way, it will break native build
|
47
|
-
// export { createUnistylesComponent } from './web/createUnistylesComponent'
|
48
|
-
|
49
|
-
// todo verify true min version
|
50
|
-
const minReactVersionRequiredByUnistyles = '18.3.1';
|
51
|
-
if (_react.default.version < minReactVersionRequiredByUnistyles) {
|
52
|
-
throw new Error(`
|
53
|
-
You are using an outdated version of React (${_react.default.version}).
|
54
|
-
Unistyles requires at least React ${minReactVersionRequiredByUnistyles}.
|
55
|
-
`);
|
56
|
-
}
|
57
43
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_specs","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_mq","_core"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,GAAA,GAAAb,OAAA;AAEA,IAAAc,KAAA,GAAAd,OAAA","ignoreList":[]}
|
@@ -14,5 +14,6 @@ HybridUnistylesStyleSheet.compose = _reactNative.StyleSheet.compose;
|
|
14
14
|
HybridUnistylesStyleSheet.jsMethods = {
|
15
15
|
processColor: _reactNative.processColor
|
16
16
|
};
|
17
|
+
HybridUnistylesStyleSheet.init();
|
17
18
|
const StyleSheet = exports.StyleSheet = HybridUnistylesStyleSheet;
|
18
19
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","_reactNative","HybridUnistylesStyleSheet","NitroModules","createHybridObject","absoluteFillObject","NativeStyleSheet","absoluteFill","flatten","compose","jsMethods","processColor","StyleSheet","exports"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNative","HybridUnistylesStyleSheet","NitroModules","createHybridObject","absoluteFillObject","NativeStyleSheet","absoluteFill","flatten","compose","jsMethods","processColor","init","StyleSheet","exports"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAgCA,MAAME,yBAAyB,GAAGC,qCAAY,CACzCC,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnEF,yBAAyB,CAACG,kBAAkB,GAAGC,uBAAgB,CAACD,kBAAkB;AAClFH,yBAAyB,CAACK,YAAY,GAAGD,uBAAgB,CAACC,YAAY;AACtEL,yBAAyB,CAACM,OAAO,GAAGF,uBAAgB,CAACE,OAAO;AAC5DN,yBAAyB,CAACO,OAAO,GAAGH,uBAAgB,CAACG,OAAO;AAC5DP,yBAAyB,CAACQ,SAAS,GAAG;EAClCC,YAAY,EAAZA;AACJ,CAAC;AAEDT,yBAAyB,CAACU,IAAI,CAAC,CAAC;AAIzB,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAGX,yBAAsE","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -1,19 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import React from 'react';
|
4
3
|
export * from './specs';
|
5
4
|
export { mq } from './mq';
|
6
5
|
export { useTheme, useBreakpoint } from './core';
|
7
|
-
// TODO: export Native createUnistylesComponent
|
8
|
-
// can't import it this way, it will break native build
|
9
|
-
// export { createUnistylesComponent } from './web/createUnistylesComponent'
|
10
|
-
|
11
|
-
// todo verify true min version
|
12
|
-
const minReactVersionRequiredByUnistyles = '18.3.1';
|
13
|
-
if (React.version < minReactVersionRequiredByUnistyles) {
|
14
|
-
throw new Error(`
|
15
|
-
You are using an outdated version of React (${React.version}).
|
16
|
-
Unistyles requires at least React ${minReactVersionRequiredByUnistyles}.
|
17
|
-
`);
|
18
|
-
}
|
19
6
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["mq","useTheme","useBreakpoint"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,SAASA,EAAE,QAAQ,MAAM;AAEzB,SAASC,QAAQ,EAAEC,aAAa,QAAQ,QAAQ","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;
|
1
|
+
{"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods","init"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;AAgC3E,MAAMC,yBAAyB,GAAGJ,YAAY,CACzCK,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnED,yBAAyB,CAACE,kBAAkB,GAAGH,gBAAgB,CAACG,kBAAkB;AAClFF,yBAAyB,CAACG,YAAY,GAAGJ,gBAAgB,CAACI,YAAY;AACtEH,yBAAyB,CAACI,OAAO,GAAGL,gBAAgB,CAACK,OAAO;AAC5DJ,yBAAyB,CAACK,OAAO,GAAGN,gBAAgB,CAACM,OAAO;AAC5DL,yBAAyB,CAACM,SAAS,GAAG;EAClCT;AACJ,CAAC;AAEDG,yBAAyB,CAACO,IAAI,CAAC,CAAC;AAIhC,OAAO,MAAMT,UAAU,GAAGE,yBAAsE","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA"}
|
@@ -17,13 +17,14 @@ export interface UnistylesStyleSheet extends UnistylesStyleSheetSpec {
|
|
17
17
|
absoluteFill: typeof NativeStyleSheetType.absoluteFill;
|
18
18
|
compose: typeof NativeStyleSheetType.compose;
|
19
19
|
flatten: typeof NativeStyleSheetType.flatten;
|
20
|
+
init(): void;
|
20
21
|
create: CreateUnistylesStyleSheet;
|
21
22
|
configure(config: UnistylesConfig): void;
|
22
23
|
jsMethods: {
|
23
24
|
processColor: typeof processColor;
|
24
25
|
};
|
25
26
|
}
|
26
|
-
type PrivateMethods = 'jsMethods' | 'addChangeListener';
|
27
|
+
type PrivateMethods = 'jsMethods' | 'addChangeListener' | 'init';
|
27
28
|
export declare const StyleSheet: Omit<UnistylesStyleSheet, PrivateMethods>;
|
28
29
|
export {};
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/specs/StyleSheet/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAkC,MAAM,cAAc,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,KAAK,iBAAiB,GAAG;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,MAAM,MAAM,eAAe,CAAC,GAAG,MAAM,eAAe,CAAA;CACvE,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAChE,kBAAkB,EAAE,OAAO,oBAAoB,CAAC,kBAAkB,CAAC;IACnE,YAAY,EAAE,OAAO,oBAAoB,CAAC,YAAY,CAAC;IACvD,OAAO,EAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAC7C,OAAO,EAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAG7C,MAAM,EAAE,yBAAyB,CAAC;IAClC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IACzC,SAAS,EAAE;QACP,YAAY,EAAE,OAAO,YAAY,CAAA;KACpC,CAAA;CACJ;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/specs/StyleSheet/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAkC,MAAM,cAAc,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,KAAK,iBAAiB,GAAG;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,MAAM,MAAM,eAAe,CAAC,GAAG,MAAM,eAAe,CAAA;CACvE,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAChE,kBAAkB,EAAE,OAAO,oBAAoB,CAAC,kBAAkB,CAAC;IACnE,YAAY,EAAE,OAAO,oBAAoB,CAAC,YAAY,CAAC;IACvD,OAAO,EAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAC7C,OAAO,EAAE,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAG7C,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,EAAE,yBAAyB,CAAC;IAClC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IACzC,SAAS,EAAE;QACP,YAAY,EAAE,OAAO,YAAY,CAAA;KACpC,CAAA;CACJ;AAeD,KAAK,cAAc,GAAG,WAAW,GAAG,mBAAmB,GAAG,MAAM,CAAA;AAEhE,eAAO,MAAM,UAAU,EAAgC,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAA"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -1,21 +1,5 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
|
3
1
|
export * from './specs'
|
4
2
|
export { mq } from './mq'
|
5
3
|
export type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
6
4
|
export { useTheme, useBreakpoint } from './core'
|
7
5
|
export type { UnistylesVariants } from './types'
|
8
|
-
|
9
|
-
// TODO: export Native createUnistylesComponent
|
10
|
-
// can't import it this way, it will break native build
|
11
|
-
// export { createUnistylesComponent } from './web/createUnistylesComponent'
|
12
|
-
|
13
|
-
// todo verify true min version
|
14
|
-
const minReactVersionRequiredByUnistyles = '18.3.1'
|
15
|
-
|
16
|
-
if (React.version < minReactVersionRequiredByUnistyles) {
|
17
|
-
throw new Error(`
|
18
|
-
You are using an outdated version of React (${React.version}).
|
19
|
-
Unistyles requires at least React ${minReactVersionRequiredByUnistyles}.
|
20
|
-
`)
|
21
|
-
}
|
@@ -23,6 +23,7 @@ export interface UnistylesStyleSheet extends UnistylesStyleSheetSpec {
|
|
23
23
|
flatten: typeof NativeStyleSheetType.flatten,
|
24
24
|
|
25
25
|
// overridden methods
|
26
|
+
init(): void,
|
26
27
|
create: CreateUnistylesStyleSheet,
|
27
28
|
configure(config: UnistylesConfig): void,
|
28
29
|
jsMethods: {
|
@@ -41,6 +42,8 @@ HybridUnistylesStyleSheet.jsMethods = {
|
|
41
42
|
processColor
|
42
43
|
}
|
43
44
|
|
44
|
-
|
45
|
+
HybridUnistylesStyleSheet.init()
|
46
|
+
|
47
|
+
type PrivateMethods = 'jsMethods' | 'addChangeListener' | 'init'
|
45
48
|
|
46
49
|
export const StyleSheet = HybridUnistylesStyleSheet as Omit<UnistylesStyleSheet, PrivateMethods>
|