Skip to content

fix(Example): Upgrade kotlin to 2.3.* - #4536

Open
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/bump-kotlin-to-2.3-FabricExample
Open

fix(Example): Upgrade kotlin to 2.3.*#4536
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/bump-kotlin-to-2.3-FabricExample

Conversation

@t0maboro

@t0maboro t0maboro commented Aug 21, 2026

Copy link
Copy Markdown
Member

Description

For RCA, please see: #4443 . We've internally discussed with @kkafar that the Kotlin upgrade should be safe because of their backward compatibility policy. This still diverges app from the RN template, but seems to be slightly better approach than applying the workaround with resolve RNS sources to its realpath.

Please note that bumping the kotlinVersion alone does nothing. The versionless KGP classpath entry resolves to the version pinned by @react-native/gradle-plugin that pins Kotlin 2.2.0, so the module kept compiling with Kotlin 2.2.* After pinning KGP explicitly, the resolved compiler is 2.3.*.

Changes

  • upgrade Kotlin to 2.3, remove stale workaround

Before & after - visual documentation

N/A

Test plan

How to reproduce the issue:

  1. Downgrade kotlin to 2.2
  2. Build FabricExample
  3. Make any edit in ScreenStackHeaderConfig.onUpdate
  4. Build FabricExample again - the incremental compilation fails witj
e: file:///Users/tomaszboron/react-native-screens/FabricExample/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/legacy/ScreenStackHeaderConfig.kt:35:71 Cannot access 'class PointerEventsBoxNoneImpl : ReactPointerEventsView': it is internal in file.
e: file:///Users/tomaszboron/react-native-screens/FabricExample/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/legacy/ScreenStackHeaderConfig.kt:264:32 Cannot access 'fun trySetWindowTraits(screen: Screen, activity: Activity?, context: ReactContext?): Unit': it is internal in 'com/swmansion/rnscreens/legacy/ScreenWindowTraits'.
e: file:///Users/tomaszboron/react-native-screens/FabricExample/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/legacy/ScreenStackHeaderConfig.kt:361:75 Cannot access 'var isHiddenBySearchBar: Boolean': it is internal in 'com/swmansion/rnscreens/legacy/ScreenStackHeaderSubview'.
e: file:///Users/tomaszboron/react-native-screens/FabricExample/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/legacy/ScreenStackHeaderConfig.kt:362:22 Cannot access 'fun setHiddenBySearchBar(hidden: Boolean): Unit': it is internal in 'com/swmansion/rnscreens/legacy/ScreenStackHeaderSubview'.

This should NOT happen after changing the Kotlin version to 2.3

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

@t0maboro t0maboro added the action:backport-to-v4 Add this label to any issue or PR that should be backported to the v4 line of the library. label Aug 21, 2026

@kligarski kligarski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested reproduction using this PR - build passed correctly after changes to onUpdate.

Comment on lines +28 to +29
// Pin KGP explicitly, because the version-less classpath entry resolves to the
// version pinned by RN's gradle-plugin.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should add information that this pin can be removed when RN bumps Kotlin, similar to previous // TODO: Can be removed when RN ships Kotlin >= 2.3.0 which resolved the issue.. When somebody sees this randomly in a year or so it will have a higher chance of being cleaned up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 here

@kkafar kkafar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a single request for a comment documenting when that code can be cleaned up again.

Thanks.

Comment on lines +28 to +29
// Pin KGP explicitly, because the version-less classpath entry resolves to the
// version pinned by RN's gradle-plugin.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 here

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

Labels

action:backport-to-v4 Add this label to any issue or PR that should be backported to the v4 line of the library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants