move show carousel out of the component

This commit is contained in:
João Ferreiro 2022-11-29 16:00:21 +00:00
parent dcb361329e
commit 23ea592987
6 changed files with 56 additions and 59 deletions

View file

@ -232,12 +232,15 @@ export const ComposePost = observer(function ComposePost({
selectedPhotos={selectedPhotos}
setSelectedPhotos={setSelectedPhotos}
/>
<PhotoCarouselPicker
selectedPhotos={selectedPhotos}
setSelectedPhotos={setSelectedPhotos}
localPhotos={localPhotos}
inputText={text}
/>
{localPhotos.photos != null &&
text === '' &&
selectedPhotos.length === 0 && (
<PhotoCarouselPicker
selectedPhotos={selectedPhotos}
setSelectedPhotos={setSelectedPhotos}
localPhotos={localPhotos}
/>
)}
<View style={styles.separator} />
<View style={[s.flexRow, s.pt10, s.pb10, s.pr5, styles.contentCenter]}>
<View style={s.flex1} />

View file

@ -8,17 +8,13 @@ import {observer} from 'mobx-react-lite'
export const PhotoCarouselPicker = observer(function PhotoCarouselPicker({
selectedPhotos,
setSelectedPhotos,
inputText,
localPhotos,
}: {
selectedPhotos: string[]
setSelectedPhotos: React.Dispatch<React.SetStateAction<string[]>>
inputText: string
localPhotos: any
}) {
return localPhotos.photos != null &&
inputText === '' &&
selectedPhotos.length === 0 ? (
return (
<ScrollView
horizontal
style={styles.photosContainer}
@ -60,7 +56,7 @@ export const PhotoCarouselPicker = observer(function PhotoCarouselPicker({
<FontAwesomeIcon icon="image" style={{color: colors.blue3}} size={24} />
</TouchableOpacity>
</ScrollView>
) : null
)
})
const styles = StyleSheet.create({

View file

@ -2,7 +2,6 @@ import React from 'react'
import {Image, StyleSheet, TouchableOpacity, View} from 'react-native'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {colors} from '../../lib/styles'
import {observer} from 'mobx-react-lite'
export const SelectedPhoto = ({
selectedPhotos,