rn-css 1.6.11 → 1.6.12
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.
|
@@ -29,6 +29,9 @@ export declare function placeContent(value: string): {
|
|
|
29
29
|
alignContent: string;
|
|
30
30
|
justifyContent: string;
|
|
31
31
|
};
|
|
32
|
+
export declare function background(value: string): {
|
|
33
|
+
backgroundColor: string | undefined;
|
|
34
|
+
};
|
|
32
35
|
export declare function textDecoration(value: string): {
|
|
33
36
|
textDecorationLine: string;
|
|
34
37
|
textDecorationStyle: string;
|
package/dist/cssToRN/convert.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cornerValue = exports.sideValue = exports.font = exports.transform = exports.textDecoration = exports.placeContent = exports.flexFlow = exports.flex = exports.shadow = exports.border = void 0;
|
|
3
|
+
exports.cornerValue = exports.sideValue = exports.font = exports.transform = exports.textDecoration = exports.background = exports.placeContent = exports.flexFlow = exports.flex = exports.shadow = exports.border = void 0;
|
|
4
4
|
/** Check if the value is a number. Numbers start with a digit, a decimal point or calc(, max( ou min( */
|
|
5
5
|
function isNumber(value) {
|
|
6
6
|
return value.match(/^[+-]?(\.\d|\d|calc\(|max\(|min\()/mg);
|
|
@@ -87,6 +87,12 @@ function placeContent(value) {
|
|
|
87
87
|
return { alignContent, justifyContent };
|
|
88
88
|
}
|
|
89
89
|
exports.placeContent = placeContent;
|
|
90
|
+
function background(value) {
|
|
91
|
+
const values = value.split(/\s+/mg);
|
|
92
|
+
// The background-color is the only one that we support and it's the last value
|
|
93
|
+
return { backgroundColor: values.pop() };
|
|
94
|
+
}
|
|
95
|
+
exports.background = background;
|
|
90
96
|
function textDecoration(value) {
|
|
91
97
|
const values = value.split(/\s+/mg);
|
|
92
98
|
const result = {
|
package/dist/cssToRN/index.js
CHANGED
|
@@ -81,7 +81,7 @@ function cssChunkToStyle(css) {
|
|
|
81
81
|
Object.assign(result, (0, convert_1.sideValue)('border', value, 'Width'));
|
|
82
82
|
break;
|
|
83
83
|
case 'background':
|
|
84
|
-
Object.assign(result,
|
|
84
|
+
Object.assign(result, (0, convert_1.background)(value));
|
|
85
85
|
break;
|
|
86
86
|
case 'padding':
|
|
87
87
|
case 'margin':
|
package/package.json
CHANGED
package/src/cssToRN/convert.ts
CHANGED
|
@@ -75,6 +75,12 @@ export function placeContent (value: string) {
|
|
|
75
75
|
return { alignContent, justifyContent }
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
export function background (value: string) {
|
|
79
|
+
const values = value.split(/\s+/mg)
|
|
80
|
+
// The background-color is the only one that we support and it's the last value
|
|
81
|
+
return { backgroundColor: values.pop() }
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
export function textDecoration (value: string) {
|
|
79
85
|
const values = value.split(/\s+/mg)
|
|
80
86
|
const result = {
|
package/src/cssToRN/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dimensions } from 'react-native'
|
|
2
2
|
import convertStyle from '../convertStyle'
|
|
3
3
|
import type { Context, PartialStyle, Style, Units } from '../types'
|
|
4
|
-
import { sideValue, border, cornerValue, font, textDecoration, shadow, placeContent, flex, flexFlow, transform } from './convert'
|
|
4
|
+
import { sideValue, border, cornerValue, font, textDecoration, shadow, placeContent, flex, flexFlow, transform, background } from './convert'
|
|
5
5
|
import { createMedia } from './mediaQueries'
|
|
6
6
|
|
|
7
7
|
function kebab2camel (string: string) {
|
|
@@ -78,7 +78,7 @@ function cssChunkToStyle (css: string) {
|
|
|
78
78
|
Object.assign(result, sideValue('border', value, 'Width'))
|
|
79
79
|
break
|
|
80
80
|
case 'background':
|
|
81
|
-
Object.assign(result,
|
|
81
|
+
Object.assign(result, background(value))
|
|
82
82
|
break
|
|
83
83
|
case 'padding':
|
|
84
84
|
case 'margin':
|