"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _native = require("@react-navigation/native");
var _element = require("@wordpress/element");
var _ = _interopRequireDefault(require("./"));
var _jsxRuntime = require("react/jsx-runtime");
/**
 * External dependencies
 */

/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const LinkSettingsScreen = props => {
  const navigation = (0, _native.useNavigation)();
  const route = (0, _native.useRoute)();
  const {
    url = ''
  } = props;
  const {
    inputValue = url
  } = route.params || {};
  const onLinkCellPressed = () => {
    if (props.onLinkCellPressed) {
      props.onLinkCellPressed({
        navigation
      });
    } else {
      navigation.navigate('linkPicker', {
        inputValue
      });
    }
  };
  return (0, _element.useMemo)(() => {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, {
      ...props,
      onLinkCellPressed: props.hasPicker ? onLinkCellPressed : undefined,
      urlValue: inputValue
    });
    // See https://github.com/WordPress/gutenberg/pull/41166
  }, [props, inputValue, navigation, route]);
};
var _default = exports.default = LinkSettingsScreen;
//# sourceMappingURL=link-settings-screen.native.js.map