Skip to content

Commit 8baed3b

Browse files
committed
fix: always replace inline and block padding and margin
1 parent 2a46b6c commit 8baed3b

File tree

1 file changed

+13
-13
lines changed
  • packages/uniwind/src/metro/processor

1 file changed

+13
-13
lines changed

packages/uniwind/src/metro/processor/rn.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,18 @@ export class RN {
181181
cssToRN(property: string, value: any) {
182182
const transformedProperty = property.startsWith('--')
183183
? property
184-
: toCamelCase(property)
184+
: pipe(property)(
185+
toCamelCase,
186+
x => {
187+
if (x.includes('padding') || x.includes('margin')) {
188+
return x
189+
.replace('Inline', 'Horizontal')
190+
.replace('Block', 'Vertical')
191+
}
192+
193+
return x
194+
},
195+
)
185196

186197
const rn = this.transformProperty(
187198
transformedProperty,
@@ -202,18 +213,7 @@ export class RN {
202213
const propertyEnd = property.includes('border')
203214
? property.split('border').at(-1) ?? ''
204215
: ''
205-
const transformedProperty = pipe(property)(
206-
x => x.replace(propertyEnd, ''),
207-
x => {
208-
if (x.includes('padding') || x.includes('margin')) {
209-
return x
210-
.replace('Inline', 'Horizontal')
211-
.replace('Block', 'Vertical')
212-
}
213-
214-
return x
215-
},
216-
)
216+
const transformedProperty = property.replace(propertyEnd, '')
217217

218218
if (properties.every(property => ['row', 'column'].includes(property))) {
219219
return {

0 commit comments

Comments
 (0)