Skip to content

Migrate Fabric spec imports to the public React Native API #3074

Open

Description

@pandurirobotii

Description

react-native-svg@15.15.5 uses private React Native imports in its Fabric specifications and generated declarations. The current upstream specifications still contain these imports.

React Native introduced its Strict TypeScript API in 0.80 and enabled it by default in 0.87. Under this API, private deep-import paths are not available for TypeScript resolution. React Native documents public package-root exports for Codegen types and helpers as the supported replacements.

Affected imports

For example, src/fabric/CircleNativeComponent.ts contains:

import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type {
  DirectEventHandler,
  Float,
  Int32,
  WithDefault,
} from 'react-native/Libraries/Types/CodegenTypes';

Other Fabric specifications use the same private Codegen imports, including additional types such as Double. Published declarations also reference private Codegen types and codegenNativeComponent's NativeComponentType.

Steps to reproduce

  1. Clone the minimal reproduction repository linked below.
  2. Run yarn install.
  3. Run yarn typecheck.
  4. Observe TypeScript error TS7016 for react-native/Libraries/Types/CodegenTypes in src/CircleNativeComponent.ts. The fixture extracts the private-import pattern from the upstream CircleNativeComponent.ts; skipLibCheck remains enabled.
  5. Run yarn typecheck:fixed. The equivalent fixture using public React Native exports passes.

Snack or a link to a repository

Minimal reproduction repository

SVG version

15.15.5

React Native version

0.87.1

Platforms

Android, iOS, macOS, Web. This is a TypeScript resolution issue; no device or native build is required.

Suggested change

Use public package-root exports:

import type { CodegenTypes } from 'react-native';
import { codegenNativeComponent } from 'react-native';

Update annotations to the corresponding CodegenTypes.* members, preserving existing native signatures and defaults. Replace private NativeComponentType references in the generated declarations with the appropriate public component type.

Please cover all affected Fabric specifications and their shared types, then regenerate the published TypeScript declarations and runtime build artifacts. Account for the library's supported React Native versions when deciding whether a minimum-version change is needed.

Scope and compatibility

  • Scope: TypeScript/Codegen import compatibility, not a rendering or platform-specific runtime failure.
  • skipLibCheck can suppress errors in dependency declarations, but does not migrate the imports or suppress errors when raw TypeScript specifications are included in a consumer's compilation.
  • The reproduction typechecks a source fixture using the same private-import pattern as the upstream Fabric specification; it is not a native app or device-level repro.

Related issues

Issue #2829 reported failure to resolve react-native-svg itself and was closed after the reporter identified a lockfile/resolutions problem. This request concerns private imports from React Native inside SVG's specifications, rather than resolution of the SVG package.

References:

Acknowledgements

Searched open and closed issues and pull requests for matching import-migration reports before filing.


AI disclosure: GitHub Copilot assisted with researching and drafting this issue

Activity

  1. added
    Missing infoThe user didn't precise the problem enough
    Missing reproThis issue need minimum repro scenario
    and removed
    Missing infoThe user didn't precise the problem enough
    Missing reproThis issue need minimum repro scenario
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions