Skip to content

feat: [React Compiler] Allow to customise reanimated library import name#82

Closed
everettbu wants to merge 1 commit into
mainfrom
feat/retyui/custom-reanimated-name
Closed

feat: [React Compiler] Allow to customise reanimated library import name#82
everettbu wants to merge 1 commit into
mainfrom
feat/retyui/custom-reanimated-name

Conversation

@everettbu

@everettbu everettbu commented Dec 12, 2025

Copy link
Copy Markdown

Mirror of facebook/react#32568
Original author: retyui


Summary

In our code I use a custom wrapper around react-native-reanimated to be able to turn off animation on low-end devises

import { useSharedValue, useAnimatedStyle } from 'my-reanimated';

const useFadeAnimationDefault123456789 = () => {
  'use memo';
  const sv = useSharedValue(0);
  return useAnimatedStyle(() => ({
    opacity: sv.value,
  }));
};

so when reanimated hooks will be imported from a non react-native-reanimated module
the compiler will apply own optimisations and a reanimated babel plugin won't transforms code correctly

How did you test this change?

locally

@greptile-apps

greptile-apps Bot commented Dec 12, 2025

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

Extends React Compiler's reanimated support to work with custom wrapper libraries around react-native-reanimated. Users can now specify custom import names via the reanimatedImportNames config option.

  • Added optional reanimatedImportNames config field (array of strings) to specify custom module names
  • Modified module type registration to iterate over all configured import names
  • Defaults to ['react-native-reanimated'] when not specified, maintaining backward compatibility
  • Properly applies reanimated-specific type definitions to all registered module names

This change is straightforward and well-implemented. The use case is clear: developers who wrap reanimated to conditionally disable animations on low-end devices can now use the React Compiler with their custom wrapper.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, well-scoped, and maintains backward compatibility through proper defaults. The implementation correctly uses .optional() for the new config field and provides sensible fallback behavior with the nullish coalescing operator.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts 5/5 Added reanimatedImportNames config option to support custom wrapper libraries around react-native-reanimated, with proper fallback to default module name

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@everettbu everettbu added Resolution: Stale Automatically closed due to inactivity and removed Resolution: Stale Automatically closed due to inactivity labels Jan 11, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions Bot added the Resolution: Stale Automatically closed due to inactivity label Apr 11, 2026
@github-actions

Copy link
Copy Markdown

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@github-actions github-actions Bot closed this Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants