标签: react-native-listview

在 RN ScrollView 中动态设置 scrollEnabled 为 False

scrollEnabled当滚动到达某个位置时,如何更改React Native ScrollView param的 bool 值?

我确实在 ScrollView 中有一个 ScrollView,由于外部 ScrollView,内部 ScrollView 没有响应。当scrollEnabled参数设置为False外部 ScrollView时,内部 ScrollView 起作用。我的想法是将外部 ScrollView 动态设置为scrollEnabled={false}到达底部时。我该怎么做呢。

谢谢,

react-native react-native-listview react-native-scrollview react-native-android

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

反应本机slice()函数未定义错误

我想更新我的列表视图行,因为我正尝试对列表视图数据源进行切片,但其引发以下错误:

this.state.dataSource.slice不是函数。(在“ this.state.dataSource.slice()”中,“ this.state.dataSource.slice”未定义)

这是我的代码:

let newArray = this.state.dataSource.slice();
newArray[indexToUpdate] = {
  //Here I am updating my values.
};
this.setState({
  dataSource: this.state.dataSource.cloneWithRows(newArray),
});
Run Code Online (Sandbox Code Playgroud)

让我知道代码中是否有错误或做错了什么。

react-native react-native-listview react-native-ios

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

如何根据纬度和经度获得两个位置之间的距离?

我正在尝试根据用户到每个位置的距离显示一个列表。这些位置以 JSON 的形式从 Firebase 接收。

要获取用户位置,我正在使用:

    navigator.geolocation.getCurrentPosition(function(position) {
        var latitude = position.coords.latitude;
        var longitude = position.coords.longitude;
Run Code Online (Sandbox Code Playgroud)

你知道一种按距离对这个 JSON 进行排序并列出它(有多个子节点)的方法吗?

谢谢。

javascript sorting json react-native react-native-listview

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

React Native:当props更改时更新ListView行

我有一个带有renderRow()函数的ListView组件.我的自定义ListBountiesView组件呈现ListView行也会调用一个prop,cr并根据值显示每行中的一些内容cr.

问题是,当this.props.customerRelationship更改其值时,ListView行不会更新.

我这样做: this.props.customerRelationship.points += responseJson.points;

我想这ListView只会在data属性发生变化时更新,但是如何将props移动到我的renderRow组件中以便它们也更新ListView?

SuperScreen.js

renderRow(bounty) {
  const { customerRelationship } = this.props;
  return (
    <ListBountiesView
      key={bounty.id}
      bounty={bounty}
      cr={customerRelationship}
      onPress={this.openDetailsScreen}
    />
  );
}

render() {
    const { bounties } = this.props;

    return (
      <ListView
          data={bounties}
          renderRow={this.renderRow}
          loading={loading}
      />
    )
Run Code Online (Sandbox Code Playgroud)

react-native react-native-listview shoutem

0
推荐指数
1
解决办法
2403
查看次数