Reproduction fork: https://github.com/coolsoftwaretyler/expo-launch-args-issue
Pulled repo, then:
npm install
npx expo prebuild --clean
npx expo run:android
maestro test -e APP_ID=com.brandonshiftbase.expolaunchargsissue .maestro
Got expected reproducing result:
Ok, now I need to find anything that gets launch arguments.
The react-native-launch-arguments package seems to be reading from intent.getExtras();
. Code: https://github.com/iamolegga/react-native-launch-arguments/blob/fbd800cc86a92784e8b4014c3a42aac0caf63870/android/src/main/java/com/reactnativelauncharguments/LaunchArgumentsModule.java#L96
So let’s see if Expo calls that at all. I only see one result in https://github.com/search?q=repo%3Aexpo%2Fexpo intent.getExtras&type=code, https://github.com/expo/expo/blob/6336b0b26dea143b6b413aa879ba19b13226b966/packages/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/ExpoNotificationLifecycleListener.java#L34. That’s for notifications. Doesn’t seem relevant to us.
Ok, but does React Native itself handle this? Nope, doesn’t seem to be: https://github.com/search?q=repo%3Afacebook%2Freact-native+intent.getExtras()&type=code
So who is messing with this call? I need to learn more about how it’s supposed to work.
Hmm, that’s not mch: https://developer.android.com/reference/android/content/Intent#getExtras()
Retrieves a map of extended data from the intent.
I notice that parseADBArgsExtras
shows up in both react-native-launch-args
and that Expo package that calls intent.getExtras
. Perhaps that’s a method on an abstract class I need to learn about.
No, I don’t see any docs. That’s maybe just a convention.
Ok, so I’m going to drop a breakpoint in LaunchArgumentsModule
and run a debug task to poke around in the debugger.
Wait, there’s no getExtras
on the intent. If I evaluate it, it’s null
. But there’s an mExtras
, which reminds me of some React Native naming conventions I’ve seen. Let’s see if we can just change intent.getExtras()
to intent.mExtras
.