我正在使用Expo构建React Native应用程序.它通过Expo应用程序在我的
Android设备上运行良好.但是我通过exp build:android命令构建了apk后出现错误.
原文链接:https://www.f2er.com/react/301117.htmlTypeError: 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,},});