New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-launch-arguments

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-launch-arguments

React Native module for getting launch arguments

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126K
decreased by-11.67%
Maintainers
0
Weekly downloads
 
Created
Source

react-native-launch-arguments

React Native module to get launch arguments.

Makes passing parameters from testing libraries and debugs tools to react-native super easy.

Install

npm i react-native-launch-arguments
cd ios && pod install && cd ..

Usage

In you code

Javascript
import { LaunchArguments } from "react-native-launch-arguments";
LaunchArguments.value();
Typescript
import { LaunchArguments } from "react-native-launch-arguments";
interface MyExpectedArgs {
  authToken?: string;
  skipAuth?: boolean;
}
LaunchArguments.value<MyExpectedArgs>();

Integrating with End-to-end testing tools and debuggers

The intended use is with end-to-end tools like Detox.

Detox
Appium
Maestro
XCode
  • XCode Launch Args
  • In XCode add launch arguments on the "Arguments" tab in the "Run" section of the Scheme editor:
    • Product -> Scheme -> Edit Scheme... -> Run -> Arguments tab -> Arguments Passed On Launch
    • Set each arg witha preceding -.
    • For example if you want to set arg hello to "world" to receive a LaunchArgs instance of{ "hello":"world" }, you would enter the following into the entry space for the arg:
    -hello "world"
    

Platform-specific Notes

iOS

It takes data from [[NSProcessInfo processInfo] arguments]

Verifying install on iPhone simulator

You can use xcrun to boot your app on the simulator.

The following command-line will load your app on the booted iOS simulator. Just replace com.MyAppBundleId with your Bundle Identifier, and the params with your params.

xcrun simctl launch booted com.MyAppBundleId -noParams -param "hello"

Android

It takes data from currentActivity.getIntent().getBundleExtra("launchArgs") for detox and intent.getExtras() for ADB params

Caveats on Android
React-Native

Due to React Native issue #37518, on Android, the module force-waits for the Android activity to reach the RESUMED state, before moving foward with native-modules initialization completion. While commonly the wait is scarce (the activity is already in the resumed state at this point), until the RN issue is fixed, the module may introduce delays in app loading time in some edge cases.

Expo

There is know expo bug with empty passed arguments.

Keywords

FAQs

Package last updated on 22 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc