💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
- 推荐】使用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 }); } ```