react / react/react-native

P3 Color Space Issue

未关闭
#41,517 5 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Repro Needs: Triage :mag: Never gets stale Newer Patch Available p: Infinite Red
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

React-Native on iOS and Android don't have P3 Color Space compatibility.

NOTE: This was tested with new & old arch.

React Native Version

0.72.6

Output of npx react-native info
System:
OS: macOS 14.1.1
CPU: (10) arm64 Apple M1 Max
Memory: 3.11 GB / 64.00 GB
Shell:
  version: "5.9"
  path: /bin/zsh
Binaries:
Node:
  version: 18.18.2
  path: ~/.asdf/installs/nodejs/18.18.2/bin/node
Yarn:
  version: 1.22.19
  path: ~/.asdf/shims/yarn
npm:
  version: 9.8.1
  path: ~/.asdf/plugins/nodejs/shims/npm
Watchman: Not Found
Managers:
CocoaPods:
  version: 1.12.1
  path: /Users/yulolimum/.asdf/shims/pod
SDKs:
iOS SDK:
  Platforms:
    - DriverKit 23.0
    - iOS 17.0
    - macOS 14.0
    - tvOS 17.0
    - watchOS 10.0
Android SDK:
  API Levels:
    - "28"
    - "29"
    - "30"
    - "31"
    - "32"
    - "33"
  Build Tools:
    - 29.0.2
    - 30.0.2
    - 30.0.3
    - 31.0.0
    - 32.0.0
    - 32.1.0
    - 33.0.0
  System Images:
    - android-25 | Intel x86_64 Atom
    - android-25 | Google APIs ARM EABI v7a
    - android-28 | ARM 64 v8a
    - android-29 | ARM 64 v8a
    - android-29 | Google Play ARM 64 v8a
    - android-30 | Google APIs ARM 64 v8a
    - android-31 | Android TV ARM 64 v8a
    - android-32 | Desktop ARM 64 v8a
    - android-32 | Google APIs ARM 64 v8a
    - android-33 | Google Play ARM 64 v8a
    - android-34 | Google APIs ARM 64 v8a
    - android-34 | Google Play ARM 64 v8a
  Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8139111
Xcode:
  version: 15.0.1/15A507
  path: /usr/bin/xcodebuild
Languages:
Java:
  version: 15.0.6
  path: /Users/yulolimum/.asdf/shims/javac
Ruby:
  version: 3.2.2
  path: /Users/yulolimum/.asdf/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
  installed: 18.2.0
  wanted: 18.2.0
react-native:
  installed: 0.72.6
  wanted: 0.72.6
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Steps to reproduce

Steps to Reproduce

Verify Device

Before we build the repro app, let's verify that your device is wide-gamut capable.

iOS:

  • Have a relatively recent iOS device.
  • Go to Safari and type in https://www.wide-gamut.com/
  • The "DCI P3" checkbox should be checked.
  • Click on the "Test" menu item.
  • The red box image should have a visible "W".

Android:

  • Not every new Android device support wide gamut, you'll have better luck with pixels and higher-end samsungs.
  • Open chrome and go to chrome://flags.
  • Search for "Force color profile".
  • Select "Display P3".
  • Restart Chrome and type in https://www.wide-gamut.com/
  • The "DCI P3" checkbox should be checked.
  • Click on the "Test" menu item.
  • The red box image should have a visible "W".

Run Baseline App W/O Wide Gamut
  1. Clone repo:
git clone git@github.com:yulolimum/tmp-p3-color-space-repro.git
  1. Install deps:
yarn
  • This should install node modules, gems, and pods for you.
  1. Start metro server:
yarn start
  1. Connect your physical iOS device and build the app (you may need to setup code-signing).
yarn ios --device
  • Take some screenshots.
  1. Connect your physical Android device and build the app
(cd android && ./gradlew clean)
yarn android
  • Take some screenshots.
  • Review logs via logcat:
adb logcat | grep "MainColorGamutCheck"
  1. On Android, launch an alternative activity (DemoActivity) which loads in the wide-gamut image directly in the xml by-passing react-native.
(cd android && ./gradlew clean)
yarn android --main-activity DemoActivity
  • Take some screenshots.
  • Review logs via logcat:
adb logcat | grep "DemoColorGamutCheck"
  1. Quick on-device observations:
  • ✅ On iOS, the wide-gamut image should have a visible Android.
  • ❌ On iOS, the red/green/blue view colors should look visibly dull compared to the wide-gamut image.
  • ❌ On Android main-activity, the wide-gamut image should not render properly and colors should be a bit muted.
  • ❌ On Android demo-activity, the wide-gamut image's Android logo should not be visible.

Run App W/ Method Swizzling (iOS) and Wide Gamut Color Mode (Android)
  1. Clone/checkout the wide-gamut branch:
git clone -v wide-gamut git@github.com:yulolimum/tmp-p3-color-space-repro.git
  1. Start metro server:
yarn start
  1. Repeat steps from previous section.

  2. Quick on-device observations:

  • ✅ On iOS, the method overrides seem to take effect.
  • ✅ On Android both activities, the logcat logs show wide-gamut support.
  • ❌ On Android main-activity, no visible change.
  • ✅ On Android demo-activity, wide-gamut is observed.

Compare Screenshots
  1. Transfer the screenshots to your computer.

    • Be mindful of how you transfer photos - some methods will compress and/or strip metadata.
    • Airdrop on iOS and adb pull on Android has been most reliable.
  2. Download and use the Pika app to compare the colors from the screenshots (baseline screenshots vs wide-gamut screenshots). Note: you will need a P3 capable display to perform this action.

Snack, screenshot, or link to a repository

Repo: https://github.com/yulolimum/tmp-p3-color-space-repro
Issue within repo: https://github.com/yulolimum/tmp-p3-color-space-repro/issues/1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 tmp-p3-color-space-repro 仓库开始,并将其 baseline 与 wide-gamut branch 进行比较。运行 iOS 和 Android 的复现步骤,检查 MainActivity 和 DemoActivity 的行为以及引用的 logcat 检查结果,并比较屏幕截图。当 React Native 在受支持的 iOS 和 Android 设备上始终如一地渲染 wide-gamut 图像和颜色时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, ios, react-native
领域
mobile, mobile-dev
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。