简体   繁体   中英

how to set loader in center of the screen and lock screen till getting response. in react native

I am new to react native. I am trying to show loader till getting response from server. and when loader is showing I want to lock screen means user unable to scroll or unable to do anything. here is loader code

import {ActivityIndicator} from 'react-native

 isLoading: true,

 <ScrollView style={{ flex: 1, height: Dimensions.get('window').height / 1.1,}}>

  <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
        {this.state.isLoading && <ActivityIndicator  size="large" color={"orange"} />}
      </View>

</ScrollView>

please help thanks. By adding this code. I am not able show that loader on center and when I scroll down then This loader goes up and not showable.

import {ActivityIndicator} from 'react-native

 if(isLoading){
     <View style={{ flex: 1, justifyContent: "center", alignItems: "center" 
      }}>
        <ActivityIndicator  size="large" color={"orange"} />
     </View>
}
else {
    <ScrollView style={{ flex: 1, height: Dimensions.get('window').height / 1.1,}}>

   /* your rest code * /

  </ScrollView>
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM