quickrworld / MobileFlashcards

React native Mobile Flashcards
0 stars 0 forks source link

Use goBack when target view is already on the navigation stack #4

Closed quickrworld closed 6 years ago

quickrworld commented 6 years ago

In order to achieve proper usability experience, you would need to pop the current route as Deck View is already on the navigation stack. The following snippet should the trick.

quizHome = () => {
// ...
    this.props.navigation.goBack()
}

Existing code:

quizHome = () => {
    const { viewing } = this.props.decks
    this.props.initAnswering(viewing)
    this.setState({ showAnswer: false })
    this.setState({ quizComplete: false })
    this.props.navigation.navigate('QuizStart')
}
quickrworld commented 6 years ago

Completed and tested