rn-css 1.11.10 → 1.11.11
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/dist/convertUnits.js
CHANGED
|
@@ -17,7 +17,7 @@ function convertValue(key, value, units) {
|
|
|
17
17
|
return 0;
|
|
18
18
|
}
|
|
19
19
|
// colors should be left untouched
|
|
20
|
-
if (value.startsWith('#'))
|
|
20
|
+
if (value.startsWith('#') || value.startsWith('linear-gradient'))
|
|
21
21
|
return value;
|
|
22
22
|
// Percentage values need to rely on an other unit as reference
|
|
23
23
|
const finalUnits = { ...units };
|
package/dist/cssToRN/convert.js
CHANGED
|
@@ -136,7 +136,9 @@ function placeContent(value) {
|
|
|
136
136
|
exports.placeContent = placeContent;
|
|
137
137
|
function background(value) {
|
|
138
138
|
const values = value.match(/(linear-gradient\(|url\().*?\)|[^\s]+/mg) || [];
|
|
139
|
-
const backgroundColor = values.reverse().find(isColor) ||
|
|
139
|
+
const backgroundColor = values.reverse().find(isColor) ||
|
|
140
|
+
(values[0]?.startsWith('linear-gradient') && values[0].split(',').map(val => val.trim()).find(isColor)) ||
|
|
141
|
+
'transparent';
|
|
140
142
|
// We support everything on web
|
|
141
143
|
return react_native_1.Platform.OS === 'web' ? { backgroundColor, background: value } : { backgroundColor };
|
|
142
144
|
}
|
package/dist/styleComponent.js
CHANGED
|
@@ -26,7 +26,7 @@ function buildCSSString(chunks, functs, props, shared) {
|
|
|
26
26
|
.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? functs[i]({ shared, theme: shared, ...props }) : functs[i]]))
|
|
27
27
|
.flat()
|
|
28
28
|
// Convert the objects to string if the result is not a primitive
|
|
29
|
-
.map(chunk => typeof chunk === 'object' ? (0, rnToCss_1.default)(chunk) : chunk)
|
|
29
|
+
.map(chunk => chunk && typeof chunk === 'object' ? (0, rnToCss_1.default)(chunk) : chunk)
|
|
30
30
|
.join('');
|
|
31
31
|
if (props.rnCSS)
|
|
32
32
|
computedString += props.rnCSS.replace(/=/gm, ':') + ';';
|
package/package.json
CHANGED
package/src/convertUnits.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function convertValue (key: keyof PartialStyle | keyof Transform, value:
|
|
|
16
16
|
return 0
|
|
17
17
|
}
|
|
18
18
|
// colors should be left untouched
|
|
19
|
-
if (value.startsWith('#')) return value
|
|
19
|
+
if (value.startsWith('#') || value.startsWith('linear-gradient')) return value
|
|
20
20
|
|
|
21
21
|
// Percentage values need to rely on an other unit as reference
|
|
22
22
|
const finalUnits = { ...units }
|
package/src/cssToRN/convert.ts
CHANGED
|
@@ -119,7 +119,9 @@ export function placeContent (value: string) {
|
|
|
119
119
|
|
|
120
120
|
export function background (value: string) {
|
|
121
121
|
const values = value.match(/(linear-gradient\(|url\().*?\)|[^\s]+/mg) || []
|
|
122
|
-
const backgroundColor = values.reverse().find(isColor) ||
|
|
122
|
+
const backgroundColor = values.reverse().find(isColor) ||
|
|
123
|
+
(values[0]?.startsWith('linear-gradient') && values[0].split(',').map(val => val.trim()).find(isColor)) ||
|
|
124
|
+
'transparent'
|
|
123
125
|
// We support everything on web
|
|
124
126
|
return Platform.OS === 'web' ? { backgroundColor, background: value } : { backgroundColor }
|
|
125
127
|
}
|
package/src/styleComponent.tsx
CHANGED
|
@@ -44,7 +44,7 @@ function buildCSSString<T extends { rnCSS?: string }> (chunks: TemplateStringsAr
|
|
|
44
44
|
.map((chunk, i) => ([chunk, (functs[i] instanceof Function) ? (functs[i] as Functs<T>)({ shared, theme: (shared as DefaultTheme), ...props }) : functs[i]]))
|
|
45
45
|
.flat()
|
|
46
46
|
// Convert the objects to string if the result is not a primitive
|
|
47
|
-
.map(chunk => typeof chunk === 'object' ? rnToCSS(chunk as Partial<CompleteStyle>) : chunk)
|
|
47
|
+
.map(chunk => chunk && typeof chunk === 'object' ? rnToCSS(chunk as Partial<CompleteStyle>) : chunk)
|
|
48
48
|
.join('')
|
|
49
49
|
if (props.rnCSS) computedString += props.rnCSS.replace(/=/gm, ':') + ';'
|
|
50
50
|
return computedString
|