Skip to content

fix(android): use composition for JSPointerDispatcherCompat#1477

Merged
kirillzyusko merged 1 commit into
kirillzyusko:mainfrom
cortinico:nc/do-not-subclass-JSPointerDispatcherCompat
Jun 1, 2026
Merged

fix(android): use composition for JSPointerDispatcherCompat#1477
kirillzyusko merged 1 commit into
kirillzyusko:mainfrom
cortinico:nc/do-not-subclass-JSPointerDispatcherCompat

Conversation

@cortinico

Copy link
Copy Markdown
Contributor

📜 Description

JSPointerDispatcher became a final Kotlin class in React Native 0.87+
(after the Java-to-Kotlin migration in react/react-native#56910), so
JSPointerDispatcherCompat can no longer extend it.

While I'm restoring it in:

Ideally we would want to reduce the API surface of RN apis.

So here I'm switching from inheritance to composition by holding an internal
JSPointerDispatcher delegate and forwarding calls to it.

🤔 How Has This Been Tested?

Looking for guidance on how to test this.

📸 Screenshots (if appropriate):

N/A

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

JSPointerDispatcher became a final Kotlin class in React Native 0.87+
(after the Java-to-Kotlin migration in #56910), so
JSPointerDispatcherCompat can no longer extend it.

Switch from inheritance to composition by holding an internal
JSPointerDispatcher delegate and forwarding calls to it.
@kirillzyusko kirillzyusko self-requested a review June 1, 2026 13:15
@kirillzyusko kirillzyusko self-assigned this Jun 1, 2026
@kirillzyusko kirillzyusko added 🤖 android Android specific build error ❌ Anything that triggers build errors and prevent this library from being used labels Jun 1, 2026
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
317920 bytes 317801 bytes 119 bytes 📈


/**
* Compat layer for `JSPointerDispatcher` interface for RN < 0.72
* Compat layer for `JSPointerDispatcher` interface for RN < 0.72.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kirillzyusko also this is quote of an old version of RN. Perhaps the compat layer can go altogether?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yes @cortinico

I will do it this year. I'm going to drop old architecture support and bump minimal RN version to RN 0.77 or something like this 🤞

I know that RN has window support for only 3 versions, but I believe I don't have so much conditional code to support more RN versions, so I'm fine to leave with few additional if-statements 🙂

@kirillzyusko

Copy link
Copy Markdown
Owner

Thank you @cortinico for your PR! I'll prepare next patch release right now 👍

@kirillzyusko kirillzyusko merged commit 46f27fc into kirillzyusko:main Jun 1, 2026
17 checks passed
@kirillzyusko

Copy link
Copy Markdown
Owner

@cortinico new 1.21.9 version has been published on npm!

@cortinico

Copy link
Copy Markdown
Contributor Author

Thank you very much @kirillzyusko 🙏

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

Labels

🤖 android Android specific build error ❌ Anything that triggers build errors and prevent this library from being used

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants