0

我是新来的反应本地人。我正在尝试显示加载程序,直到从服务器获得响应。当加载程序显示我想锁定屏幕时,意味着用户无法滚动或无法执行任何操作。这是加载器代码

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>

请帮忙谢谢。通过添加此代码。我无法在中心显示该加载程序,当我向下滚动时,此加载程序上升且无法显示。

4

1 回答 1

0
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>
}
于 2021-04-06T12:54:11.817 回答