Skip to content

Conversation

@Brentlok
Copy link
Contributor

@Brentlok Brentlok commented Jan 23, 2026

fix #323

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with newer React Native releases to ensure consistent color-scheme handling and theme application across platforms (web and native).
    • Treats an "unspecified" system appearance as Light and uses a stable fallback on non-web platforms to avoid incorrect or missing theme states.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

Adds React Native version awareness and maps RN's 'unspecified' color scheme to Light. Replaces use of undefined with an internal UNSPECIFIED_THEME when setting color schemes on non-web platforms and updates event/getter handling to avoid passing null/undefined to RN >= 0.82 APIs.

Changes

Cohort / File(s) Summary
React Native 0.82+ compatibility
packages/uniwind/src/core/config/config.common.ts
Introduces RN_VERSION (minor) and UNSPECIFIED_THEME; treats event.colorScheme === 'unspecified' as Light; getter maps 'unspecified' → Light; uses UNSPECIFIED_THEME instead of undefined when applying themes or handling SYSTEM_THEME on non-web platforms to avoid passing null to RN APIs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A little rabbit hops and sings,
RN versions, and new tiny things,
"unspecified" now whispers Light,
No more crashes in the night,
Hooray — the themes all sleep tight! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: adding support for the new 'unspecified' ColorSchemeName value in React Native 0.82+.
Linked Issues check ✅ Passed The changes directly address issue #323 by handling the 'unspecified' color scheme value that causes crashes in RN 0.82+, preventing null parameter errors.
Out of Scope Changes check ✅ Passed All changes are scoped to handling RN 0.82+ ColorSchemeName compatibility; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/uniwind/src/core/config/config.common.ts`:
- Around line 7-8: The RN version check should safely read the numeric minor
version and compare it as an integer; change the logic around
RN_VERSION/UNSPECIFIED_THEME so it uses optional chaining to avoid
Platform.constants being undefined (e.g., read
Platform.constants?.reactNativeVersion?.minor ?? 0 into a RN_MINOR variable) and
compare RN_MINOR >= 82 (integer) to decide UNSPECIFIED_THEME ('unspecified' or
undefined). Update references to RN_VERSION and UNSPECIFIED_THEME in any
dependent code to use the new RN_MINOR-based check.

@Brentlok Brentlok merged commit e4688ed into main Jan 26, 2026
2 checks passed
@Brentlok Brentlok deleted the fix/rn-0.82-unspecified-color-scheme branch January 26, 2026 07:59
@niteshbalusu11
Copy link

Could you please make a release with this fix, since it is now merged.

@Brentlok
Copy link
Contributor Author

Could you please make a release with this fix, since it is now merged.

Released in https://github.com/uni-stack/uniwind/releases/tag/v1.2.7

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.

Uniwind.setTheme('system') crash on RN 0.82 above

3 participants