Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since the ViewProps will get removed from react native I fixed the co… #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions SwipeCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ import { styles } from "./Styles";
let currentIndex = {};
let guid = 0;

const actionShape = PropTypes.shape({
show: PropTypes.bool,
view: PropTypes.element, // takes priority over text + color
containerStyle: ViewPropTypes.style,
textStyle: ViewPropTypes.style,
text: PropTypes.string,
color: PropTypes.string,
onAction: PropTypes.func, // triggered on action, given card data, must return true if success
});


const defaultActionsProp = {
yup: { show: true, text: "Yup!", color: "green" },
Expand All @@ -33,6 +25,16 @@ const mergeActionProps = (actionsProps) => ({
maybe: { ...defaultActionsProp.maybe, ...actionsProps.maybe },
});

const actionShape = {
show: PropTypes.bool,
view: PropTypes.element, // takes priority over text + color
containerStyle: PropTypes.any,
textStyle: PropTypes.any,
text: PropTypes.string,
color: PropTypes.string,
onAction: PropTypes.func, // triggered on action, given card data, must return true if success
};

export default class SwipeCards extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -594,16 +596,16 @@ SwipeCards.propTypes = {
stackOffsetY: PropTypes.number,
renderNoMoreCards: PropTypes.func,
actions: PropTypes.shape({
yup: actionShape,
nope: actionShape,
maybe: actionShape,
yup: PropTypes.shape(actionShape),
nope: PropTypes.shape(actionShape),
maybe: PropTypes.shape(actionShape),
}),
onClickHandler: PropTypes.func,
onDragStart: PropTypes.func,
onDragRelease: PropTypes.func,
cardRemoved: PropTypes.func,
renderCard: PropTypes.func.isRequired,
style: ViewPropTypes.style,
style: PropTypes.any,
dragY: PropTypes.bool,
smoothTransition: PropTypes.bool,
keyExtractor: PropTypes.func.isRequired,
Expand Down