rn-css 1.9.4 → 1.10.0

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.
@@ -24,9 +24,9 @@ function convertValue(key, value, units) {
24
24
  if (value.includes('%')) {
25
25
  if (react_native_1.Platform.OS === 'web')
26
26
  return value;
27
- if (['marginTop', 'marginBottom', 'translateY'].includes(key))
27
+ if (['marginTop', 'marginBottom', 'translateY'].includes(key) || key.startsWith('borderTop') || key.startsWith('borderBottom'))
28
28
  finalUnits['%'] = units.height / 100;
29
- else if (['marginLeft', 'marginRight', 'translateX'].includes(key))
29
+ else if (['marginLeft', 'marginRight', 'translateX'].includes(key) || key.startsWith('borderLeft') || key.startsWith('borderRight'))
30
30
  finalUnits['%'] = units.width / 100;
31
31
  else if (key.startsWith('border') && key.endsWith('Radius'))
32
32
  finalUnits['%'] = (units.width + units.height) / 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-css",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "scripts": {
5
5
  "test": "jest",
6
6
  "prepare": "rm -rf dist && tsc",
@@ -22,8 +22,8 @@ export function convertValue (key: keyof PartialStyle | keyof Transform, value:
22
22
  const finalUnits = { ...units }
23
23
  if (value.includes('%')) {
24
24
  if (Platform.OS === 'web') return value
25
- if (['marginTop', 'marginBottom', 'translateY'].includes(key)) finalUnits['%'] = units.height! / 100
26
- else if (['marginLeft', 'marginRight', 'translateX'].includes(key)) finalUnits['%'] = units.width! / 100
25
+ if (['marginTop', 'marginBottom', 'translateY'].includes(key) || key.startsWith('borderTop') || key.startsWith('borderBottom')) finalUnits['%'] = units.height! / 100
26
+ else if (['marginLeft', 'marginRight', 'translateX'].includes(key) || key.startsWith('borderLeft') || key.startsWith('borderRight')) finalUnits['%'] = units.width! / 100
27
27
  else if (key.startsWith('border') && key.endsWith('Radius')) finalUnits['%'] = (units.width! + units.height!) / 200
28
28
  else if (['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'top', 'left', 'bottom', 'right', 'flexBasis', 'rotate3d'].includes(key)) {
29
29
  if (value.startsWith('calc') || value.startsWith('max') || value.startsWith('min')) {