How would I transform the array in imageCollection to get the array in carouselPhotos? (See code below).
export default class HomeScreen extends Component {
state = {
imageCollection: [
{
name: "Pictures of birds"
image1: "http://127.0.0.1:8000/media/image1A.jpg",
image2: "http://127.0.0.1:8000/media/image2A.jpg",
image3: "http://127.0.0.1:8000/media/image3A.jpg"}
],
carouselPhotos: [
{
image: "http://127.0.0.1:8000/media/image1A.jpg",
},
{
image: "http://127.0.0.1:8000/media/image2A.jpg",
},
{
image: "http://127.0.0.1:8000/media/image3A.jpg",
},
],
};
I am using the react-native-snap-carousel, which renders 1 carousel card per object, so each image must be its own object. It is also important that the data in carouselPhotos is labeled as 'image', and it must be loaded for when the page opens.
Any help would be greatly appreciated!
Clarifications: imageCollection has many objects, but I will just pick one object for the carouselPhoto. There are three image properties names imageX, but there are also other properties such as "name"
imageX?