-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(android): add JSPointerDispatcherCompat for RN < 0.72 #681
Conversation
thank you @gronxb for a contribution 🙌 Let me approve and run e2e tests to see if they pass or not 👀 |
📊 Package size report
|
I think running e2e tests should be enough. I'm testing there that |
@kirillzyusko Since ktlint was failing, I executed ktlint. |
@gronxb |
...d/src/main/java/com/reactnativekeyboardcontroller/views/overlay/JSPointerDispatcherCompat.kt
Outdated
Show resolved
Hide resolved
...d/src/main/java/com/reactnativekeyboardcontroller/views/overlay/JSPointerDispatcherCompat.kt
Outdated
Show resolved
Hide resolved
...d/src/main/java/com/reactnativekeyboardcontroller/views/overlay/JSPointerDispatcherCompat.kt
Show resolved
Hide resolved
...d/src/main/java/com/reactnativekeyboardcontroller/views/overlay/JSPointerDispatcherCompat.kt
Show resolved
Hide resolved
## 📜 Description In #681 we started to use reflection for detection the amount of params. But reflection is a slow mechanism, so in this PR I'm optimizing lookup stage by calculating a correct method only one time. ## 💡 Motivation and Context Lookup can be up to 10-100 times slower comparing to the direct function call. If we call this method too frequently, we can encounter a bottleneck. To make this code faster I decided to cache the method (thus we do a lookup only one time). This approach should almost neglect performance impact for a lookup stage. The call stage (method invocation) still will add an overhead, but it should have a small impact. ## 📢 Changelog ### Android - cache method (make it lazy calculated); - move constants to companion object. ## 🤔 How Has This Been Tested? Tested on CI. ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
📜 Description
To add a compatibility layer for
JSPointerDispatcher
, ensure that the method functions correctly regardless of whether it is called with two or three parameters.💡 Motivation and Context
Related:
facebook/react-native@1e53f88#diff-e874545c1f508ac02d63d67356fe0519f6c0dd5f380afeb900cf1de4fce6835aL202-R203
With the change, the number of parameters has increased from two to three. Since React Native 0.71.14 only uses two parameters, this causes a build error on Android.
📢 Changelog
Android
JSPointerDispatcherCompat
class🤔 How Has This Been Tested?
📸 Screenshots (if appropriate):
📝 Checklist