Skip to content

Commit d6d9731

Browse files
committed
SmartUrlInput [nfc]: Fix type-checking of ref
1 parent 7d003af commit d6d9731

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/common/SmartUrlInput.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow strict-local */
2-
import React, { useState, useRef, useCallback, useContext } from 'react';
2+
import React, { useState, useCallback, useContext } from 'react';
33
import type { Node } from 'react';
44
import { TextInput, View } from 'react-native';
55
import { useFocusEffect } from '@react-navigation/native';
@@ -28,11 +28,7 @@ type Props = $ReadOnly<{|
2828
export default function SmartUrlInput(props: Props): Node {
2929
const { onChangeText, onSubmitEditing } = props;
3030

31-
// We should replace the fixme with
32-
// `React$ElementRef<typeof TextInput>` when we can. Currently, that
33-
// would make `.current` be `any(implicit)`, which we don't want;
34-
// this is probably down to bugs in Flow's special support for React.
35-
const textInputRef = useRef<$FlowFixMe>();
31+
const textInputRef = React.useRef<React$ElementRef<typeof TextInput> | null>(null);
3632

3733
const [value, setValue] = useState<string>('');
3834

@@ -51,8 +47,6 @@ export default function SmartUrlInput(props: Props): Node {
5147
// screen, sometimes the keyboard flicks open then closed, instead
5248
// of just opening. Shrug. See
5349
// https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/realm-input/near/1346690
54-
//
55-
// `.current` is not type-checked; see definition.
5650
textInputRef.current.focus();
5751
}
5852
}, []),

0 commit comments

Comments
 (0)