beeshell
beeshell copied to clipboard
setState后Modal里展示没有渲染
伪代码 this.state = {createStartDate: '2017-11-11'} render() { return ( <View style={{flex: 1}}> <SlideModal ref={(c) => {this._slideModal = c;}}> <View> <Text style={{fontSize: 14, color: colors.black}}> {this.state.createStartDate}</Text> </View> </SlideModal> </View> ); }
使用SlideModal作了一个 筛选框,里面一些类似input,还有文本 。Moadl展开的情况下setState,没渲染,关闭后重新展开,又渲染了
我也遇到了这个问题,暂时的解决方案是在setState函数中传入一个回调,在回调中调用modal的open方法