@@ -14,47 +14,50 @@ const Single = styled.TouchableOpacity`
1414 border-top-left-radius: 16px;
1515 border-top-right-radius: 16px;
1616 border-bottom-left-radius: ${ ( { alignment } ) =>
17- alignment === 'right' ? 16 : 2 } ;
17+ alignment === 'right' ? 16 : 2 } px ;
1818 border-bottom-right-radius: ${ ( { alignment } ) =>
19- alignment === 'left' ? 16 : 2 } ;
19+ alignment === 'left' ? 16 : 2 } px ;
2020 height: 200px;
2121 overflow: hidden;
22- width: ${ ( { theme } ) => theme . message . gallery . width } ;
22+ width: ${ ( { theme } ) => theme . message . gallery . width } px ;
2323 ${ ( { theme } ) => theme . message . gallery . single . css }
2424` ;
2525
2626const GalleryContainer = styled . View `
2727 border-radius: 16px;
2828 border-bottom-right-radius: ${ ( { alignment } ) =>
29- alignment === 'left' ? 16 : 2 } ;
29+ alignment === 'left' ? 16 : 2 } px ;
3030 border-bottom-left-radius: ${ ( { alignment } ) =>
31- alignment === 'right' ? 16 : 2 } ;
31+ alignment === 'right' ? 16 : 2 } px ;
3232 flex-direction: row;
3333 flex-wrap: wrap;
3434 height: ${ ( { theme, length } ) =>
3535 length >= 4
3636 ? theme . message . gallery . doubleSize
3737 : length === 3
3838 ? theme . message . gallery . halfSize
39- : theme . message . gallery . size } ;
39+ : theme . message . gallery . size } px ;
4040 overflow: hidden;
41- width: ${ ( { theme } ) => theme . message . gallery . width } ;
41+ width: ${ ( { theme } ) => theme . message . gallery . width } px ;
4242 ${ ( { theme } ) => theme . message . gallery . galleryContainer . css }
4343` ;
4444
4545const ImageContainer = styled . TouchableOpacity `
4646 height: ${ ( { theme, length } ) =>
47- length !== 3 ? theme . message . gallery . size : theme . message . gallery . halfSize } ;
47+ length !== 3
48+ ? theme . message . gallery . size
49+ : theme . message . gallery . halfSize } px;
4850 width: ${ ( { theme, length } ) =>
49- length !== 3 ? theme . message . gallery . size : theme . message . gallery . halfSize } ;
51+ length !== 3
52+ ? theme . message . gallery . size
53+ : theme . message . gallery . halfSize } px;
5054 ${ ( { theme } ) => theme . message . gallery . imageContainer . css }
5155` ;
5256
5357const HeaderContainer = styled . View `
58+ flex: 1;
5459 flex-direction: row;
5560 justify-content: flex-end;
56- position: absolute;
57- width: 100%;
5861 z-index: 1000;
5962 ${ ( { theme } ) => theme . message . gallery . header . container . css }
6063` ;
@@ -92,10 +95,10 @@ const Gallery = ({ alignment, images }) => {
9295 const [ viewerModalImageIndex , setViewerModalImageIndex ] = useState ( 0 ) ;
9396 const [ viewerModalOpen , setViewerModalOpen ] = useState ( false ) ;
9497
95- if ( ! images || ! images . length ) return null ;
98+ if ( ! images ? .length ) return null ;
9699
97- const galleryImages = [ ...images ] . map ( ( i ) => ( {
98- url : makeImageCompatibleUrl ( i . image_url || i . thumb_url ) ,
100+ const galleryImages = [ ...images ] . map ( ( image ) => ( {
101+ url : makeImageCompatibleUrl ( image . image_url || image . thumb_url ) ,
99102 } ) ) ;
100103
101104 if ( galleryImages . length === 1 ) {
@@ -111,7 +114,7 @@ const Gallery = ({ alignment, images }) => {
111114 < Image
112115 resizeMode = 'cover'
113116 source = { { uri : galleryImages [ 0 ] . url } }
114- style = { { height : '100%' , width : '100%' } }
117+ style = { { flex : 1 } }
115118 />
116119 </ Single >
117120 < Modal
@@ -156,20 +159,18 @@ const Gallery = ({ alignment, images }) => {
156159 { ...additionalTouchableProps }
157160 >
158161 { i === 3 && galleryImages . length > 4 ? (
159- < View style = { { width : '100%' , height : '100%' } } >
162+ < View style = { { flex : 1 } } >
160163 < Image
161164 resizeMode = 'cover'
162165 source = { { uri : galleryImages [ 3 ] . url } }
163- style = { { width : '100%' , height : '100%' } }
166+ style = { { flex : 1 } }
164167 />
165168 < View
166169 style = { {
167170 alignItems : 'center' ,
168171 backgroundColor : 'rgba(0,0,0,0.69)' ,
169- height : '100%' ,
172+ flex : 1 ,
170173 justifyContent : 'center' ,
171- position : 'absolute' ,
172- width : '100%' ,
173174 } }
174175 >
175176 < Text
@@ -187,7 +188,7 @@ const Gallery = ({ alignment, images }) => {
187188 < Image
188189 resizeMode = 'cover'
189190 source = { { uri : image . url } }
190- style = { { width : '100%' , height : '100%' } }
191+ style = { { flex : 1 } }
191192 />
192193 ) }
193194 </ ImageContainer >
0 commit comments