我正在尝试确定应用程序何时恢复。例如,当您打开应用程序时,按设备上的主页按钮,然后返回应用程序。
最佳答案
希望您正在寻找这个。 Documentation Here
getInitialState: function() {
return {
currentAppState: AppStateIOS.currentState,
};
},
componentDidMount: function() {
AppStateIOS.addEventListener('change', this._handleAppStateChange);
},
componentWillUnmount: function() {
AppStateIOS.removeEventListener('change', this._handleAppStateChange);
},
_handleAppStateChange: function(currentAppState) {
this.setState({ currentAppState, });
},
render: function() {
return (
<Text>Current state is: {this.state.currentAppState}</Text>
);
},
关于reactjs - 在 iOS 上的 React Native 中,有没有办法确定应用程序何时恢复?例如 onResume 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33905840/