Update header btn

This commit is contained in:
Vincent BRIDIER 2022-12-29 19:22:49 +01:00
parent de88957a62
commit 04407b6f65
No known key found for this signature in database
GPG key ID: 8571BFA20420D512

View file

@ -77,7 +77,7 @@ class App extends React.Component {
name="InstallScreen"
component={InstallScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('install.installation')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('install.installation')),
headerRight: () => (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<TouchableOpacity
@ -97,7 +97,7 @@ class App extends React.Component {
name="LoginScreen"
component={LoginScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('global.login')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('global.login')),
headerRight: () => (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<TouchableOpacity
@ -116,7 +116,7 @@ class App extends React.Component {
name="HomeScreen"
component={HomeScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('global.home')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('global.home')),
headerRight: () => (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={{ flexDirection: 'row', marginRight: 50 }}>
@ -171,20 +171,22 @@ class App extends React.Component {
<Stack.Screen
name="SyncScreen"
component={SyncScreen}
options={{
headerTitle: () => this.LogoTitle(i18n.t('global.synchronization'))
}}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(navigation, i18n.t('global.synchronization'))
})}
/>
<Stack.Screen
name="DirectoriesScreen"
component={DirectoriesScreen}
options={{ headerTitle: () => this.LogoTitle(i18n.t('app.folders')) }}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(navigation, i18n.t('app.folders'))
})}
/>
<Stack.Screen
name="OnlyVideosScreen"
component={OnlyVideosScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('global.videos')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('global.videos')),
headerRight: () => (
<View style={{ flexDirection: 'row', marginRight: 5 }}>
<TextInput style={styles.searchInput} placeholder={i18n.t('global.search')} value={this.state.searchTxt} onChangeText={(text) => this.setState({ searchTxt: text })} />
@ -207,7 +209,7 @@ class App extends React.Component {
name="VideoScreen"
component={VideoScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('app.video')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('app.video')),
headerRight: () => this.SendEmail(),
orientation: 'landscape'
})}
@ -216,31 +218,37 @@ class App extends React.Component {
name="PDFScreen"
component={PDFScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle('PDF'),
headerTitle: () => this.LogoTitle(navigation, 'PDF'),
headerRight: () => this.SendEmail()
})}
/>
<Stack.Screen
name="ContactScreen"
component={ContactScreen}
options={{ headerTitle: () => this.LogoTitle(i18n.t('global.contacts')) }}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(navigation, i18n.t('global.contacts'))
})}
initialParams={{ contactAdded: false }}
/>
<Stack.Screen
name="ContactDetailsScreen"
component={ContactDetailsScreen}
options={{ headerTitle: () => this.LogoTitle(i18n.t('app.contact_details')) }}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(navigation, i18n.t('app.contact_details'))
})}
/>
<Stack.Screen
name="SearchScreen"
component={SearchScreen}
options={{ headerTitle: () => this.LogoTitle(i18n.t('app.results_search')) }}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(navigation, i18n.t('app.results_search'))
})}
/>
<Stack.Screen
name="MySpaceScreen"
component={MySpaceScreen}
options={(navigation, route) => ({
headerTitle: () => this.LogoTitle(i18n.t('app.my_space')),
headerTitle: () => this.LogoTitle(navigation, i18n.t('app.my_space')),
headerRight: () => (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<TouchableOpacity
@ -262,13 +270,15 @@ class App extends React.Component {
);
}
LogoTitle(title) {
LogoTitle(navigation, title) {
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Image
style={{ width: 100, height: 50, resizeMode: 'stretch' }}
source={require('./assets/img/logo.png')}
/>
<TouchableOpacity onPress={() => { navigation.navigation.navigate('HomeScreen') }}>
<Image
style={{ width: 100, height: 50, resizeMode: 'stretch' }}
source={require('./assets/img/logo.png')}
/>
</TouchableOpacity>
<Text style={{ marginLeft: 10, fontSize: 18 }}>{title}</Text>
</View>
);