Gattu
Gattu

Reputation: 133

react-native-flatlist-slider images don't show

App.js

import { StyleSheet, Text, View } from 'react-native'
import React from 'react'
import { FlatListSlider } from 'react-native-flatlist-slider';

const images = [
    {
        image: 'https://cdn-icons-png.flaticon.com/256/4481/4481273.png',
        desc: 'Silent Waters in the mountains in midst of Himilayas',
    },
    {
        image: 'https://cdn-icons-png.flaticon.com/256/4961/4961556.png',
        desc:
            'Red fort in India New Delhi is a magnificient masterpeiece of humans',
    },
    {
        image: 'https://cdn-icons-png.flaticon.com/256/4481/4481273.png',
        desc: 'Silent Waters in the mountains in midst of Himilayas',
    },
    {
        image: 'https://cdn-icons-png.flaticon.com/256/4961/4961556.png',
        desc:
            'Red fort in India New Delhi is a magnificient masterpeiece of humans',
    },
]

const IncomeReceive = () => {
    return (
        <View style={{ flex: 1 }}>
            <FlatListSlider
                data={images}
                width={200}
                timer={5000}
                onPress={item => alert(JSON.stringify(item))}
                indicatorActiveWidth={20}
                contentContainerStyle={{ paddingHorizontal: 16 }}
            />
           
        </View>
    )
}

export default IncomeReceive

const styles = StyleSheet.create({})

Output:

enter image description here

My images display on the tablet, but when I display them on another device, they don't show. I don't know where my mistake is. I'm using react-native-flatlist-slider.

I've seen one video on this library, but in the video, the images are showing.

Can anyone help me?

Upvotes: 1

Views: 386

Answers (1)

ND verma
ND verma

Reputation: 297

**work for me** 

 <View style={{ flex: 1 }}>
                <FlatListSlider
                    data={images}
                    width={200}
                    height={200} <--- Add this 
                    timer={5000}
                    onPress={item => alert(JSON.stringify(item))}
                    indicatorActiveWidth={20}
                    contentContainerStyle={{ paddingHorizontal: 16 }}
                />
               
            </View>

Upvotes: 1

Related Questions