加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react-native – React Native ScrollView TypeError:undefined

发布时间:2020-12-15 20:50:43 所属栏目:百科 来源:网络整理
导读:我正在使用Expo构建React Native应用程序.它通过Expo应用程序在我的 Android设备上运行良好.但是我通过exp build:android命令构建了apk后出现错误. TypeError: undefined is not an object (evaluating 'this._subscribableSubscriptions.forEach') This er
我正在使用Expo构建React Native应用程序.它通过Expo应用程序在我的 Android设备上运行良好.但是我通过exp build:android命令构建了apk后出现错误.
TypeError: undefined is not an object (evaluating 'this._subscribableSubscriptions.forEach')                                                  
This error is located at:
  in ScrollView
  in RCTView
  in r
  in Connect(r)
  in n
  in t
  in r
  in RCTView
  in RCTView
  in t

问题出在ScrollView中.如果我删除ScrollView,它就消失了.这是我的代码片段.

class Main extends Component {
state = {
    refreshing: false
};

renderCurrencies() {
    if (!Object.values(this.props.currencies).length) {
        return <View />;
    }

    return Object.values(this.props.currencies).map(item => {
        return (
            <CurrencyRow
                key={item.code}
                code={item.code}
                title={item.title}
            />
        );
    });
}

onRefresh = () => {
    Object.values(this.props.currencies).map(item => {
        this.props.sellBuyFetch(item.code);
    });
};

render() {
    return (
        <View style={styles.container}>
            <ScrollView
                refreshControl={
                    <RefreshControl
                        refreshing={this.state.refreshing}
                        onRefresh={this.onRefresh}
                    />
                }
            >
                {this.renderCurrencies()}
            </ScrollView>
        </View>
    );
}
}

const styles = StyleSheet.create({
container: {
    flex: 1,marginTop: 40,},});
此错误是由构建发布版本时使用的uglify-es 3.3.X引起的.

将此块添加到package.json:

“决议”:{
“uglify-es”:“3.2.2”
}

我尝试在Expo上发布并构建一个独立的应用程序,它现在就像一个魅力.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读