Repository navigation
Conversation
`_active` and its React Native name `_pressed` make the element a
`Pressable` whose `style` is a function of whether it is pressed:
`({ pressed }) => [styles.a, pressed && styles.b]`. A `Box`, `Flex`,
`Center` or `VStack` with a press style becomes a `Pressable`; a `Button`
already is one. Press styles combine with responsive values, themes,
platforms, orientations and conditions, and need no runtime, so they work
with `runtime: false` too. On a `Text`, an `Image` or an `Input`, and with
`as`, they are build errors.
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:
|
…r styles
On the web, `_themeDark`, `_landscape` and `_active` win over the element's
other styles whatever the order of the props, as their selectors and media
queries do. On React Native they followed the order of the props, so
`<Box _active={{ bg: 'red' }} bg="blue" />` (the order ESLint sorts props
in) never turned red, and a later `bg` dropped a `_themeDark` one. The
styles of these blocks now come after the element's other styles, at every
level of nesting. Platform blocks keep the order of the props.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 21, 2026
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 #1044 (base:
feat/react-native-responsive). PR 5 of the React Native plan: press styles (R3).What it does
_active, the web's name, and_pressed, React Native's name, apply their styles while the element is pressed. React Native tells only aPressablewhether it is pressed, through a function for itsstyle. So, as the owner decided, the element becomes aPressableonly when it uses a press style:Box,Flex,CenterorVStackwith a press style renders React Native'sPressableand keeps its other props, such asonPress. Without a press style, it is still aView. An empty_active={{}}does not change the element.Buttonis already aPressable, so only itsstylebecomes a function._themeDark={{ _pressed: {...} }}), platform and orientation blocks, conditions and runtime values. Thestyleprop the element is given is still merged last.Themed:$s={(__t) => ({ pressed: __p }) => ...}.Pressablegivespresseditself, so press styles also compile withruntime: false, and the runtime does not grow.Fix: blocks apply after the other styles
On the web,
_themeDark,_landscapeand_activewin over the element's other styles whatever the order of the props, because their selectors and media queries do. On React Native they followed the order of the props. So<Box _active={{ bg: 'red' }} bg="blue" />, which is the order ESLint sorts props in, never turned red, and a laterbgdropped a_themeDarkone (#1042, #1044). The styles of these blocks now come after the element's other styles at every level of nesting, which changes three earlier snapshots. Platform blocks (_ios/_android/_web) keep the order of the props.Build errors
Text, anImageor anInput, which are notPressable: "a press style needs React Native'sPressable, and the element renders React Native'sText. Fix: wrap it in aBoxor aButtonwith_pressed".as, whose component cannot also be aPressable._hover,_focusand the other interaction states are still build errors.Expo example and CI
apps/exponow take_activestyles.check-bundle.mjsrequires the bundle to hold the pressed color and astyle:({pressed:function.feat/react-native-responsiveis added to thepull_requestbranches of the workflow. It will be removed when this PR is retargeted.Tests
Buttonand onBox/Flex, with themes, breakpoints, conditions and a givenstyle;_themeDark;__p,__Pressable);runtime: false;cargo test --workspacepasses. There are no web snapshot changes.-D warningsandcargo fmtare clean.expo exportfor iOS and Android passescheck-bundle.mjs.#411의 일부이며 #1044에 의존합니다 (base:
feat/react-native-responsive). React Native 계획의 5번째 PR인 press 스타일(R3)입니다.변경 내용
_active(웹 이름)와_pressed(React Native 이름)는 요소가 눌려 있는 동안 스타일을 적용합니다. React Native에서 눌림 여부를 아는 것은Pressable뿐이고,Pressable은style함수로 그 값을 넘깁니다. 그래서 owner 결정대로 press 스타일을 쓸 때만 요소가Pressable이 됩니다(위 예시 참고).Box,Flex,Center,VStack은 React Native의Pressable로 렌더링되고,onPress같은 다른 prop은 그대로 유지합니다. press 스타일이 없으면 그대로View입니다. 빈_active={{}}는 요소를 바꾸지 않습니다.Button은 이미Pressable이므로style만 함수가 됩니다._themeDark={{ _pressed: {...} }}), 플랫폼·방향 블록, 조건식, 런타임 값과 모두 함께 동작합니다. 요소에 준styleprop은 여전히 마지막에 병합됩니다.Themed로 렌더링합니다.pressed는Pressable이 직접 주므로runtime: false에서도 컴파일되고, 런타임 크기도 늘지 않습니다.수정: 블록은 다른 스타일보다 나중에 적용
웹에서
_themeDark,_landscape,_active는 selector와 media query 덕분에 prop 순서와 관계없이 요소의 다른 스타일을 이깁니다. React Native에서는 prop 순서를 따랐습니다. 그래서 ESLint가 정렬하는 순서인<Box _active={{ bg: 'red' }} bg="blue" />는 눌러도 빨간색이 되지 않았고, 뒤에 오는bg가_themeDark의 값을 지웠습니다(#1042, #1044). 이제 이 블록의 스타일은 모든 중첩 단계에서 요소의 다른 스타일 뒤에 오며, 그래서 이전 snapshot 세 개가 바뀌었습니다. 플랫폼 블록(_ios/_android/_web)은 prop 순서를 유지합니다.빌드 에러
Pressable이 아닌Text,Image,Input에 쓴 경우 ("Box나Button으로 감싸세요" 안내)as와 함께 쓴 경우.as가 주는 컴포넌트는Pressable이 될 수 없습니다._hover,_focus등 나머지 상호작용 상태는 여전히 빌드 에러입니다.Expo 예제와 CI
apps/expo의 버튼 두 개에_active스타일을 추가했습니다.check-bundle.mjs는 번들에 눌린 상태의 색과style:({pressed:함수가 있는지 확인합니다.pull_requestbranches에feat/react-native-responsive를 추가했습니다. 이 PR의 base를 바꿀 때 제거합니다.테스트
Button과Box/Flex의 press 스타일(테마, breakpoint, 조건식, 요소에 준style포함);_themeDark안의 press 스타일;__p,__Pressable);runtime: false;cargo test --workspace가 통과합니다. 웹 snapshot 변경은 없습니다.-D warnings와cargo fmt는 깨끗합니다.expo export가check-bundle.mjs를 통과했습니다.🤖 Generated with Claude Code