Repository navigation
Conversation
`vw`, `vh`, `vmin` and `vmax` (with their small, large and dynamic forms) compile to one multiplication of the window's width or height, which new runtime hooks give. Only components using a viewport length render again on a resize, and elements outside a function component render through the new `Sized` wrapper. `_motionReduce` and `_motionSafe` apply by the system's reduced-motion setting, which the runtime reads from AccessibilityInfo and follows. With `runtime: false`, both are build errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ibilityInfo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #411, depends on #1053 (base:
feat/react-native-docs). PR 14 of the React Native plan: these are the follow-ups from design §8 step 9,vw/vhand_motionReduce, which the owner asked for. Tailwind stays out of scope (D7).Viewport lengths
vw,vh,vminandvmaxcompile to one multiplication of the window's size. Thes/l/dforms (svh,dvh, ...) andvi/vbmeasure the same window, because an app window has no browser bar that comes and goes.useSyncExternalStore, so React renders a component again only when that value changes. A resize renders again only components that use a viewport length. A component reading only the breakpoint still renders again only when the window crosses a breakpoint, and the runtime tests check this. With this change, the old "layout number" bookkeeping is no longer needed.StyleSheet.create. Only the viewport length becomes the multiplication, and it applies from its breakpoint in a responsive array.css()(in a component) andstyled();w,p,m,lineHeight, ...); on any other prop, the text passes through as before.Sizedwrapper, which also reads the size.Themeddoes not read the size, so wrapped elements without viewport lengths still ignore resizes.Inputwith_focusoutside a function component that also uses a viewport length (Focuseddoes not read the size);keyframes();runtime: false.Reduced motion
_motionReduceapplies while the system asks apps to reduce motion, and_motionSafeapplies while it does not, mirroring the web'sprefers-reduced-motionshorthands.AccessibilityInfo.isReduceMotionEnabled()and then followsreduceMotionChanged.useReducedMotion.Themed,SizedandFocusedalso give the style this value, after the orientation.runtime: false, both blocks are build errors.Runtime size
Docs and example
/docs/react-nativetable, the Units row is updated, a_motionReduce/_motionSaferow is added, and the runtime size is updated.minH="30vh"and a label has_motionReduce;check-bundle.mjsrequiresuseReducedMotionanduseWindowHeightfromApp.tsx, and ignores node_modules sources, because Reanimated has its ownuseReducedMotion;check-web.mjschecks that the card'smin-heightis 30% of the Chromium window.Tests
SizedandThemed);css()andstyled();runtime: false;cargo test --workspacepasses, and clippy (pedantic) and fmt are clean. Local llvm-cov shows no new uncovered line.Readsis now a 6-flag array indexed by aReadenum. The runtime'sThemed/Sizedimports share oneImportstruct.useReducedMotion;Sized.feat/react-native-docsis added to thepull_requestbranches of the workflow.#411의 일부이며 #1053에 의존합니다 (base:
feat/react-native-docs). React Native 계획의 14번째 PR로, owner가 요청한 설계 §8 9단계 후속 작업인vw/vh와_motionReduce입니다. Tailwind는 계속 범위 밖입니다(D7).Viewport 길이
vw·vh·vmin·vmax는 창 크기에 곱셈 한 번을 하는 코드로 컴파일됩니다. 앱 창에는 나타났다 사라지는 브라우저 바가 없으므로,s/l/d형태(svh,dvh등)와vi/vb도 같은 창을 잽니다(위 예시 참고).useSyncExternalStore로 자기 값만 읽으므로, React는 그 값이 바뀐 컴포넌트만 다시 렌더링합니다. resize하면 viewport 길이를 쓰는 컴포넌트만 다시 렌더링합니다. breakpoint만 읽는 컴포넌트는 여전히 breakpoint를 넘을 때만 다시 렌더링하며, 런타임 테스트가 이를 확인합니다. 이 변경으로 기존의 "layout 숫자" 관리는 필요 없어졌습니다.StyleSheet.create에 hoist됩니다. viewport 길이만 곱셈이 되며, 반응형 배열에서는 그 breakpoint부터 적용됩니다.css(),styled();w·p·m·lineHeight등)에서만 적용되며, 다른 prop에서는 텍스트가 이전처럼 그대로 전달됩니다.Sizedwrapper로 렌더링됩니다.Themed는 크기를 읽지 않으므로, viewport 길이가 없는 wrapper 요소는 여전히 resize를 무시합니다._focus가 있으면서 viewport 길이도 쓰는Input(Focused는 크기를 읽지 않음);keyframes()안;runtime: false.Reduced motion
_motionReduce는 시스템이 앱에 모션을 줄이라고 요청하는 동안,_motionSafe는 그렇지 않은 동안 적용됩니다. 웹의prefers-reduced-motion단축 prop과 같습니다.AccessibilityInfo.isReduceMotionEnabled()로 설정을 한 번 읽고, 이후reduceMotionChanged를 따릅니다.useReducedMotion.Themed·Sized·Focused도 orientation 다음 인자로 이 값을 스타일에 넘깁니다.runtime: false에서는 두 블록 모두 빌드 에러입니다.런타임 크기
문서와 예제
/docs/react-native표에서 단위 행을 갱신하고,_motionReduce/_motionSafe행을 추가하고, 런타임 크기를 갱신했습니다.minH="30vh"를, 라벨에_motionReduce를 추가했습니다;check-bundle.mjs는App.tsx가useReducedMotion·useWindowHeight를 쓰는지 확인합니다. Reanimated에도 자체useReducedMotion이 있으므로 node_modules 소스는 제외합니다;check-web.mjs는 카드의min-height가 Chromium 창 높이의 30%인지 확인합니다.테스트
Sized와Themed);css()와styled();runtime: false;cargo test --workspace가 통과하고, clippy(pedantic)와 fmt는 깨끗합니다. 로컬 llvm-cov에서 새로 커버되지 않은 줄은 없습니다.Reads는 이제Readenum으로 인덱싱하는 6개 flag 배열입니다. 런타임의Themed/Sizedimport는Import구조체 하나를 같이 씁니다.useReducedMotion;Sized.pull_requestbranches에feat/react-native-docs를 추가했습니다.🤖 Generated with Claude Code