text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = withNavigationFocus;
  
  var _react = _interopRequireDefault(require("react"));
  
  var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
  
  var _withNavigation = _interopRequireDefault(require("./withNavigation"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  
  function withNavigationFocus(Component) {
    class ComponentWithNavigationFocus extends _react.default.Component {
      constructor(props) {
        super(props);
        this.subscriptions = [props.navigation.addListener('didFocus', () => this.setState({
          isFocused: true
        })), props.navigation.addListener('willBlur', () => this.setState({
          isFocused: false
        }))];
        this.state = {
          isFocused: props.navigation ? props.navigation.isFocused() : false
        };
      }
  
      componentWillUnmount() {
        this.subscriptions.forEach(sub => sub.remove());
      }
  
      render() {
        return _react.default.createElement(Component, _extends({}, this.props, {
          isFocused: this.state.isFocused,
          ref: this.props.onRef
        }));
      }
  
    }
  
    _defineProperty(ComponentWithNavigationFocus, "displayName", "withNavigationFocus(".concat(Component.displayName || Component.name, ")"));
  
    return (0, _hoistNonReactStatics.default)((0, _withNavigation.default)(ComponentWithNavigationFocus, {
      forwardRef: false
    }), Component);
  }
  //# sourceMappingURL=withNavigationFocus.js.map