rn-css 1.6.9 → 1.6.10

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.
@@ -109,10 +109,8 @@ const styled = (Component) => {
109
109
  return newProps;
110
110
  }, [finalStyle.textOverflow, onLayout, onMouseEnter, onMouseLeave, props.style, styleConvertedFromCSS]);
111
111
  react_1.default.useEffect(() => () => removeStyle(hash), [hash]);
112
- // The lines below can improve perfs, but it causes the component to remount when the font size changes
113
- // const currentFontSize = React.useContext(FontSizeContext)
114
- // if (em !== currentFontSize) {
115
- if (styleConvertedFromCSS.fontSize) {
112
+ // em !== parentEm alone is a bit dangerous as the component would rerender when the font size change
113
+ if (em !== parentEm || finalStyle.fontSize !== undefined) {
116
114
  return react_1.default.createElement(exports.FontSizeContext.Provider, { value: em },
117
115
  react_1.default.createElement(Component, { ref: ref, ...props, ...newProps }));
118
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-css",
3
- "version": "1.6.9",
3
+ "version": "1.6.10",
4
4
  "scripts": {
5
5
  "test": "jest",
6
6
  "prepare": "tsc",
@@ -122,10 +122,8 @@ const styled = <Props, >(Component: React.ComponentType<Props>) => {
122
122
 
123
123
  React.useEffect(() => () => removeStyle(hash), [hash])
124
124
 
125
- // The lines below can improve perfs, but it causes the component to remount when the font size changes
126
- // const currentFontSize = React.useContext(FontSizeContext)
127
- // if (em !== currentFontSize) {
128
- if (styleConvertedFromCSS.fontSize) {
125
+ // em !== parentEm alone is a bit dangerous as the component would rerender when the font size change
126
+ if (em !== parentEm || finalStyle.fontSize !== undefined) {
129
127
  return <FontSizeContext.Provider value={em}>
130
128
  <Component ref={ref} {...props} {...newProps} />
131
129
  </FontSizeContext.Provider>