React Native reload page

后端 未结 4 2075
情深已故
情深已故 2020-12-31 11:05

So I have an app with an activity. The app checks for Internet connection at the beginning. If there are no Internet connection, it will show a screen with a button to refre

4条回答
  •  我在风中等你
    2020-12-31 11:36

    class MyScreen extends Component {
        constructor(props) {
            super(props)
            this.state = {
                lastRefresh: Date(Date.now()).toString(),
            }
            this.refreshScreen = this.refreshScreen.bind(this)
        }
    
        refreshScreen() {
            this.setState({ lastRefresh: Date(Date.now()).toString() })
        }
    
        render() {
            return (
                
                    My Screen
                    Last Refresh: {this.state.lastRefresh}
                    

提交回复
热议问题