React Native ScrollView TypeError:undefined不是对象(评估'this._subscribableSubscriptions.forEach')

Dmi*_*nko 8 react-native react-native-android expo

我正在使用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
Run Code Online (Sandbox Code Playgroud)

问题出在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,
},
});
Run Code Online (Sandbox Code Playgroud)

Moe*_*Moe 6

此错误是由uglify-es 3.3.X构建发布版本时使用的错误引起的.

将此块添加到package.json:

"resolutions": { "uglify-es": "3.2.2" }

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