diff --git a/components/InputDialog.js b/components/InputDialog.js index 1900fca..efce212 100644 --- a/components/InputDialog.js +++ b/components/InputDialog.js @@ -9,6 +9,26 @@ import { export default function InputDialog({ visible, onOK, onDismiss, title, label, placeholder }) { const [ text, setText ] = useState(""); + const [ error, setError ] = useState(false); + + function onChangeText(text) { + setText(text); + setError(text === ""); + } + + function onCancel() { + onDismiss(); + setText(""); + } + + function onDone() { + if (text === "") { + setError(true); + return; + } + onOK(text); + setText(""); + } return ( setText(text)} + onChangeText={onChangeText} mode="outlined" + error={error} /> - - + +