@@ -32,8 +32,8 @@ export default function RealmInputScreen(props: Props): Node {
3232
3333 const [ error , setError ] = useState < string | null > ( null ) ;
3434
35- const tryRealm = useCallback ( async ( ) => {
36- const parsedRealm = tryParseUrl ( realmInputValue ) ;
35+ const tryRealm = useCallback ( async ( unparsedUrl : string ) => {
36+ const parsedRealm = tryParseUrl ( unparsedUrl ) ;
3737 if ( ! parsedRealm ) {
3838 setError ( 'Please enter a valid URL' ) ;
3939 return ;
@@ -57,7 +57,11 @@ export default function RealmInputScreen(props: Props): Node {
5757 } finally {
5858 setProgress ( false ) ;
5959 }
60- } , [ realmInputValue ] ) ;
60+ } , [ ] ) ;
61+
62+ const handleInputSubmit = useCallback ( ( ) => {
63+ tryRealm ( realmInputValue ) ;
64+ } , [ tryRealm , realmInputValue ] ) ;
6165
6266 const styles = {
6367 input : { marginTop : 16 , marginBottom : 8 } ,
@@ -80,7 +84,7 @@ export default function RealmInputScreen(props: Props): Node {
8084 navigation = { navigation }
8185 onChangeText = { setRealmInputValue }
8286 value = { realmInputValue }
83- onSubmitEditing = { tryRealm }
87+ onSubmitEditing = { handleInputSubmit }
8488 enablesReturnKeyAutomatically
8589 />
8690 { error !== null ? (
@@ -92,7 +96,7 @@ export default function RealmInputScreen(props: Props): Node {
9296 style = { styles . button }
9397 text = "Enter"
9498 progress = { progress }
95- onPress = { tryRealm }
99+ onPress = { handleInputSubmit }
96100 disabled = { tryParseUrl ( realmInputValue ) === undefined }
97101 />
98102 </ Screen >
0 commit comments