@@ -40,8 +40,8 @@ export default function RealmInputScreen(props: Props): Node {
40
40
41
41
const [ error , setError ] = useState < string | null > ( null ) ;
42
42
43
- const tryRealm = useCallback ( async ( ) => {
44
- const parsedRealm = urlFromInputValue ( realmInputValue ) ;
43
+ const tryRealm = useCallback ( async unparsedUrl => {
44
+ const parsedRealm = urlFromInputValue ( unparsedUrl ) ;
45
45
if ( ! parsedRealm ) {
46
46
setError ( 'Please enter a valid URL' ) ;
47
47
return ;
@@ -65,7 +65,11 @@ export default function RealmInputScreen(props: Props): Node {
65
65
} finally {
66
66
setProgress ( false ) ;
67
67
}
68
- } , [ realmInputValue ] ) ;
68
+ } , [ ] ) ;
69
+
70
+ const handleInputSubmit = useCallback ( ( ) => {
71
+ tryRealm ( realmInputValue ) ;
72
+ } , [ tryRealm , realmInputValue ] ) ;
69
73
70
74
const styles = {
71
75
input : { marginTop : 16 , marginBottom : 8 } ,
@@ -88,7 +92,7 @@ export default function RealmInputScreen(props: Props): Node {
88
92
navigation = { navigation }
89
93
onChangeText = { setRealmInputValue }
90
94
value = { realmInputValue }
91
- onSubmitEditing = { tryRealm }
95
+ onSubmitEditing = { handleInputSubmit }
92
96
enablesReturnKeyAutomatically
93
97
/>
94
98
{ error !== null ? (
@@ -100,7 +104,7 @@ export default function RealmInputScreen(props: Props): Node {
100
104
style = { styles . button }
101
105
text = "Enter"
102
106
progress = { progress }
103
- onPress = { tryRealm }
107
+ onPress = { handleInputSubmit }
104
108
disabled = { urlFromInputValue ( realmInputValue ) === undefined }
105
109
/>
106
110
</ Screen >
0 commit comments