【发布时间】:2020-05-19 03:07:32
【问题描述】:
我有一个简单的函数:
render() {
if (this.state.isLoading) {
// this.props.navigation.setParams({
// title: 'Order: Loading'
// });
return(
<View style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
<ActivityIndicator/>
</View>
)
}
}
问题是当我取消注释 this.props.navigation.setParams 时,我收到以下错误:Maximum update depth exceeded。
你知道有什么解决办法吗?
【问题讨论】:
-
在这里您正在设置渲染函数内部的状态由于在函数内部设置状态,您会收到错误最大更新深度超出。
标签: react-native react-navigation jsx react-navigation-stack