Skip to content

Empty set of launch arguments if used in a very early stage (Android) #44

Closed
@d4vidi

Description

@d4vidi

Hi, Detox maintainer here 👋🏻
I've recently been making usage of this library (great job, BTW!) in Detox's self-test project. We see that quite clearly, on Android at least, if the launch arguments are used in a very early stage (e.g. in the app's index.js), then intermittently, an empty arguments object is returned.

For example:

import React, {Component} from 'react';
import {
  AppRegistry,
} from 'react-native';
import { LaunchArguments } from 'react-native-launch-arguments';

console.warn('DEBUG', LaunchArguments.value());

export default class ExampleApp extends Component {
// ...
}

AppRegistry.registerComponent('example', () => ExampleApp);

If the app is repeatedly launched using device.launchApp({ launchArgs: { 'my': 'arg' } }), then you would see logs looking somewhere along the lines of:

DEBUG { my: arg }
DEBUG { my: arg }
DEBUG {}
DEBUG { my: arg }
DEBUG { my: arg }
DEBUG { my: arg }
DEBUG {}

Side note: I suppose there's a race condition here, sorting out the arguments into the NativeModule's constants.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions