Skip to content

Commit 1d50173

Browse files
chrisbobbegnprice
authored andcommitted
Lightbox: Stop passing new style prop to header/footer Views on each render
1 parent 4e4d366 commit 1d50173

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/lightbox/Lightbox.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,27 @@ export default function Lightbox(props: Props): Node {
6464
height: 300,
6565
flex: 1,
6666
},
67-
overlay: {
67+
header: {
6868
backgroundColor: 'black',
6969
opacity: 0.8,
7070
position: 'absolute',
7171
width: windowWidth,
72+
...(headerFooterVisible ? { top: 0 } : { bottom: windowHeight }),
73+
},
74+
footer: {
75+
backgroundColor: 'black',
76+
opacity: 0.8,
77+
position: 'absolute',
78+
width: windowWidth,
79+
...(headerFooterVisible ? { bottom: 0 } : { top: windowHeight }),
7280
},
7381
container: {
7482
flex: 1,
7583
justifyContent: 'space-between',
7684
alignItems: 'center',
7785
},
7886
}),
79-
[windowWidth],
87+
[headerFooterVisible, windowWidth, windowHeight],
8088
);
8189

8290
return (
@@ -103,7 +111,7 @@ export default function Lightbox(props: Props): Node {
103111
onTap={handleImagePress}
104112
onViewTap={handleImagePress}
105113
/>
106-
<View style={[styles.overlay, headerFooterVisible ? { top: 0 } : { bottom: windowHeight }]}>
114+
<View style={styles.header}>
107115
<LightboxHeader
108116
onPressBack={() => {
109117
navigation.dispatch(navigateBack());
@@ -113,7 +121,7 @@ export default function Lightbox(props: Props): Node {
113121
senderId={message.sender_id}
114122
/>
115123
</View>
116-
<View style={[styles.overlay, headerFooterVisible ? { bottom: 0 } : { top: windowHeight }]}>
124+
<View style={styles.footer}>
117125
<LightboxFooter
118126
displayMessage={footerMessage}
119127
onOptionsPress={() => {

0 commit comments

Comments
 (0)