Skip to content

Linking.openURL within Headless JS task will remount the entire app #21610

Closed
@rcidt

Description

@rcidt

Environment

React Native Environment Info:
   System:
     OS: macOS High Sierra 10.13.6
     CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
     Memory: 38.88 MB / 16.00 GB
     Shell: 5.3 - /bin/zsh
   Binaries:
     Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
     Yarn: 1.3.2 - ~/.nvm/versions/node/v8.9.4/bin/yarn
     npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
     Watchman: 4.9.0 - /usr/local/bin/watchman
   SDKs:
     iOS SDK:
       Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
     Android SDK:
       Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 27.0.2, 27.0.3
       API Levels: 23, 25, 26, 27
   IDEs:
     Android Studio: 3.0 AI-171.4443003
     Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
   npmPackages:
     react: 16.3.1 => 16.3.1
     react-native: 0.57.0 => 0.57.0
   npmGlobalPackages:
     react-native-cli: 2.0.1
     react-native-create-library: 3.1.2
     react-native-rename: 2.2.2
     react-native-version-up: 1.0.8

Description

I am starting a Headless JS task when I receive a push notification when the app is in not in foreground. In my Headless JS task I perform some logic and then I will use Linking.openURL('myapp://myapp') to launch the app.

In cases where the app is running in the background, the Linking.openURL will bring the app to foreground, but it will remount the entire app, as if I was launching it for the first time.

This would be fine, as long as the "old" app to be unmounted, but it's as if the "old" app is also running, so all my event listeners and react lifecycle methods run double. As if I was running two instances of the app simultaneously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugStaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions