React Native boolean launch arguments
Is there an existing issue for this?
- [X] I have searched the existing issues and didn't find mine.
Steps to reproduce
Create a test file with a boolean launch argument:
appId: com.myapp.development
---
- launchApp:
appId: com.flyzipline.partner.portalapp.development
arguments:
isFoo: true
- assertTrue: true
In my app code, I use react-native-launch-arguments to get the value, something like:
LaunchArguments.value().isFoo === true
Actual results
The argument seems to be undefined in my app code.
Expected results
I expect the argument to be true.
About app
React Native Expo app, testing on iOS Simulator. React native version 0.74.3, react-native-launch-arguments version 4.0.2, expo 51.0.22.
About environment
- I'm on a MacBook Pro running Sonoma 14.6.1.
Logs
Logs
<!-- Replace this line with your logs. *DO NOT* remove the backticks! -->
Maestro version
1.37.9
How did you install Maestro?
Homebrew
Anything else?
This may just be a documentation bug. I am able to get this working by providing the argument as a string. When I do that it is available to my app as a boolean which is great. But the docs indicate that it can be set as a boolean in the yaml file which doesn't seem to be the case, at least not for React Native.
@christinachimi were you able to fix this?
@3KINGZ providing the argument as a string works, so it's "fixed" in that sense, but I still think either the docs or the actual functionality is wrong.
I am seeing this issue, but I am also seeing an issue where on Android, my launch args are empty altogether. LaunchArguments.value() just returns an empty object.
@christinachimi thanks that works
I am seeing this issue, but I am also seeing an issue where on Android, my launch args are empty altogether.
LaunchArguments.value()just returns an empty object.
@kanzelm3 are you getting even after passing the arguments as a string type?
I tested on Android with a the following:
appId: ${APP_ID}
---
- launchApp:
arguments:
isE2E: true
coolThing: 'Launch app with E2E flag'
And using the following in my app:
import { LaunchArguments } from 'react-native-launch-arguments';
console.log('Launch Args:', LaunchArguments.value());
on Android I see this
Just a heads up, if you are using Typescript you can do something like
type MyLaunchArgs ={
myArg:boolean
}
LaunchArguments.value<MyLaunchArgs>().myArg
Typescript will do the cast for you
Hey @christinachimi The fix is here -> https://github.com/iamolegga/react-native-launch-arguments/pull/83
Fixed upstream in react-native-launch-arguments
This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!