I am trying to create an image carousel using the "react-native-image-slider-box" library. I configured the library classes and parameters properly but I am not able to see the image-carousel in the mobile expo app.
Code that I used:
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { SliderBox } from 'react-native-image-slider-box';
import { HomeGrid } from './HomeGrid';
export default class Home extends Component {
constructor() {
super();
this.state = {
images: [
require('./commonComponents/photos/photo2.jpeg'),
require('./commonComponents/photos/photo3.jpg'),
require('./commonComponents/photos/photo4.jpg'),
require('./commonComponents/photos/photo3.jpg'),
]
};
}
render() {
return (
<View style={styles.container}>
<SliderBox
images= { {uri: this.state.images } }
sliderBoxHeight={400}
onCurrentImagePressed={index =>
console.warn(`image ${index} pressed`)
}
/>
<HomeGrid />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
}
});
And the images are present inside a directory like this:
ProjectName
---> src
---> components
---> commonComponents
---> photos
---> photo1.jpeg
Where am I going wrong in this? What should I do to make the image slider working? The output is only showing the HomeGrid component and not the SliderBox component.