Создайте новый класс, hudView.js
и повторно используйте его для всего экрана загрузки,
import React, { Component } from "react";
import { View, ActivityIndicator } from "react-native";
export default class hudView extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View
style={{
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
alignItems: "center",
justifyContent: "center",
backgroundColor: "rgba(110,110,110,0.5)"
}}
>
<View
style={{
width: 100,
height: 100,
backgroundColor: "transparent", //"rgba(255,255,255,1)",
alignItems: "center",
justifyContent: "center",
borderRadius: 5,
overflow: "hidden"
}}
>
<ActivityIndicator size="large" color="red" />
</View>
</View>
);
}
}
И используйте его в своем классе,
Например:
...
import HudView from "../../components/hudView";
...
render() {
return(
...
...
{this.state.isLoading ? <HudView ref={"hudView"} /> : null}
)
}