import React from "react"; import { View, Image, Pressable, FlatList, Platform, } from "react-native"; import { useNavigation } from "@react-navigation/native"; import tw from "tailwind-rn"; const ios = Platform.OS === "ios"; import { connect } from "react-redux"; function Scroll({ books, mobile }) { const Box = ({ books }) => { const Product = ({ book, position }) => { const navigation = useNavigation(); return ( navigation.navigate("Product", { id: book?.id, type: "book" }) } style={[ tw("mr-1 overflow-hidden"), { width: position === 0 ? mobile ? 163 : 240 : mobile ? 84 : 125, height: position === 0 ? mobile ? 245 : 350 : mobile ? 118 : 170, marginLeft : position === 0 ? 16 : 4, }, ]} > ); }; return ( {books.slice(0,14).map((book, index) => ( ))} ); }; return ( } keyExtractor={(item) => item.id} /> ); } const mapStateToProps = (state) => ({ mobile : state.publicApi.mobile }); export default connect(mapStateToProps, {})(Scroll);