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

How to handle renderNoMoreCards??? #33

Open
sadique007 opened this issue Oct 11, 2018 · 4 comments
Open

How to handle renderNoMoreCards??? #33

sadique007 opened this issue Oct 11, 2018 · 4 comments

Comments

@sadique007
Copy link

how to call a function after all last card swiped.

I have simply added a TouchableHighlight as following:-

renderNoMoreCards={() => <TouchableHighlight onPress={() => this.onPressData()}
style={[styles.buttonContainerSubmit,styles.submitButton]}>
Submit
}

I want to directly call this.onPressData() without any button after swiping all the cards.

if am calling directly like this:-
renderNoMoreCards={this.onPressData() }
then i am not able to swipe the card. this function is executing first

how can I fix this???? prob please help me out

@sadique007 sadique007 changed the title handling renderNoMoreCards How to handle renderNoMoreCards??? Oct 22, 2018
@Ramaraju1992
Copy link

Ramaraju1992 commented Dec 21, 2018

@sadique007 you can call method in onPress like following ways,

<TouchableHighlight onPress={this.onPressData.bind(this,{params_here})} />

or 

<TouchableHighlight onPress={this.onPressData} />

or

<TouchableHighlight onPress={()=>{this.onPressData()}} />

onPressData =()=>{
}

@sadique007
Copy link
Author

@sadique007 you can call method in onPress like following ways,

<TouchableHighlight onPress={this.onPressData.bind(this,{params_here})} />

or 

<TouchableHighlight onPress={this.onPressData} />

or

<TouchableHighlight onPress={()=>{this.onPressData()}} />

onPressData =()=>{
}

THANKS FOR YOUR RESPONSE!!

but this is not the answer what I am expecting.
I want to call a function without TouchableOpacity/TouchableHighlight/ button. And the function call should be made after last card swipe.

@matias91
Copy link

Hi, @sadique007. Don't know if you resolved this already, but just in case:

renderNoMoreCards is a function that needs to return a component. Also, is called on the render of CardStack, that's why call this.onPressData() will never work as expected (because will execute that when the CardStack component renders, and not when the last card is swiped).

If you need to execute that after last card swiped, maybe you can use onSwiped event, of the Card component. But the logic to identify the last card relies on you 🤷‍♂️ 😞

@karladler
Copy link

Looks like you are actually looking for the onSwipedAll event. Just call your function there.

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

No branches or pull requests

4 participants