Skip to content

Export Animated components as named exports - #59221

Open
zoontek wants to merge 1 commit into
react:mainfrom
zoontek:animated-component-named-exports
Open

zoontek wants to merge 1 commit into
react:mainfrom
zoontek:animated-component-named-exports

Conversation

@zoontek

@zoontek zoontek commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary:

Animated is one default object that holds FlatList, Image, ScrollView, SectionList, Text and View. Web bundlers can't tree-shake unused properties of an object. So any use of Animated, even only new Animated.Value(0), ships all 6 components. That includes FlatList and SectionList which are heavy and often unused on web.

For metrics, I built a simple app that used only new Animated.Value(0), with react-native-web 0.21.4 (minified, production):

  • as is: 211.2 KB (65.0 KB gzip)
  • without the 6 components on the object: 105.6 KB (32.2 KB gzip)

This PR adds AnimatedView, AnimatedText, AnimatedImage, AnimatedScrollView, AnimatedFlatList and AnimatedSectionList as named exports from react-native. It also deprecates Animated.View, Animated.Text, etc., with JSDoc only (no runtime warning), so they can be removed in a later major.

react-native-web follows the RN API, and it can drop the components from Animated once they are removed here.

On native nothing changes in practice, because Metro already bundles all components.

Changelog:

[GENERAL] [ADDED] - Add AnimatedView, AnimatedText, AnimatedImage, AnimatedScrollView, AnimatedFlatList and AnimatedSectionList named exports
[GENERAL] [DEPRECATED] - Deprecate Animated.View, Animated.Text, Animated.Image, Animated.ScrollView, Animated.FlatList and Animated.SectionList

Test Plan:

  • yarn build-types: pass
  • yarn test-generated-typescript and yarn test-typescript-legacy: pass
  • npx flow-bin@0.336.0 full-check: pass
  • yarn test packages/react-native/Libraries/Animated: pass
  • eslint --max-warnings 0 on changed files and yarn format-check-javascript: pass

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 20, 2026
@facebook-github-tools facebook-github-tools Bot added p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant