Skip to content

feat: support arbitrary opacity values - #17

Draft
e-simpson wants to merge 1 commit into
mgcrea:mainfrom
e-simpson:codex/arbitrary-opacity
Draft

feat: support arbitrary opacity values#17
e-simpson wants to merge 1 commit into
mgcrea:mainfrom
e-simpson:codex/arbitrary-opacity

Conversation

@e-simpson

Copy link
Copy Markdown
Contributor

Summary

This PR adds Tailwind-style arbitrary opacity values while preserving the package's existing named five-point scale.

Changes

Core Implementation

  • opacity-[.67] and opacity-[0.67] map to React Native's normalized opacity value
  • opacity-[67%] maps explicit percentages to the same native value
  • Existing utilities such as opacity-65 remain unchanged
  • Values outside React Native's 0 through 1 range are rejected with a development warning

Testing

  • Covers raw decimal, integer boundary, whole-percentage, and decimal-percentage arbitrary values
  • Covers invalid negative, over-range, and malformed arbitrary values
  • Adds Babel transformation coverage proving opacity-[.67] compiles to opacity: 0.67

Documentation

  • Adds named and arbitrary opacity examples to the Layout reference
  • Documents the native range requirement

Examples

<View className="opacity-65" />       // { opacity: 0.65 }
<View className="opacity-[.67]" />    // { opacity: 0.67 }
<View className="opacity-[67%]" />    // { opacity: 0.67 }

Validation

  • bun run spec (28 files; 1,059 passed, 1 skipped)
  • bun run check
  • bun run lint
  • bun run format:check
  • bun run build
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant