Skip to content

Failing to close down app correctly in multiple scenarios on iOS #26457

Closed
@eventengineering

Description

@eventengineering

The function for detecting when a component will be unmounted seems to never be fired on the root component, or a navigation component.

My root component has a very simple componentWillUnmount with just a console log line, and a similar one exists inside the navigation route open at the time. As it stands, neither of these are called in debug when the app reloads the JS from the bundler, when the app is closed from Xcode, nor when the app is closed within iOS

React Native version:

 React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
      Memory: 1.21 GB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
      npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    IDEs:
      Xcode: /undefined - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3
      react-native: 0.57.8 => 0.57.8
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native: 0.59.5

Steps To Reproduce

  1. Run the following App.js on an iOS device from Xcode
  2. Enable auto-refresh
  3. Add a new line somewhere in the App.js
  4. Notice no unmounting log line
  5. Close the app
  6. Notice no unmounting log line
import React, {Component} from 'react';
import {AppState, View} from 'react-native';

//return navigator
export default class App extends Component {
	componentDidMount() {
		console.debug('!!! App Mounted');
	}

	componentWillUnmount () {
		console.debug('!!! App Unmounting');
	}

	_handleAppStateChange(nextAppState) {
		console.debug('!!! App state', nextAppState);
	}
	
	render() {
		console.debug('!!! App Rendering');
		AppState.addEventListener('change', this._handleAppStateChange);
		return <View></View>;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: iOSiOS applications.Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions