diff --git a/src/core/ui/components/AddonPage.tsx b/src/core/ui/components/AddonPage.tsx index 24e2059..e7db7f2 100644 --- a/src/core/ui/components/AddonPage.tsx +++ b/src/core/ui/components/AddonPage.tsx @@ -69,8 +69,16 @@ function InputAlert(props: { const [value, setValue] = React.useState(""); const [error, setError] = React.useState(""); const [isFetching, setIsFetching] = React.useState(false); + const [validUrl, setValidUrl] = React.useState(false); + + // Check URL validity whenever value changes + React.useEffect(() => { + setValidUrl(isValidHttpUrl(value)); + }, [value]); function onConfirmWrapper() { + if (!value || !isValidHttpUrl(value)) return; + setIsFetching(true); props @@ -87,24 +95,37 @@ function InputAlert(props: { title={props.label} content="Type in the source URL you want to install from:" extraContent={ - - { - setValue(v); - if (error) setError(""); + + + { + setValue(v); + if (error) setError(""); + }} + returnKeyType="done" + onSubmitEditing={onConfirmWrapper} + state={error ? "error" : undefined} + errorMessage={error || undefined} + style={{ fontSize: 16 }} + /> + + + -