Fix gallery screen controls invisible in light mode

This commit is contained in:
Arnaud Vergnet 2020-10-05 19:49:36 +02:00
parent 5d692c6840
commit 6e7b3d02cd

View file

@ -22,7 +22,7 @@ import {IconButton, Text} from 'react-native-paper';
import ImageViewer from 'react-native-image-zoom-viewer'; import ImageViewer from 'react-native-image-zoom-viewer';
import {StackNavigationProp, StackScreenProps} from '@react-navigation/stack'; import {StackNavigationProp, StackScreenProps} from '@react-navigation/stack';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import {View} from 'react-native'; import {StyleSheet, View} from 'react-native';
import {MainStackParamsList} from '../../navigation/MainNavigator'; import {MainStackParamsList} from '../../navigation/MainNavigator';
type ImageGalleryScreenNavigationProp = StackScreenProps< type ImageGalleryScreenNavigationProp = StackScreenProps<
@ -34,6 +34,34 @@ type Props = ImageGalleryScreenNavigationProp & {
navigation: StackNavigationProp<any>; navigation: StackNavigationProp<any>;
}; };
const styles = StyleSheet.create({
closeButtonContainer: {
position: 'absolute',
top: 10,
left: 10,
zIndex: 1000,
},
closeButtonIcon: {
backgroundColor: 'rgba(0,0,0,0.6)',
},
indicatorContainer: {
width: '100%',
height: 50,
position: 'absolute',
},
indicatorText: {
marginLeft: 'auto',
marginRight: 'auto',
marginTop: 'auto',
marginBottom: 'auto',
fontSize: 15,
backgroundColor: 'rgba(0,0,0,0.6)',
color: 'white',
padding: 10,
borderRadius: 20,
},
});
class ImageGalleryScreen extends React.Component<Props> { class ImageGalleryScreen extends React.Component<Props> {
images: Array<{url: string}>; images: Array<{url: string}>;
@ -65,17 +93,13 @@ class ImageGalleryScreen extends React.Component<Props> {
<Animatable.View <Animatable.View
ref={this.closeButtonRef} ref={this.closeButtonRef}
useNativeDriver useNativeDriver
style={{ style={styles.closeButtonContainer}>
position: 'absolute',
top: 10,
left: 10,
zIndex: 1000,
}}>
<IconButton <IconButton
onPress={this.goBack} onPress={this.goBack}
icon="close" icon="close"
size={30} size={30}
style={{backgroundColor: 'rgba(0,0,0,0.6)'}} color={'white'}
style={styles.closeButtonIcon}
/> />
</Animatable.View> </Animatable.View>
); );
@ -87,22 +111,8 @@ class ImageGalleryScreen extends React.Component<Props> {
<Animatable.View <Animatable.View
ref={this.indicatorRef} ref={this.indicatorRef}
useNativeDriver useNativeDriver
style={{ style={styles.indicatorContainer}>
width: '100%', <Text style={styles.indicatorText}>
height: 50,
position: 'absolute',
}}>
<Text
style={{
marginLeft: 'auto',
marginRight: 'auto',
marginTop: 'auto',
marginBottom: 'auto',
fontSize: 15,
backgroundColor: 'rgba(0,0,0,0.6)',
padding: 10,
borderRadius: 20,
}}>
{currentIndex}/{allSize} {currentIndex}/{allSize}
</Text> </Text>
</Animatable.View> </Animatable.View>