Skip to content

Strict API: type component refs with React.ComponentRef #101816

Closed

Description

@roryabraham

Part of #101439.

Do not enable customConditions here. React.ComponentRef<typeof X> typechecks on the current config and under the Strict API, so this does not have to wait for the opt-in.

Incompatibility

Core components are typed as function components under the Strict API, so useRef<TextInput> refers to the component function and instance methods like .focus() are missing. Animated.LegacyRef<View>, NativeMethods, and NativeMethodsMixin are removed.

The *Instance types (TextInputInstance, ViewInstance, …) are the 0.87+ spelling. They are not exported on 0.86, so they cannot be used yet.

Known call sites, re-check after the ThemeStyles fix since several ref errors in the opt-in log were that cascade:

  • src/components/EmojiPicker/EmojiPickerMenuItem/index.native.tsx — .focus() missing
  • src/components/AnimatedSubmitButton/index.tsx — View | null ref assigned to an Animated.View
  • src/components/AvatarCropModal/ImageCropView.tsx — same
  • src/components/ActionSheetAwareScrollView/useActionSheetAwareScrollViewRef.ts — reanimated ref against PublicScrollViewInstance
  • src/components/Charts/components/ChartTooltip.tsx

Fix

Replace every component name used as an instance type with React.ComponentRef<typeof Component>: useRef / createRef type arguments, forwardRef type arguments, and ref props on wrappers.

Animated.LegacyRef<View> → the same ComponentRef form. NativeMethods / NativeMethodsMixin → HostInstance, or the specific ComponentRef.

Activity

  1. self-assigned this
    on Sep 21, 2026
  2. roryabraham commented on Sep 22, 2026

    @roryabraham
    ContributorAuthor

    optimistically closing this as no payments are due and it's unlikely the types-only PR will be reverted

  3. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @roryabraham

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.92-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions