@mgcrea/react-native-tailwind 0.15.5 → 0.15.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgcrea/react-native-tailwind",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
4
4
  "description": "Compile-time Tailwind CSS for React Native with zero runtime overhead",
5
5
  "author": "Olivier Louvignes <olivier@mgcrea.io> (https://github.com/mgcrea)",
6
6
  "homepage": "https://github.com/mgcrea/react-native-tailwind#readme",
@@ -253,6 +253,16 @@ describe("parseSizing - comprehensive coverage", () => {
253
253
  expect(parseSizing("w-full")).toEqual({ width: "100%" });
254
254
  expect(parseSizing("h-full")).toEqual({ height: "100%" });
255
255
  });
256
+
257
+ it("should parse px (1 pixel) across all sizing utilities", () => {
258
+ expect(parseSizing("w-px")).toEqual({ width: 1 });
259
+ expect(parseSizing("h-px")).toEqual({ height: 1 });
260
+ expect(parseSizing("size-px")).toEqual({ width: 1, height: 1 });
261
+ expect(parseSizing("min-w-px")).toEqual({ minWidth: 1 });
262
+ expect(parseSizing("min-h-px")).toEqual({ minHeight: 1 });
263
+ expect(parseSizing("max-w-px")).toEqual({ maxWidth: 1 });
264
+ expect(parseSizing("max-h-px")).toEqual({ maxHeight: 1 });
265
+ });
256
266
  });
257
267
 
258
268
  describe("parseSizing - custom spacing", () => {
@@ -7,6 +7,7 @@ import type { StyleObject } from "../types";
7
7
 
8
8
  // Size scale (in pixels/percentages)
9
9
  export const SIZE_SCALE: Record<string, number> = {
10
+ px: 1,
10
11
  0: 0,
11
12
  0.5: 2,
12
13
  1: 4,
@@ -231,6 +231,30 @@ describe("parseSpacing - edge cases", () => {
231
231
  expect(parseSpacing("gap-0")).toEqual({ gap: 0 });
232
232
  });
233
233
 
234
+ it("should parse px (1 pixel) across all spacing utilities", () => {
235
+ expect(parseSpacing("m-px")).toEqual({ margin: 1 });
236
+ expect(parseSpacing("mx-px")).toEqual({ marginHorizontal: 1 });
237
+ expect(parseSpacing("my-px")).toEqual({ marginVertical: 1 });
238
+ expect(parseSpacing("mt-px")).toEqual({ marginTop: 1 });
239
+ expect(parseSpacing("mr-px")).toEqual({ marginRight: 1 });
240
+ expect(parseSpacing("mb-px")).toEqual({ marginBottom: 1 });
241
+ expect(parseSpacing("ml-px")).toEqual({ marginLeft: 1 });
242
+ expect(parseSpacing("ms-px")).toEqual({ marginStart: 1 });
243
+ expect(parseSpacing("me-px")).toEqual({ marginEnd: 1 });
244
+ expect(parseSpacing("p-px")).toEqual({ padding: 1 });
245
+ expect(parseSpacing("px-px")).toEqual({ paddingHorizontal: 1 });
246
+ expect(parseSpacing("py-px")).toEqual({ paddingVertical: 1 });
247
+ expect(parseSpacing("pt-px")).toEqual({ paddingTop: 1 });
248
+ expect(parseSpacing("pr-px")).toEqual({ paddingRight: 1 });
249
+ expect(parseSpacing("pb-px")).toEqual({ paddingBottom: 1 });
250
+ expect(parseSpacing("pl-px")).toEqual({ paddingLeft: 1 });
251
+ expect(parseSpacing("ps-px")).toEqual({ paddingStart: 1 });
252
+ expect(parseSpacing("pe-px")).toEqual({ paddingEnd: 1 });
253
+ expect(parseSpacing("gap-px")).toEqual({ gap: 1 });
254
+ expect(parseSpacing("-m-px")).toEqual({ margin: -1 });
255
+ expect(parseSpacing("-mt-px")).toEqual({ marginTop: -1 });
256
+ });
257
+
234
258
  it("should not match partial class names", () => {
235
259
  expect(parseSpacing("sm-4")).toBeNull();
236
260
  expect(parseSpacing("margin-4")).toBeNull();
@@ -6,6 +6,7 @@ import type { StyleObject } from "../types";
6
6
 
7
7
  // Tailwind spacing scale (in pixels, converted to React Native units)
8
8
  export const SPACING_SCALE: Record<string, number> = {
9
+ px: 1,
9
10
  0: 0,
10
11
  0.5: 2,
11
12
  1: 4,