"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.UserProfileScreen = UserProfileScreen;
var _react = require("react");
var _Profile = _interopRequireDefault(require("../../features/user/Profile"));
var _native = require("@react-navigation/native");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function UserProfileScreen({
  defaultUserId
}) {
  var _route$params;
  const route = (0, _native.useRoute)();
  const navigation = (0, _native.useNavigation)();
  const userIdFromRoute = route === null || route === void 0 || (_route$params = route.params) === null || _route$params === void 0 ? void 0 : _route$params.userId;
  const [userId, setUserId] = (0, _react.useState)('');
  (0, _react.useEffect)(() => {
    const routes = navigation.getState().routes;
    if (defaultUserId && routes.length === 1) {
      setUserId(defaultUserId);
    } else if (userIdFromRoute) {
      setUserId(userIdFromRoute);
    }
    return () => {
      setUserId('');
    };
  }, [defaultUserId, navigation, userIdFromRoute]);
  return /*#__PURE__*/React.createElement(_Profile.default, {
    userId: userId,
    inline: !!defaultUserId && !userIdFromRoute
  });
}
//# sourceMappingURL=UserProfile.js.map