Repository navigation
Conversation
`keyframes()` compiles to the keyframes object react-native-reanimated reads, and an element taking an `animation*` or `transition*` prop renders Reanimated's animated component. Reanimated stays out of the dependencies: `codeExtractNative` takes a `reanimated` argument, which the Metro plugin sets from whether the project has it, and without it these are build errors asking to install it. 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 #1048 (base:
feat/react-native-states). PR 9 of the React Native plan: animations and transitions on react-native-reanimated (D6).What it does
As decided in D6, react-native-reanimated (4 or later) runs animations and transitions, but Devup UI does not depend on it. Without it, these are build errors that tell the user to install it.
keyframes()compiles to the keyframes object Reanimated reads (its CSS animations).keyframesimport is removed.animation*ortransition*prop renders Reanimated's animated component.View,TextandImageuseAnimated.View,Animated.TextandAnimated.Image.TextInputandPressablegetAnimated.createAnimatedComponent(...), declared once per file.ThemedandFocusedwrappers ($c={__Animated.View}).as, the component given is kept, so the user can pass any animated component.animationNametakes the valuekeyframes()gives. Durations, delays and iteration counts stay as written:transitionDuration={200}stays200ms instead of becoming800px.transitionandtransitionPropertyname CSS properties, which compile to React Native keys (background-color→backgroundColor). A list of properties becomes an array.transitionBehaviorare checked keywords.styled()andcss():styled()component of a Devup UI component renders the animated component.css()andstyled(Other)pass the styles on. The component given must be animated, such asstyled(Animated.View).withDevupUI()checks whetherreact-native-reanimatedresolves from the project root and passes the result through the transformer settings. That way the setting is also part of Metro's cache key.API change:
codeExtractNative(…, runtime, reanimated)codeExtractNativein WASM and NAPI takes a new boolean,reanimated, afterruntime. Everything that checks the binding ABI is updated for it:libs/binding((runtime, reanimated)), the WASM export and the NAPIextractNative;index.d.cts;reanimated:b);Everything is 0.x and unpublished (D11).
Build errors
keyframesimported, or ananimation*/transition*prop on an element, incss()or instyled(), when the app has no react-native-reanimated. The message says to install react-native-reanimated 4 or later (npx expo install react-native-reanimated) and restart Metro.animation(the shorthand): writeanimationNameand the other longhands.animationName="fade":animationNametakes whatkeyframes()gives.styleobject, and those styles makestylea function. Fix: animate an element inside it.keyframes()not called with one object, a spread in it, a keyframe that is not an object, and a keyframe that differs by theme, breakpoint, state or condition.Expo example and CI
apps/expoaddsreact-native-reanimated~4.7.1andreact-native-worklets0.13.0, the versions Expo SDK 58 bundles. They are only the example's dependencies.keyframes().check-bundle.mjsnow also requires:animationName;transitionProperty: "opacity";expo exportpasses the check (949 modules on iOS).bun.lock: adding the two packages moved the hoisted@babel/generatorto 7.x.@babel/corekeeps its 8.x under itself. No version changes otherwise.feat/react-native-statesis added to thepull_requestbranches of the workflow. It will be removed when this PR is retargeted.Tests
Box,Text,Input,ButtonandImage;as,ThemedandFocusedwrappers;styled()andcss();cargo test --workspacepasses. There are no web snapshot changes.-D warningsandcargo fmtare clean.cargo llvm-covshows every new line covered.bun testfor the Metro plugin passes at 100% (a new test covers detecting Reanimated).test:wasm-abipasses.#411의 일부이며 #1048에 의존합니다 (base:
feat/react-native-states). React Native 계획의 9번째 PR로, react-native-reanimated 기반 애니메이션과 트랜지션(D6)입니다.변경 내용
D6 결정대로 react-native-reanimated(4 이상)가 애니메이션과 트랜지션을 실행하지만, Devup UI는 이 패키지에 의존하지 않습니다. 앱에 Reanimated가 없으면 설치하라는 빌드 에러를 냅니다(위 예시 참고).
keyframes()**는 Reanimated(CSS 애니메이션)가 읽는 keyframes 객체로 컴파일됩니다.keyframesimport는 제거됩니다.animation*이나transition*prop이 하나라도 있는 요소는 Reanimated의 animated 컴포넌트로 렌더링합니다.View·Text·Image는Animated.View·Animated.Text·Animated.Image를 씁니다.TextInput·Pressable은Animated.createAnimatedComponent(...)를 파일마다 한 번 선언해서 씁니다.Themed·Focusedwrapper를 거쳐도 동작합니다($c={__Animated.View}).as를 쓰면 주어진 컴포넌트를 그대로 둡니다. 그래서 사용자가 원하는 animated 컴포넌트를 넘길 수 있습니다.animationName은keyframes()결과를 받습니다. duration·delay·반복 횟수는 쓴 그대로 둡니다. 예를 들어transitionDuration={200}은800px이 아니라 200ms입니다.transition과transitionProperty는 CSS 속성 이름을 React Native 키로 바꿉니다(background-color→backgroundColor). 여러 속성은 배열이 됩니다.transitionBehavior는 키워드인지 검사합니다.styled()와css():styled()한 컴포넌트는 animated 컴포넌트로 렌더링합니다.css()와styled(Other)는 스타일을 그대로 넘깁니다. 주어진 컴포넌트가styled(Animated.View)처럼 animated여야 합니다.withDevupUI()가 프로젝트 루트에서react-native-reanimated가 resolve되는지 확인하고, 그 결과를 transformer 설정으로 넘깁니다. 그래서 이 값도 Metro cache key에 들어갑니다.API 변경:
codeExtractNative(…, runtime, reanimated)WASM·NAPI의
codeExtractNative가runtime뒤에 booleanreanimated를 받습니다. 바인딩 ABI를 검사하는 곳은 모두 함께 갱신했습니다:libs/binding((runtime, reanimated)), WASM export, NAPIextractNative;index.d.cts;reanimated:b);모두 0.x이며 배포되지 않았습니다(D11).
빌드 에러
keyframes를 import하거나, 요소·css()·styled()에서animation*/transition*을 쓴 경우. 메시지는 react-native-reanimated 4 이상을 설치하고(npx expo install react-native-reanimated) Metro를 다시 시작하라고 안내합니다.animation:animationName과 다른 longhand로 쓰세요.animationName="fade":animationName은keyframes()결과를 받습니다.style객체를 애니메이션하는데, 이런 스타일은style을 함수로 만듭니다. 해결: 안쪽 요소를 애니메이션하세요.keyframes(), 그 안의 spread, 객체가 아닌 keyframe, 테마·breakpoint·상태·조건에 따라 달라지는 keyframeExpo 예제와 CI
apps/expo에 Expo SDK 58이 번들하는 버전인react-native-reanimated~4.7.1과react-native-worklets0.13.0을 추가했습니다. 예제의 의존성일 뿐입니다.keyframes()로 fade-in합니다.check-bundle.mjs는 이제 다음도 확인합니다:animationName;transitionProperty: "opacity";expo export가 검사를 통과했습니다(iOS 949 modules).bun.lock: 두 패키지를 추가하면서 hoist된@babel/generator가 7.x로 바뀌었습니다.@babel/core는 자기 아래에 8.x를 유지합니다. 그 밖의 버전 변경은 없습니다.pull_requestbranches에feat/react-native-states를 추가했습니다. 이 PR의 base를 바꿀 때 제거합니다.테스트
Box·Text·Input·Button·Image의 모든 animation·transition prop;as,Themed·Focusedwrapper;styled()와css();cargo test --workspace가 통과합니다. 웹 snapshot 변경은 없습니다.-D warnings와cargo fmt는 깨끗합니다.cargo llvm-cov에서 새로 추가한 줄은 모두 커버됩니다.bun test는 100%로 통과합니다(Reanimated 감지 테스트 추가).test:wasm-abi가 통과합니다.🤖 Generated with Claude Code