Skip to content

Commit e0784fe

Browse files
committed
lightbox header/footer: Put content in safe areas.
Including left and right safe areas, for landscape mode. Fixes: #4267
1 parent 0559074 commit e0784fe

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

src/lightbox/LightboxFooter.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import React, { PureComponent } from 'react';
33
import { Text, View } from 'react-native';
44
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
5+
import { SafeAreaView } from 'react-native-safe-area-context';
56

67
import { Icon } from '../common/Icons';
78
import { createStyleSheet } from '../styles';
@@ -36,10 +37,12 @@ export default class LightboxFooter extends PureComponent<Props> {
3637
render() {
3738
const { displayMessage, onOptionsPress, style } = this.props;
3839
return (
39-
<View style={[styles.wrapper, style]}>
40-
<Text style={styles.text}>{displayMessage}</Text>
41-
<Icon style={styles.icon} color="white" name="more-vertical" onPress={onOptionsPress} />
42-
</View>
40+
<SafeAreaView mode="padding" edges={['right', 'bottom', 'left']}>
41+
<View style={[styles.wrapper, style]}>
42+
<Text style={styles.text}>{displayMessage}</Text>
43+
<Icon style={styles.icon} color="white" name="more-vertical" onPress={onOptionsPress} />
44+
</View>
45+
</SafeAreaView>
4346
);
4447
}
4548
}

src/lightbox/LightboxHeader.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow strict-local */
22
import React, { PureComponent } from 'react';
33
import { View, Text } from 'react-native';
4+
import { SafeAreaView } from 'react-native-safe-area-context';
45

56
import { shortTime, humanDate } from '../utils/date';
67
import { createStyleSheet } from '../styles';
@@ -63,20 +64,22 @@ export default class LightboxHeader extends PureComponent<Props> {
6364
const subheader = `${displayDate} at ${time}`;
6465

6566
return (
66-
<View style={styles.wrapper}>
67-
<UserAvatarWithPresence size={36} avatarUrl={avatarUrl} email={senderEmail} />
68-
<View style={styles.text}>
69-
<Text style={styles.name} numberOfLines={1}>
70-
{senderName}
71-
</Text>
72-
<Text style={styles.subheader} numberOfLines={1}>
73-
{subheader}
74-
</Text>
67+
<SafeAreaView mode="padding" edges={['top', 'right', 'left']}>
68+
<View style={styles.wrapper}>
69+
<UserAvatarWithPresence size={36} avatarUrl={avatarUrl} email={senderEmail} />
70+
<View style={styles.text}>
71+
<Text style={styles.name} numberOfLines={1}>
72+
{senderName}
73+
</Text>
74+
<Text style={styles.subheader} numberOfLines={1}>
75+
{subheader}
76+
</Text>
77+
</View>
78+
<Touchable onPress={onPressBack}>
79+
<Icon style={styles.rightIcon} color="white" name="x" />
80+
</Touchable>
7581
</View>
76-
<Touchable onPress={onPressBack}>
77-
<Icon style={styles.rightIcon} color="white" name="x" />
78-
</Touchable>
79-
</View>
82+
</SafeAreaView>
8083
);
8184
}
8285
}

0 commit comments

Comments
 (0)