@builder.io/mitosis 0.11.0 → 0.11.1
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.
|
@@ -380,7 +380,7 @@ const _componentToReact = (json, options, isSubComponent = false) => {
|
|
|
380
380
|
${componentBody}
|
|
381
381
|
}${isForwardRef ? ')' : ''}
|
|
382
382
|
|
|
383
|
-
${reactNativeStyles
|
|
383
|
+
${reactNativeStyles && Object.keys(reactNativeStyles).length > 0
|
|
384
384
|
? `const styles = StyleSheet.create(${json5_1.default.stringify(reactNativeStyles)});`
|
|
385
385
|
: ''}
|
|
386
386
|
|
|
@@ -10,12 +10,11 @@ const get_state_object_string_1 = require("../../../helpers/get-state-object-str
|
|
|
10
10
|
const get_typed_function_1 = require("../../../helpers/get-typed-function");
|
|
11
11
|
const is_mitosis_node_1 = require("../../../helpers/is-mitosis-node");
|
|
12
12
|
const patterns_1 = require("../../../helpers/patterns");
|
|
13
|
-
const helpers_1 = require("../../../helpers/styles/helpers");
|
|
14
13
|
const transform_state_setters_1 = require("../../../helpers/transform-state-setters");
|
|
15
14
|
const core_1 = require("@babel/core");
|
|
16
15
|
const function_1 = require("fp-ts/lib/function");
|
|
17
16
|
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
18
|
-
const
|
|
17
|
+
const helpers_1 = require("../helpers");
|
|
19
18
|
/**
|
|
20
19
|
* Removes all `this.` references.
|
|
21
20
|
*/
|
|
@@ -25,7 +24,7 @@ const stripThisRefs = (str, options) => {
|
|
|
25
24
|
}
|
|
26
25
|
return str.replace(/this\.([a-zA-Z_\$0-9]+)/g, '$1');
|
|
27
26
|
};
|
|
28
|
-
const processHookCode = ({ str, options }) => (0,
|
|
27
|
+
const processHookCode = ({ str, options }) => (0, helpers_1.processBinding)((0, exports.updateStateSettersInCode)(str, options), options);
|
|
29
28
|
exports.processHookCode = processHookCode;
|
|
30
29
|
const valueMapper = (options) => (val) => {
|
|
31
30
|
const x = (0, exports.processHookCode)({ str: val, options });
|
|
@@ -150,9 +149,6 @@ const getDefaultImport = (options, json) => {
|
|
|
150
149
|
});
|
|
151
150
|
}
|
|
152
151
|
});
|
|
153
|
-
if ((0, helpers_1.hasCss)(json)) {
|
|
154
|
-
namesUsed.add('StyleSheet');
|
|
155
|
-
}
|
|
156
152
|
(0, legacy_1.default)(json).forEach((node) => {
|
|
157
153
|
var _a, _b, _c, _d;
|
|
158
154
|
if (!(0, is_mitosis_node_1.isMitosisNode)(node)) {
|
|
@@ -162,6 +158,9 @@ const getDefaultImport = (options, json) => {
|
|
|
162
158
|
if (((_a = node.properties._text) === null || _a === void 0 ? void 0 : _a.trim().length) || ((_d = (_c = (_b = node.bindings._text) === null || _b === void 0 ? void 0 : _b.code) === null || _c === void 0 ? void 0 : _c.trim()) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
163
159
|
namesUsed.add('Text');
|
|
164
160
|
}
|
|
161
|
+
if (node.properties.style || node.bindings.style) {
|
|
162
|
+
namesUsed.add('StyleSheet');
|
|
163
|
+
}
|
|
165
164
|
if (node.name === 'TouchableOpacity' &&
|
|
166
165
|
('href' in node.bindings || 'href' in node.properties)) {
|
|
167
166
|
namesUsed.add('Linking');
|