Skip to content

Commit 878e27a

Browse files
chore: Export correct createAnimatedComponent (#8395)
## Summary Up to this PR classic `createAnimatedComponent` could only be "imported" and used by: ```tsx import Animated from 'react-native-reanimated' const Test = Animated.createAnimatedComponent(Text) ``` And when user decided to import `createAnimatedComponent` directly it resulted in importing `createAnimatedComponent` from CSS. It created issues and confusion. We've decided to also export classic `createAnimatedComponent` as a standalone function, so it can be used directly as `createAnimatedComponent(Text)` and also as `Animated.createAnimatedComponent(Text)` This also lead to renaming `createAnimatedComponent` from CSS to `createCSSAnimatedComponent`, for better clearance. ## Test plan
1 parent a1d3bce commit 878e27a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

apps/common-app/src/apps/css/examples/animations/screens/testExamples/Playground.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
import React from 'react';
77
import { Text, View } from 'react-native';
8-
import { createAnimatedComponent, css } from 'react-native-reanimated';
8+
import { createCSSAnimatedComponent, css } from 'react-native-reanimated';
99

1010
import { Screen } from '@/apps/css/components';
1111
import { flex } from '@/theme';
1212

13-
const AnimatedView = createAnimatedComponent(View);
13+
const AnimatedView = createCSSAnimatedComponent(View);
1414

1515
export default function Playground() {
1616
return (

packages/react-native-reanimated/src/css/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
export { createAnimatedComponent } from './component';
2+
export { createAnimatedComponent as createCSSAnimatedComponent } from './component';
33
export { cubicBezier, linear, steps } from './easing';
44
export * from './stylesheet';
55
export type {

packages/react-native-reanimated/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as Animated from './Animated';
1414

1515
export default Animated;
1616

17+
export { createAnimatedComponent } from './Animated';
1718
export type {
1819
DecayAnimation,
1920
DelayAnimation,

0 commit comments

Comments
 (0)