Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Expose the reduced-motion preference beside colorScheme

Đang mở
#507 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react-native, typescript
Lĩnh vực
frontend, mobile

Hướng nghiên cứu

Read the reduced-motion implementation proposed in #388 and compare it with the existing colorScheme API and devicePreference() behavior. Check the React Native and web paths, including matchMedia and the jest helper, then determine whether the public setter or a jest-only setter is desired. Done means the API shape and override behavior are agreed before implementation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

#388 makes native evaluate prefers-reduced-motion, reading the device's setting from AccessibilityInfo. A consumer then needs two things:

  • An app with its own "Reduce motion" setting has to override the device's preference, and keep its choice when the device's setting changes.
  • A test suite has to put a test in reduce mode: react-native-css/jest resets the preference before each test, and nothing public sets it.

#388 adds reducedMotion to the API, beside colorScheme:

import { reducedMotion } from "react-native-css";

reducedMotion.get(); // "reduce", "no-preference", or undefined until the device answers
reducedMotion.set("reduce"); // overrides the device, through any change of its setting
reducedMotion.set(null); // follows the device again

The override holds until it is cleared, as Appearance.setColorScheme(), iOS's overrideUserInterfaceStyle and Android's setDefaultNightMode() hold theirs, and as Media Queries 5 §13 shapes the web's navigator.preferences.reducedMotion.requestOverride() and clearOverride(). Internally it is one devicePreference() that keeps the device's answer apart from the app's override, which a later preference the platform reports but does not let an app set, such as contrast or reduced transparency, can share. On main, colorScheme.set() writes a value the next change of the device's scheme replaces; #415 keeps the scheme's override in Appearance, which holds it on the platform itself.

On web the browser evaluates @media in the stylesheet itself, so get() reads matchMedia and set() changes only what get() returns, not the CSS or matchMedia(). navigator.preferences would carry the override into the CSS, but no browser ships it yet (csswg-drafts#14493); once one does, the web set() can call it.

Is this the shape you would want, or would you rather keep the setter in the jest helper only?

Ngôn ngữ chính
TypeScript
Star
166
Fork
45
Merge trung bình
13 ngày 14 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nativewind/react-native-css

Tất cả issue của nativewind/react-native-css

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.