ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
- 推荐】使用InteractionManager.runAfterInteractions,在动画或者某些特定场景中利用InteractionManager来选择性的渲染新场景所需的最小限度的内容; 使用场景类似于: ``` class ExpensiveScene extends React.Component { constructor(props, context) { super(props, context); this.state = {renderPlaceholderOnly: true}; } componentDidMount() { InteractionManager.runAfterInteractions(() => { this.setState({renderPlaceholderOnly: false}); }); } render() { if (this.state.renderPlaceholderOnly) { return this.renderPlaceholderView(); } return ( <View> <Text>Your full view goes here</Text> </View> ); } renderPlaceholderView() { return ( <View> <Text>Loading...</Text> </View> ); } }; ``` -【推荐】在使用Touchable系列组件时,进行setState或者大量调帧操作,请使用如下方式: ``` handleOnPress() { this.requestAnimationFrame(() => { //todo }); } ```