ldc-com-app/ComApp/src/App/Views/HomeScreen.js

55 lines
2.3 KiB
JavaScript
Raw Normal View History

2022-09-30 17:40:03 +02:00
import React from 'react';
import { View, ImageBackground, TouchableOpacity, Text, Image } from 'react-native';
// Common Styles
import commonStyles from '../../Resources/CommonStyles';
2022-10-06 17:20:07 +02:00
// Redux
import { connect } from 'react-redux';
2022-09-30 17:40:03 +02:00
// Style
import styles from '../../Resources/Styles/HomeStyle';
// Translations
import i18n from "../../I18n";
// FileSytem
import * as FileSystem from 'expo-file-system';
2022-10-06 17:20:07 +02:00
function mapStateToProps(state) {
return {
directories: state.app.directories,
locale: state.app.locale,
};
}
2022-09-30 17:40:03 +02:00
class HomeScreen extends React.Component {
2022-10-06 17:20:07 +02:00
componentDidMount() {
this.props.dispatch({ type: 'INIT' });
}
2022-09-30 17:40:03 +02:00
render() {
2022-10-06 17:20:07 +02:00
i18n.locale = this.props.locale;
2022-09-30 17:40:03 +02:00
return (
<ImageBackground source={{ uri: FileSystem.documentDirectory + 'BackgroundImage.png' }} style={commonStyles.background}>
<View style={styles.container}>
2022-10-06 17:20:07 +02:00
<TouchableOpacity onPress={() => this.openFolder(2)} style={styles.button}>
2022-09-30 17:40:03 +02:00
<Image source={{ uri: FileSystem.documentDirectory + 'HomeButtonImage.png' }} style={styles.btnImg} />
2022-10-06 16:25:15 +02:00
<Text style={styles.btnTxt}>{i18n.t('global.videos')}</Text>
</TouchableOpacity>
2022-10-07 16:41:43 +02:00
<TouchableOpacity onPress={() => this.props.navigation.navigate('OnlyVideosScreen')} style={styles.button}>
2022-10-06 16:25:15 +02:00
<Image source={{ uri: FileSystem.documentDirectory + 'HomeButtonImage.png' }} style={styles.btnImg} />
2022-09-30 17:40:03 +02:00
<Text style={styles.btnTxt}>{i18n.t('global.videos')}</Text>
</TouchableOpacity>
2022-10-07 16:41:43 +02:00
<TouchableOpacity onPress={() => this.props.navigation.navigate('ContactScreen')} style={styles.button}>
2022-09-30 17:40:03 +02:00
<Image source={{ uri: FileSystem.documentDirectory + 'HomeButtonImage.png' }} style={styles.btnImg} />
<Text style={styles.btnTxt}>{i18n.t('global.contacts')}</Text>
</TouchableOpacity>
</View>
</ImageBackground>
);
}
openFolder(id) {
2022-10-06 17:20:07 +02:00
const folder = this.props.directories.filter(tmp => tmp.id === id);
this.props.navigation.navigate('DirectoriesScreen', { folder: folder });
}
2022-09-30 17:40:03 +02:00
}
2022-10-06 17:20:07 +02:00
export default connect(mapStateToProps)(HomeScreen);