小编skl*_*est的帖子

React Native AsyncStorage在渲染后获取数据

我正在使用AsyncStoragein ComponentWillMount来获取本地存储accessToken,但它在render()函数运行后返回promise .如何render()在承诺完成之前等待?谢谢.

react-native

34
推荐指数
2
解决办法
2万
查看次数

状态更改后,React Native ListView行不会重新呈现

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

10
推荐指数
2
解决办法
1万
查看次数

使用Navigator透明地反映Native Modal而不使用Modal

React Native文档说RN应该使用Navigator来创建模态(https://facebook.github.io/react-native/docs/modal.html#content).

如何在不使用Modal的情况下使用Navigator创建透明模式?我希望用户在后台查看当前页面.谢谢.

react-native

6
推荐指数
1
解决办法
3168
查看次数

React Native如何检测链接形式字符串并将其转换为链接?

我希望用户能够从评论(字符串)中获取链接,类似于linkify。有没有简单的方法可以做到这一点?我相信可以在这里解决(https://github.com/facebook/react-native/issues/3148),但是我不太确定如何实现它。谢谢。

react-native

3
推荐指数
3
解决办法
6529
查看次数

标签 统计

react-native ×4