forked from lhandel/react-native-card-stack-swiper
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Card.js
42 lines (39 loc) · 918 Bytes
/
Card.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { Component } from 'react';
import PropTypes from 'prop-types'
import {
ScrollView, View
} from 'react-native';
const Card = ({ style, children, isScrollable, ...props }) => {
if (isScrollable) {
return (
<View style={style}>
<ScrollView {...props}>
{children}
</ScrollView>
</View>
);
}
return (
<View style={style} >
{children}
</View>
);
}
Card.propTypes = {
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
style: PropTypes.oneOfType([PropTypes.number, PropTypes.object, PropTypes.array]),
onSwipedLeft: PropTypes.func,
onSwipedRight: PropTypes.func,
onSwipedTop: PropTypes.func,
onSwipedBottom: PropTypes.func,
onSwiped: PropTypes.func,
}
Card.defaultProps = {
style: {},
onSwiped: () => { },
onSwipedLeft: () => { },
onSwipedRight: () => { },
onSwipedTop: () => { },
onSwipedBottom: () => { },
}
export default Card;