나는 Expo를 사용하여 React Native 앱을 구축하고 있습니다. 그것은 엑스포 응용 프로그램을 통해 내 안드로이드 장치에서 잘 작동합니다. 하지만 exp 빌드를 통해 apk를 빌드 한 후에 오류가 발생했습니다. android 명령.React Native ScrollView TypeError : 정의되지 않은 객체 ('this._subscribableSubscriptions.forEach'평가 중)
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를 제거하면 사라집니다. 다음은 제 코드입니다. renderCurrencies()
보십시오이로 변경 :
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,
},
});
나는이 해결책을 github에서 보았지만 어떻게 든 도움이되지 않았습니다. 삭제해야 할 캐시가 있습니까? –
프로젝트 node_modules \ uglify-es \ package.json을 확인하고 해당 버전을 확인하십시오. 여전히 3.3.X 버전이라면 uglify-es 폴더를 삭제하고'yarn'을 다시 실행할 수 있습니다. 그런 다음 XDE에서 Help-> Clear XDE Cache를 클릭하면 –
이 작동합니다. 감사합니다. –