-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(android): app crash at boot with old arch #4022
fix(android): app crash at boot with old arch #4022
Conversation
…oplayerView code size
…ideo # Conflicts: # android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java # src/Video.tsx
…fix/avoidVideoResizingFlickering # Conflicts: # .github/ISSUE_TEMPLATE/bug-report.yml
* fix: ensure player doesn't start when view is unmounted
@YangJonghun @KrzysztofMoch please handle this small pr in priority, it is blocking a lot of users I think 🙏maybe @yungblud have an idea on this PR also ! |
put(eventType.eventName, MapBuilder.of("registrationName", eventType.eventName)) | ||
put("top${eventType.eventName.removePrefix("on")}", MapBuilder.of("registrationName", eventType.eventName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can go with this if
put(eventType.eventName, MapBuilder.of("registrationName", eventType.eventName)) | |
put("top${eventType.eventName.removePrefix("on")}", MapBuilder.of("registrationName", eventType.eventName)) | |
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) | |
put("top${eventType.eventName.removePrefix("on")}", mapOf("registrationName" to eventType.eventName)) | |
else | |
put(eventType.eventName, MapBuilder.of("registrationName", eventType.eventName)) |
If this change fix the issue I am fine to merge this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your suggestion, but it is a bit more complicated :)
We need to use the isNewArchEnabled from Application, then we need context to retrieve it. but yes this is what I had in mind !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is loaded from Application you can see in build.gradle
def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}
we are getting this property from rootProject
(app) so this should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late response.
AFAIK, contional code is not required because if "top" is not a prefix, React Native change it internally.
(onEvent → topOnEvent)
FYI)
Also this code should be change for event work properly.
nit; facebook MapBuilder is meaningless it just hashMap wrapper. we can replace it with just use mapOf
put(eventType.eventName, mapOf("registrationName" to eventType.eventName))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, regarding to the code you are pointing, the override fun getEventName() = "top${event.eventName.removePrefix("on")}"
vs override fun getEventName() = "${event.eventName}"
should depend on newArch ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@freeboub
No. That part needs to be handled so that it syncs with value returned by ReactExoplayerViewManager.getExportedCustomDirectEventTypeConstants
. This is architecture independent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it yet, but it seems like a simple solution would be to remove all the parts that add the top prefix.
I couldn't understand why this issue was relative with Kotlin event changes. |
In fact the real issue is before "cannot find RCTVideo": |
code updated! mapOf was also problematic, I replaced it by : hashMapOf. |
@freeboub Root cause is React Native's I don't think #4005 is related to this issue. I can't reproduce with bare RN project |
@YangJonghun That you for the detailed feedback! Then I put only the necessary fix in place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you guys for this fast fix 🎉 I will make release after weekend with this fix. I will also do improvements to catch issues like this earlier
LGTM ✅
@freeboub @YangJonghun can we merge this? |
Yes, we are good ! Let's merge ! Thank you all for the reviews! |
I will do release later today 🙌 |
Hello, |
I am just making release 🙂 |
thank you, I appreciate your efforts |
@WaheedRumaneh Done |
@KrzysztofMoch I have the same problem and that is after release. How do I solve it? Android Expo |
I'm also having this problem, even after the latest release. Since I'm new to this library, I tried with the code provided in the docs and it gives me the same error message. I'm also on Expo |
Same problem with the new release. |
Can you please provide more information ? I cannot confirm this is the same issue ... |
Summary
Fix app boot due to bad events registered
Motivation
Fix: #4017
Changes
Register also old events
@YangJonghun You introduce the regression with this commit: 3c9b1b5
please correct me if I am wrong but It think the first version I added is only for old arch, and the second for new arch ? maybe we need to add a condition on that to avoid registering too much events.
Test plan
can be tested with the sample provided in the ticket