rn-css 1.10.1 → 1.10.3

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.
@@ -41,8 +41,8 @@ const convertStyle = (rnStyle, units) => {
41
41
  height: (0, convertUnits_1.convertValue)(key, rnStyle.textShadowOffset.height || '0', units)
42
42
  };
43
43
  }
44
- // Font family should not be transformed (same as cursor for web in case of base64 value)
45
- else if (['cursor', 'fontFamily'].includes(key)) {
44
+ // Font family should not be transformed (same as cursor for web in case of base64 value, and boxShadow/textShadow for web)
45
+ else if (['cursor', 'fontFamily', 'boxShadow', 'textShadow'].includes(key)) {
46
46
  convertedStyle[key] = value;
47
47
  }
48
48
  else {
@@ -126,8 +126,12 @@ function cssChunkToStyle(css) {
126
126
  break;
127
127
  case 'boxShadow':
128
128
  case 'textShadow':
129
+ // To provide support for the 4th element (spread-radius) at least for web
130
+ if (react_native_1.Platform.OS === 'web')
131
+ Object.assign(result, { [key]: value });
129
132
  // We need to replace boxShadow by shadow
130
- Object.assign(result, (0, convert_1.shadow)(key === 'boxShadow' ? 'shadow' : key, value));
133
+ else
134
+ Object.assign(result, (0, convert_1.shadow)(key === 'boxShadow' ? 'shadow' : key, value));
131
135
  break;
132
136
  // Other keys don't require any special treatment
133
137
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-css",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "scripts": {
5
5
  "test": "jest",
6
6
  "prepare": "rm -rf dist && tsc",
@@ -42,8 +42,8 @@ const convertStyle = <T extends AnyStyle | Animated.WithAnimatedValue<AnyStyle>
42
42
  height: convertValue(key, rnStyle.textShadowOffset!.height || '0', units) as number
43
43
  }
44
44
  }
45
- // Font family should not be transformed (same as cursor for web in case of base64 value)
46
- else if (['cursor', 'fontFamily'].includes(key)) {
45
+ // Font family should not be transformed (same as cursor for web in case of base64 value, and boxShadow/textShadow for web)
46
+ else if (['cursor', 'fontFamily', 'boxShadow', 'textShadow'].includes(key)) {
47
47
  convertedStyle[key as 'fontFamily'] = value
48
48
  }
49
49
  else {
@@ -1,4 +1,4 @@
1
- import { Dimensions } from 'react-native'
1
+ import { Dimensions, Platform } from 'react-native'
2
2
  import convertStyle from '../convertStyle'
3
3
  import { CompleteStyle, Context, PartialStyle, Style, Units } from '../types'
4
4
  import { sideValue, border, borderLike, cornerValue, font, textDecoration, shadow, placeContent, flex, flexFlow, transform, background } from './convert'
@@ -123,8 +123,10 @@ function cssChunkToStyle (css: string) {
123
123
  break
124
124
  case 'boxShadow':
125
125
  case 'textShadow':
126
+ // To provide support for the 4th element (spread-radius) at least for web
127
+ if (Platform.OS === 'web') Object.assign(result, { [key]: value })
126
128
  // We need to replace boxShadow by shadow
127
- Object.assign(result, shadow(key === 'boxShadow' ? 'shadow' : key, value))
129
+ else Object.assign(result, shadow(key === 'boxShadow' ? 'shadow' : key, value))
128
130
  break
129
131
  // Other keys don't require any special treatment
130
132
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment