chore: add support for react-native@0.87.0-rc.1#4375
Conversation
| style={[ | ||
| style, | ||
| // The cast is needed because `exactOptionalPropertyTypes` forbids an explicit `undefined` on `zIndex` | ||
| // after enabling strict types in RN 0.87 where it is typed as `zIndex?: number`. | ||
| { zIndex: undefined } as { | ||
| zIndex?: number | undefined; | ||
| } as ViewStyle, | ||
| ]} |
There was a problem hiding this comment.
note: workaround, because undefined was removed from public type for zIndex
| export interface TextInputFocusEventData extends TargetedEvent { | ||
| eventCount: number; | ||
| text: string; | ||
| } |
There was a problem hiding this comment.
for further discussion: I haven't found an equivalent in strict types on 0.87, I decided to copy the type from the core to avoid breaking changes in public API
There was a problem hiding this comment.
Pull request overview
This PR updates react-native-screens to build and type-check against react-native@0.87.0-rc.1, including related dependency/tooling bumps and several type-level adjustments required by upstream React Native and Android Gradle Plugin changes.
Changes:
- Update JS/TS types and component implementations to align with RN 0.87 type exports and stricter TS settings (e.g.,
ViewInstance, removed RN exports,exactOptionalPropertyTypes). - Adjust Android Gradle integration for AGP 9 built-in Kotlin behavior and update example Android tooling (Gradle, SDK, Kotlin).
- Initialize default Fabric
_propsin several iOS component views to match RN 0.87 expectations.
Reviewed changes
Copilot reviewed 28 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch TS module resolution to bundler and adjust path mappings for the library. |
| src/types.tsx | Update public types for RN 0.87 (e.g., ViewInstance) and add local TextInputFocusEventData compatibility type. |
| src/private/hooks/useRenderDebugInfo.tsx | Replace removed/renamed RN types (ReactNativeElement → HostInstance). |
| src/gesture-handler/fabricUtils.ts | Update ref/instance typing to RN 0.87’s ViewInstance. |
| src/fabric/SearchBarNativeComponent.ts | Update native commands typing to newer React ref helper types. |
| src/components/tabs/host/TabsHost.android.tsx | Avoid passing { direction: undefined } in styles under stricter typing. |
| src/components/SearchBar.tsx | Refactor SearchBar ref/commands wiring to match RN 0.87 typing changes. |
| src/components/ScreenStackItem.tsx | Update forwarded ref typing and tighten optional style handling. |
| src/components/ScreenStackHeaderConfig.tsx | Adjust non-iOS alignItems to explicit Yoga default (stretch). |
| src/components/Screen.web.tsx | Attempt to pass ref through to inner web <View/>. |
| src/components/Screen.tsx | Update ref typing and add cast workaround for zIndex: undefined under exactOptionalPropertyTypes. |
| src/components/gamma/stack/host/StackHost.types.ts | Update host ref type from ReactNativeElement to HostInstance. |
| src/components/gamma/stack/host/StackHost.tsx | Normalize ref passed to native component (undefined → null). |
| src/components/gamma/stack/header/ios/StackHeaderItem.ios.tsx | Guard Image.resolveAssetSource returning falsy. |
| package.json | Bump RN toolchain/dev deps to 0.87.0-rc.1 and TypeScript to ^6.0.3. |
| ios/tabs/bottom-accessory/RNSTabsBottomAccessoryContentComponentView.mm | Set default Fabric _props in initializer. |
| ios/tabs/bottom-accessory/RNSTabsBottomAccessoryComponentView.mm | Set default Fabric _props in initializer. |
| ios/RNSScreenFooter.mm | Set default Fabric _props in initializer. |
| ios/RNSScreenContentWrapper.mm | Add initWithFrame to set default Fabric _props. |
| ios/gamma/stack/host/RNSStackHostComponentView.mm | Set default Fabric _props in initializer. |
| ios/gamma/modals/form-sheet/RNSFormSheetContentWrapperComponentView.mm | Add initWithFrame to set default Fabric _props. |
| FabricExample/yarn.lock | Update example lockfile for RN 0.87 toolchain and dependency graph changes. |
| FabricExample/tsconfig.json | Update example TS types list. |
| FabricExample/package.json | Bump example app RN + toolchain deps to 0.87.0-rc.1 and TS ^6.0.3. |
| FabricExample/ios/Podfile.lock | Update CocoaPods lockfile for RN 0.87.0-rc.1 pods/layout. |
| FabricExample/android/gradlew | Update gradlew template link reference. |
| FabricExample/android/gradle/wrapper/gradle-wrapper.properties | Bump Gradle distribution to 9.4.1. |
| FabricExample/android/gradle.properties | Add AGP 9 opt-outs for built-in Kotlin and new DSL. |
| FabricExample/android/build.gradle | Bump compile/build tools and Kotlin versions. |
| FabricExample/android/app/build.gradle | Switch to proguard-android-optimize.txt. |
| android/build.gradle | Conditionally apply Kotlin plugin based on AGP 9 built-in Kotlin; add kotlin source dir configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function SearchBar(props: SearchBarProps) { | ||
| const searchBarRef = React.useRef<SearchBarHostInstance | null>(null); | ||
|
|
||
| function SearchBar( | ||
| props: SearchBarProps, | ||
| forwardedRef: React.Ref<SearchBarCommands>, | ||
| ) { | ||
| const searchBarRef = React.useRef<SearchBarCommands>(null); | ||
|
|
||
| React.useImperativeHandle(forwardedRef, () => ({ | ||
| React.useImperativeHandle(props.ref, () => ({ | ||
| blur: () => { |
| } | ||
|
|
||
| export default React.forwardRef<SearchBarCommands, SearchBarProps>(SearchBar); | ||
| export default SearchBar; |
| let { | ||
| active, | ||
| activityState, | ||
| style, | ||
| enabled = screensEnabled(), | ||
| ref, | ||
| ...rest | ||
| } = this.props; | ||
|
|
||
| const refProp = ref !== undefined ? { ref } : {}; | ||
|
|
| "baseUrl": ".", | ||
| "types": ["jest", "node"], | ||
| "types": ["node"], | ||
| "paths": { |
Description
Based on the upgrade helper: https://react-native-community.github.io/upgrade-helper/?from=0.86.0&to=0.87.0-rc.1
Note: waiting for react/react-native#57628
description in progress.
Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1666
Changes
Before & after - visual documentation
N/A
Test plan
in progress
Checklist