react-native-swipeables
v0.0.4
Published
<img src="example.gif" alt="animated" />
Downloads
12
Readme
react-native-swipeables
Install
npm install react-native-swipeables
Usage
import { SwipeableCards } from "react-native-swipeables";
<SwipeableCards
data={[
{
id: 1,
imgSrc: require('./assets/1.jpg'),
},
{
id: 2,
imgSrc: require('./assets/2.jpg'),
},
].map(item => ({
item,
render: (details: { id: number; imgSrc: ImageSourcePropType }) => (
<View style={styles.card}>
<Image source={details.imgSrc} style={styles.image} />
</View>
),
}))}
onChange={(item, direction) => {
// handle callback
}}
/>
const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
const styles = StyleSheet.create({
image: {
flex: 1,
width: undefined,
height: undefined,
resizeMode: 'cover',
borderRadius: 20,
},
card: {
position: 'absolute',
height: screenHeight - 120,
width: screenWidth - 16,
left: 8,
top: 8,
},
});