Skip to content

fix: replace deep RN imports with public API - #744

Open
leotm wants to merge 1 commit into
appandflow:mainfrom
leotm:replace-deep-rn-imports-with-public-api
Open

fix: replace deep RN imports with public API#744
leotm wants to merge 1 commit into
appandflow:mainfrom
leotm:replace-deep-rn-imports-with-public-api

Conversation

@leotm

@leotm leotm commented Jul 21, 2026

Copy link
Copy Markdown

@leotm
leotm marked this pull request as ready for review July 21, 2026 16:22
@leotm leotm changed the title fix: replace deep RN imports with public API for tsgo compatibility fix: replace deep RN imports with public API Jul 21, 2026

@leotm leotm left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

didn't commit the import updates 🤦‍♂️

leotm added a commit to leotm/react-native-safe-area-context that referenced this pull request Jul 28, 2026
- replace imports from RN internal paths (react-native/Libraries/Types/CodegenTypes,
react-native/Libraries/Utilities/codegenNativeComponent) with public API exports
-  fix  implicit any type in SafeAreaContext cb param and avoid
InstanceType on codegen component by using Component<Props> directly
@leotm
leotm force-pushed the replace-deep-rn-imports-with-public-api branch from 43b2f7d to 9879709 Compare July 28, 2026 15:12

@leotm leotm left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

- replace imports from RN internal paths (react-native/Libraries/Types/CodegenTypes,
react-native/Libraries/Utilities/codegenNativeComponent) with public API exports
-  fix  implicit any type in SafeAreaContext cb param and avoid
InstanceType on codegen component by using Component<Props> directly
@leotm
leotm force-pushed the replace-deep-rn-imports-with-public-api branch from 9879709 to 6612ea2 Compare July 28, 2026 16:41

@huntie huntie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @leotm!

Endorsed

However, this is a breaking change as it'll require RN >= 0.82, which introduces CodegenTypes. cc @janicduplessis

Image

(Note: not 0.80, it needs slightly revised types from >= 0.82.)

  "peerDependencies": {
    "react": "*",
-   "react-native": "*"
+   "react-native": ">=0.82.0"
  },

Non-breaking fix: #745

Fundamentally this issue should only be happening when this repository upgrades react-native for its typechecking, however the root issue is that the jest/mock subpath breaks encapsulation. I've opened this separate PR which can be landed as a non-breaking change fix for the user side.

(In contrast, this PR fixes the library's own codebase.)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RN 0.88] Replace deep RN imports with public API react-native-safe-area-context types incompat with 0.88.0-nightly

2 participants