Skip to content

Support for BackAndroid #5

Description

@jessemezini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions