Obanana_test/app/components/main/home/Swiper.jsx

56 lines
1.3 KiB
React
Raw Normal View History

2023-09-26 14:33:01 +08:00
import React from "react";
import { StyleSheet, View, Text, Image } from "react-native";
import Swiper from "react-native-swiper";
2024-02-12 08:58:57 +08:00
import obnBanner1 from"./../../../../assets/obnBanner1.png"
import obnBanner12 from"./../../../../assets/obnBanner12png.png"
2023-09-26 14:33:01 +08:00
const SwiperCon = () => {
const slider = [
{
2024-02-12 08:58:57 +08:00
img: obnBanner1,
2023-09-26 14:33:01 +08:00
},
{
2024-02-12 08:58:57 +08:00
img: obnBanner12,
2023-09-26 14:33:01 +08:00
},
2024-02-12 08:58:57 +08:00
// {
// img: "https://obanana.com/wp-content/uploads/2023/04/Banner-04_compressed-scaled-1.jpg",
// },
2023-09-26 14:33:01 +08:00
];
return (
<View style={styles.container}>
2024-02-12 08:58:57 +08:00
<Swiper style={styles.wrapper} autoplay >
2023-09-26 14:33:01 +08:00
{slider.map((e, index) => (
<View style={styles.slide1} key={index}>
2024-02-12 08:58:57 +08:00
<Image source={ e.img } style={styles.image} />
2023-09-26 14:33:01 +08:00
</View>
))}
</Swiper>
</View>
);
};
const styles = StyleSheet.create({
wrapper: {
height: 150,
borderRadius: 15,
overflow: 'hidden',
// marginHorizontal:10
},
container: {
height: 150,
},
slide1: { justifyContent: "center", alignItems: "center" },
slide2: { justifyContent: "center", alignItems: "center" },
text: {
color: "#0a0a0a",
fontSize: 25,
fontWeight: "bold",
},
image: {
width: "100%",
height: '100%', // You can adjust the resizeMode as needed
margin:'auto'
},
});
export default SwiperCon;