@@ -32,8 +32,8 @@ export default function RealmInputScreen(props: Props): Node {
32
32
33
33
const [ error , setError ] = useState < string | null > ( null ) ;
34
34
35
- const tryRealm = useCallback ( async ( ) => {
36
- const parsedRealm = tryParseUrl ( realmInputValue ) ;
35
+ const tryRealm = useCallback ( async ( unparsedUrl : string ) => {
36
+ const parsedRealm = tryParseUrl ( unparsedUrl ) ;
37
37
if ( ! parsedRealm ) {
38
38
setError ( 'Please enter a valid URL' ) ;
39
39
return ;
@@ -57,7 +57,11 @@ export default function RealmInputScreen(props: Props): Node {
57
57
} finally {
58
58
setProgress ( false ) ;
59
59
}
60
- } , [ realmInputValue ] ) ;
60
+ } , [ ] ) ;
61
+
62
+ const handleInputSubmit = useCallback ( ( ) => {
63
+ tryRealm ( realmInputValue ) ;
64
+ } , [ tryRealm , realmInputValue ] ) ;
61
65
62
66
const styles = {
63
67
input : { marginTop : 16 , marginBottom : 8 } ,
@@ -80,7 +84,7 @@ export default function RealmInputScreen(props: Props): Node {
80
84
navigation = { navigation }
81
85
onChangeText = { setRealmInputValue }
82
86
value = { realmInputValue }
83
- onSubmitEditing = { tryRealm }
87
+ onSubmitEditing = { handleInputSubmit }
84
88
enablesReturnKeyAutomatically
85
89
/>
86
90
{ error !== null ? (
@@ -92,7 +96,7 @@ export default function RealmInputScreen(props: Props): Node {
92
96
style = { styles . button }
93
97
text = "Enter"
94
98
progress = { progress }
95
- onPress = { tryRealm }
99
+ onPress = { handleInputSubmit }
96
100
disabled = { tryParseUrl ( realmInputValue ) === undefined }
97
101
/>
98
102
</ Screen >
0 commit comments