【问题标题】:Does react native refesh control work on android?反应本机刷新控制是否适用于android?
【发布时间】:2017-11-07 12:00:43
【问题描述】:

我在 IOS 上有 React Native Refresh 控件。

https://facebook.github.io/react-native/docs/refreshcontrol.html

我在 android sim 上运行它,但它不起作用。

错误表示未处理的 Promise Rejection。

这是文件的修剪版本,因此您可以看到设置:

import React, { Component } from 'react';
import {
  RefreshControl,
} from 'react-native';

export default class Products extends Component {
  _onRefresh() {
    this.setState({refreshing: true});
    this.likedProducts()
  }

  render() {
    return (
      <View style={styles.container}>
        <ScrollView
          contentContainerStyle={styles.scrollContent}
          showsHorizontalScrollIndicator={false}
          showsVerticalScrollIndicator={false}
          refreshControl={
            <RefreshControl
              refreshing={this.state.refreshing}
              onRefresh={this._onRefresh.bind(this)}
            />
          }
        >
        ...
        </ScrollView>
      </View>
    }
  }
}

【问题讨论】:

    标签: android facebook react-native react-native-android


    【解决方案1】:

    我不知道是否支持在 Android 上使用带有 RefreshControl 的 ScrollView。我建议改用https://facebook.github.io/react-native/docs/flatlist.html。在那里,您可以在 Android 和 iOS 上本地集成下拉刷新。

    【讨论】:

      【解决方案2】:

      我可以确认它确实适用于 android 和 ios。我收到的错误来自其他地方。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-06-14
        • 2011-03-17
        • 2021-01-20
        • 2018-10-03
        • 1970-01-01
        • 2018-09-08
        • 2013-08-03
        相关资源
        最近更新 更多