Created
September 5, 2020 13:17
-
-
Save akulsr0/33ca485734b10d844ee7666f2955d132 to your computer and use it in GitHub Desktop.
React Native UI App - Swiper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { | |
View, | |
Image, | |
} from 'react-native'; | |
// npm i react-native-swiper | |
import Swiper from 'react-native-swiper'; | |
export default function App() { | |
const [userData] = useState([ | |
{ | |
img: 'https://randomuser.me/api/portraits/men/81.jpg', | |
name: 'Maurice Davis', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/women/20.jpg', | |
name: 'Bernice Alvarez', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/women/19.jpg', | |
name: 'Jennie Barnett', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/men/55.jpg', | |
name: 'Matthew Wagner', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/men/71.jpg', | |
name: 'Christian Wilson', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/women/21.jpg', | |
name: 'Sophia Fernandez', | |
}, | |
{ | |
img: 'https://randomuser.me/api/portraits/women/42.jpg', | |
name: 'Sylvia Lynch', | |
}, | |
]); | |
return ( | |
<View> | |
<Swiper showsButtons={true} style={{ height: 300 }}> | |
{userData.map((user) => ( | |
<View style={{ alignItems: 'center' }}> | |
<Image | |
style={{ width: 300, height: 300 }} | |
source={{ uri: user.img }} | |
/> | |
</View> | |
))} | |
</Swiper> | |
</View> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment