我正在使用AsyncStoragein ComponentWillMount来获取本地存储accessToken,但它在render()函数运行后返回promise .如何render()在承诺完成之前等待?谢谢.
React Native ListView:数据源状态更改后,行不会重新呈现.
这是我的代码的简化版本:
render(): {
return <ListView
dataSource={this.state.DS}
renderRow={this.renderRow}/>
}
renderRow(item): {
return <TouchableOpacity onPress={() => this.handlePress(item)}>
{this.renderButton(item.prop1)}
</TouchableOpacity>
}
renderButton(prop1): {
if (prop1 == true) {
return <Text> Active </Text>
} else {
return <Text> Inactive </Text>
}
}
handlePress(item): {
**Change the prop1 of *item* in an array (clone of dataSource), then**
this.setState({
DS: this.state.DS.cloneWithRows(arrayFromAbove)
})
}
Run Code Online (Sandbox Code Playgroud)
根据Facebook的例子,ListView应该在每次更改数据源时重新呈现.是因为我只是在更改数据源中项目的属性吗?似乎renderRow函数没有重新渲染,但render()函数是从数据源更改.
谢谢.
React Native文档说RN应该使用Navigator来创建模态(https://facebook.github.io/react-native/docs/modal.html#content).
如何在不使用Modal的情况下使用Navigator创建透明模式?我希望用户在后台查看当前页面.谢谢.
我希望用户能够从评论(字符串)中获取链接,类似于linkify。有没有简单的方法可以做到这一点?我相信可以在这里解决(https://github.com/facebook/react-native/issues/3148),但是我不太确定如何实现它。谢谢。
react-native ×4