rn-css 1.6.1 → 1.6.2
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/styleComponent.js +2 -3
- package/package.json +1 -1
- package/src/styleComponent.tsx +2 -4
package/dist/styleComponent.js
CHANGED
|
@@ -102,18 +102,17 @@ const styled = (Component) => {
|
|
|
102
102
|
}, [em, mediaQuery, tempStyle]);
|
|
103
103
|
const units = react_1.default.useMemo(() => ({ ...baseUnits, em }), [baseUnits, em]);
|
|
104
104
|
const styleConvertedFromCSS = react_1.default.useMemo(() => (0, convertStyle_1.default)(finalStyle, units), [finalStyle, units]);
|
|
105
|
-
const style = react_1.default.useMemo(() => react_native_1.StyleSheet.flatten([props.style
|
|
105
|
+
const style = react_1.default.useMemo(() => react_native_1.StyleSheet.flatten([styleConvertedFromCSS, props.style]), [props.style, styleConvertedFromCSS]);
|
|
106
106
|
const newProps = react_1.default.useMemo(() => {
|
|
107
107
|
const newProps = { style, onMouseEnter, onMouseLeave, onLayout };
|
|
108
108
|
if (style.textOverflow === 'ellipsis')
|
|
109
109
|
Object.assign(newProps, { numberOfLines: 1 });
|
|
110
110
|
return newProps;
|
|
111
111
|
}, [onLayout, onMouseEnter, onMouseLeave, style]);
|
|
112
|
-
console.log(style, styleConvertedFromCSS, tempStyle, rnStyle, css);
|
|
113
112
|
// The lines below can improve perfs, but it causes the component to remount when the font size changes
|
|
114
113
|
// const currentFontSize = React.useContext(FontSizeContext)
|
|
115
114
|
// if (em !== currentFontSize) {
|
|
116
|
-
if (
|
|
115
|
+
if (style.fontSize) {
|
|
117
116
|
return react_1.default.createElement(exports.FontSizeContext.Provider, { value: em },
|
|
118
117
|
react_1.default.createElement(Component, { ref: ref, ...props, ...newProps }));
|
|
119
118
|
}
|
package/package.json
CHANGED
package/src/styleComponent.tsx
CHANGED
|
@@ -114,19 +114,17 @@ const styled = <Props, >(Component: React.ComponentType<Props>) => {
|
|
|
114
114
|
const units = React.useMemo<Units>(() => ({ ...baseUnits, em }), [baseUnits, em])
|
|
115
115
|
|
|
116
116
|
const styleConvertedFromCSS = React.useMemo(() => convertStyle(finalStyle, units), [finalStyle, units])
|
|
117
|
-
const style: StyleProp<any> = React.useMemo(() => StyleSheet.flatten([props.style
|
|
117
|
+
const style: StyleProp<any> = React.useMemo(() => StyleSheet.flatten([styleConvertedFromCSS, props.style]), [props.style, styleConvertedFromCSS])
|
|
118
118
|
const newProps = React.useMemo(() => {
|
|
119
119
|
const newProps: OptionalProps = { style, onMouseEnter, onMouseLeave, onLayout }
|
|
120
120
|
if (style.textOverflow === 'ellipsis') Object.assign(newProps, { numberOfLines: 1 })
|
|
121
121
|
return newProps
|
|
122
122
|
}, [onLayout, onMouseEnter, onMouseLeave, style])
|
|
123
123
|
|
|
124
|
-
console.log(style, styleConvertedFromCSS, tempStyle, rnStyle, css)
|
|
125
|
-
|
|
126
124
|
// The lines below can improve perfs, but it causes the component to remount when the font size changes
|
|
127
125
|
// const currentFontSize = React.useContext(FontSizeContext)
|
|
128
126
|
// if (em !== currentFontSize) {
|
|
129
|
-
if (
|
|
127
|
+
if (style.fontSize) {
|
|
130
128
|
return <FontSizeContext.Provider value={em}>
|
|
131
129
|
<Component ref={ref} {...props} {...newProps} />
|
|
132
130
|
</FontSizeContext.Provider>
|