You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
973 B
40 lines
973 B
import React, { useRef } from "react";
|
|
import { View, StyleSheet, ScrollView } from "react-native";
|
|
import ImageInput from "./ImageInput";
|
|
|
|
function ImageInputList({ imageUris = [], onRemoveImage, onAddImage }) {
|
|
const scrollView = useRef();
|
|
|
|
return (
|
|
<View>
|
|
<ScrollView
|
|
ref={scrollView}
|
|
horizontal
|
|
onContentSizeChange={() => scrollView.current.scrollToEnd()}
|
|
>
|
|
<View style={styles.container}>
|
|
{imageUris.map((uri) => (
|
|
<View key={uri} style={styles.image}>
|
|
<ImageInput
|
|
imageUri={uri}
|
|
onChangeImage={() => onRemoveImage(uri)}
|
|
/>
|
|
</View>
|
|
))}
|
|
<ImageInput onChangeImage={(uri) => onAddImage(uri)} />
|
|
</View>
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flexDirection: "row",
|
|
},
|
|
image: {
|
|
marginRight: 10,
|
|
},
|
|
});
|
|
|
|
export default ImageInputList;
|