const React = require('react'); const { Component } = require('react'); const { View, Text, Button, Platform } = require('react-native'); const Navigation = require('react-native-navigation'); class LifecycleScreen extends Component { constructor(props) { super(props); this.onClickPush = this.onClickPush.bind(this); this.state = { text: 'nothing yet' }; } didAppear() { this.setState({ text: 'didAppear' }); } didDisappear() { if (Platform.OS === 'ios') { alert('didDisappear'); // eslint-disable-line no-alert } else { Navigation.showOverlay('alert', { text: 'didDisappear', positiveButton: { text: 'OK' } }); } } componentWillUnmount() { if (Platform.OS === 'ios') { alert('componentWillUnmount'); // eslint-disable-line no-alert } else { Navigation.showOverlay('alert', { text: 'componentWillUnmount', positiveButton: { text: 'OK' } }); } } onNavigationButtonPressed(id) { alert(`onNavigationButtonPressed: ${id}`); // eslint-disable-line no-alert } render() { return ( {`Lifecycle Screen`} {this.state.text}