4.0.2 • Published 7 months ago

react-native-launch-arguments v4.0.2

Weekly downloads
450
License
MIT
Repository
github
Last release
7 months ago

react-native-launch-arguments

React Native module to get launch arguments. Make passing parameters from testing tool to react native super easy.

Mostly it's made for using:

iOS: it takes data from [[NSProcessInfo processInfo] arguments]

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

Getting started

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

Usage

In JS:

import { LaunchArguments } from "react-native-launch-arguments";
LaunchArguments.value();

In TS:

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

Caveats

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.

Verifying install

To launch the app with arguments, verifying your install, you can:

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"
4.0.2

7 months ago

4.0.0-rc.1

11 months ago

4.0.0-rc.0

11 months ago

4.0.1

10 months ago

4.0.0

11 months ago

4.0.0-alpha.0

11 months ago

3.1.3

1 year ago

3.1.4

1 year ago

3.1.2

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago