46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
/*
|
|
Предрейсовые осмотры - мобильное приложение
|
|
Компонент оверлея загрузки (блокировка экрана)
|
|
*/
|
|
|
|
//---------------------
|
|
//Подключение библиотек
|
|
//---------------------
|
|
|
|
const React = require('react');
|
|
const { Modal, View, ActivityIndicator } = require('react-native');
|
|
const AppText = require('./AppText');
|
|
const styles = require('../../styles/common/LoadingOverlay.styles');
|
|
|
|
//-----------
|
|
//Тело модуля
|
|
//-----------
|
|
|
|
//Компонент оверлея загрузки
|
|
function LoadingOverlay({ visible, message = 'Загрузка...' }) {
|
|
if (!visible) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Modal visible={visible} transparent={true} animationType="fade" statusBarTranslucent={true}>
|
|
<View style={styles.overlay}>
|
|
<View style={styles.container}>
|
|
<ActivityIndicator size="large" color={styles.indicator.color} />
|
|
{message ? (
|
|
<AppText style={styles.message} variant="body">
|
|
{message}
|
|
</AppText>
|
|
) : null}
|
|
</View>
|
|
</View>
|
|
</Modal>
|
|
);
|
|
}
|
|
|
|
//----------------
|
|
//Интерфейс модуля
|
|
//----------------
|
|
|
|
module.exports = LoadingOverlay;
|