アプリケーションからapi呼び出しを行うたびにprogress/activityindicatorを表示したいが、これに対して正しい解決策を見つけることができない。私はactivityindicatorを表示することができますが、私はそれを隠すことはできません。ここに私のコードです:reactind nativexのアクションからactivityindicatorを表示および非表示にするにはどうすればよいですか?
<Scene key="modal" component={Modal} >
<Scene key="root">
<Scene key='login' component={Login} title='Login Page' hideNavBar={true} />
</Scene>
<Scene key="statusModal" component={StatusModal} />
</Scene>
方法:
StatusModal.js
constructor(props) {
super(props)
// set state with passed in props
this.state = {
message: props.error,
hide: props.hide,
animating: props.animating
}
}
render() {
if(this.state.animating){
return(
<ActivityIndicator
animating={true}
size="small"
/>
)
}else{
return(
<View>
</View>
)
}
}
を、ここで私はアニメーションの状態を変更する方法です
//show activity
Actions.statusModal({animating: true})
//hide activity
Actions.statusModal({animating: false})
、ここでは私のシーン構造でありますアクションインジケータをアクションから隠すことはできますか?
ありがとうございます。これは私にとって完璧な答えであり、大きな説明です。私はreduxサンクbtwを使用しています:) –