Skip to content

When I replaced the class component with function, the following warning was reported: #21

@codthing

Description

@codthing

image

export const BanerSwiper = () => {

    const BannerWidth = Dimensions.get('window').width;
    const BannerHeight = 260;

    const [images, set_images] = useState(Array)

    useEffect(() => {
        set_images([
            "https://smapse.com/storage/2018/03/admiral-farragut-academy-sport.jpg",
            "https://smapse.com/storage/2018/03/admiral-farragut.jpg",
            "https://smapse.com/storage/2018/03/akademiya-admiral-farragut.jpg"
        ])
    }, [])

    console.log('images:', images)

    const renderPage = (image: string, index: React.Key | null | undefined) => {
        return (
            <View key={index}>
                <Image style={{ width: BannerWidth, height: BannerHeight }} source={{ uri: image }} />
            </View>
        );
    }


    return (
        <View style={styles.container}>
            <Carousel
                autoplay
                autoplayTimeout={5000}
                loop
                index={0}
                pageSize={BannerWidth}
            >
                {images.map((image, index) => { return (renderPage(image, index)) })}
            </Carousel>
        </View>
    );

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions