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

Support for BackAndroid #5

Open
jessemezini opened this issue Jun 15, 2016 · 0 comments
Open

Support for BackAndroid #5

jessemezini opened this issue Jun 15, 2016 · 0 comments

Comments

@jessemezini
Copy link

Hi, i'm trying to implement the BackAndroid and it's not working for me. I did with rn-router-flux but with redux i'm having trouble

Is this a feature to implement or isn't nesessary?

This is what i have so far

app/components/ApplicationTabs/index.android.js

class ApplicationTabs extends Component {
  constructor(props) {
    super(props);
    this._handleBackAction = this._handleBackAction.bind(this);
  }

  componentDidMount() {
    BackAndroid.addEventListener('hardwareBackPress', this._handleBackAction);
  }

  componentWillUnmount() {
    BackAndroid.removeEventListener('hardwareBackPress', this._handleBackAction);
  }

  _handleBackAction() {
    if (this.props.onNavigate.index === 0) {
      return false;
    }
    this.props.onNavigate({
      type: 'pop',
    });
    return true;
  }
.
.
.

Thanks

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

1 participant