|
@ -68,31 +68,44 @@ const launchImageLibrary = async (onChangeImage, callBack) => { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function addNewImageBtn() { |
|
|
|
|
|
return ( |
|
|
|
|
|
<View style={styles.addBtn}> |
|
|
|
|
|
<MaterialCommunityIcons color={colors.white} name="camera" size={20} /> |
|
|
|
|
|
<Text style={{ color: colors.white, marginLeft: 10, fontSize: 14 }}> |
|
|
|
|
|
CÂMERA |
|
|
|
|
|
</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function ImageInput({ imageUri, onChangeImage }) { |
|
|
function ImageInput({ imageUri, onChangeImage }) { |
|
|
const [modalVisible, setModalVisible] = useState(false); |
|
|
const [modalVisible, setModalVisible] = useState(false); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View> |
|
|
<View> |
|
|
<TouchableWithoutFeedback |
|
|
|
|
|
onPress={() => { |
|
|
|
|
|
!imageUri |
|
|
|
|
|
? setModalVisible(true) |
|
|
|
|
|
: removeImgage(imageUri, onChangeImage); |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<View style={styles.container}> |
|
|
|
|
|
{!imageUri && ( |
|
|
|
|
|
<MaterialCommunityIcons |
|
|
|
|
|
color={colors.medium} |
|
|
|
|
|
name="camera-plus" |
|
|
|
|
|
size={40} |
|
|
|
|
|
/> |
|
|
|
|
|
)} |
|
|
|
|
|
{imageUri && ( |
|
|
|
|
|
|
|
|
{imageUri && ( |
|
|
|
|
|
<TouchableWithoutFeedback |
|
|
|
|
|
onPress={() => { |
|
|
|
|
|
removeImgage(imageUri, onChangeImage); |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<View style={styles.container}> |
|
|
<Image source={{ uri: imageUri }} style={styles.image} /> |
|
|
<Image source={{ uri: imageUri }} style={styles.image} /> |
|
|
)} |
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableWithoutFeedback> |
|
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
</TouchableWithoutFeedback> |
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
{!imageUri && ( |
|
|
|
|
|
<TouchableOpacity |
|
|
|
|
|
onPress={() => { |
|
|
|
|
|
setModalVisible(true); |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
{addNewImageBtn()} |
|
|
|
|
|
</TouchableOpacity> |
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
<View> |
|
|
<View> |
|
|
<Modal |
|
|
<Modal |
|
|
style={styles.centeredView} |
|
|
style={styles.centeredView} |
|
@ -214,6 +227,16 @@ const styles = StyleSheet.create({ |
|
|
fontWeight: "bold", |
|
|
fontWeight: "bold", |
|
|
height: 35, |
|
|
height: 35, |
|
|
}, |
|
|
}, |
|
|
|
|
|
addBtn: { |
|
|
|
|
|
marginVertical: 10, |
|
|
|
|
|
borderRadius: 6, |
|
|
|
|
|
flexDirection: "row", |
|
|
|
|
|
alignItems: "center", |
|
|
|
|
|
justifyContent: "center", |
|
|
|
|
|
backgroundColor: colors.primary, |
|
|
|
|
|
height: 42, |
|
|
|
|
|
width: "100%", |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export default ImageInput; |
|
|
export default ImageInput; |