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

prop getActions return functions to execute action #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

esganzerla
Copy link
Contributor

@esganzerla esganzerla commented Mar 10, 2017

This includes the prop getActions, which will return to a function a json to execute _forceRightSwipe, _forceLeftSwipe and _forceUpSwipe.

The return looks like:

{
  yup: this._forceRightSwipe.bind(this),
  nope: this._forceLeftSwipe.bind(this),
  maybe: this._forceUpSwipe.bind(this),
}

It can be used like:

render () {
  let swipeActions
  return (
    <View>
      <SwipeCard getActions={actions => { swipeActions = actions } />
      <TouchableHighlight onPress={() => swipeActions.yup()}>
        <Text>EXECUTE YUP ACTION</Text>
      </TouchableHighlight>
    </View>
  )
}

This probably helps on Issue #62.

Note: I took the liberty to include the swipe as using on PR #70. It's easy to remove if not approved.
Note 2: I took off the function () => { alert('tapped') } from default prop onClickHandler. Seemed as possible problem someone might have.

@esganzerla
Copy link
Contributor Author

Should we close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant