import { Alert, View } from 'react-native';
import { Title } from '../../../../../elements';
import { useNavigation } from '@react-navigation/native';
import { useStyles } from './styles';
import BackButton from '../../../../../elements/BackButton';
import Button from '../../../../../components/Button/Button';
import { ALERT } from '../../../../../../core/constants';
function Header({
  onSave,
  disabled,
  isFormDirty
}) {
  const {
    styles
  } = useStyles();
  const navigation = useNavigation();
  return /*#__PURE__*/React.createElement(View, {
    style: styles.container
  }, /*#__PURE__*/React.createElement(BackButton, {
    onPress: () => {
      if (!isFormDirty) return navigation.goBack();
      Alert.alert(ALERT.NOTIFICATION.LEAVE_WITHOUT_FINISHING.TITLE, ALERT.NOTIFICATION.LEAVE_WITHOUT_FINISHING.MESSAGE, [{
        text: ALERT.ACTION.CANCEL,
        style: 'cancel'
      }, {
        text: ALERT.NOTIFICATION.LEAVE_WITHOUT_FINISHING.ACTION,
        style: 'destructive',
        onPress: navigation.goBack
      }]);
    }
  }), /*#__PURE__*/React.createElement(Title, {
    numberOfLines: 1,
    ellipsizeMode: "tail",
    style: styles.title
  }, "Posts"), /*#__PURE__*/React.createElement(Button, {
    type: "inline",
    onPress: onSave,
    disabled: disabled
  }, "Save"));
}
export default Header;
//# sourceMappingURL=Header.js.map