forked from zulip/zulip-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Input, SmartUrlInput: Use modern
React.createRef
API.
Now that the `Input` component clearly doesn't use the ref on its child `TextInput` -- only `Input`'s consumers use it; see the previous commit -- we can straightforwardly use the new `React.createRef` API. We can also do so in `SmartUrlInput`. This will smoothen some necessary changes during the upcoming RN v0.61 -> v0.62 upgrade. In particular, it seems that the way `TextInput` is defined has changed in an interesting way (it certainly has changed), or else something happened in the Flow upgrade, to cause this error in several places where we use `TextInput` as a type: ``` Cannot use `TextInput` as a type. A name can be used as a type only if it refers to a type definition, an interface definition, or a class definition. To get the type of a non-class value, use `typeof`. ``` I discovered, in this commit, that `React$Ref`, not `React$ElementRef`, seems to be the correct type for the `ref` attribute and the return value of `React.createRef`. Weeks ago, we used `React$RefElement` for `this.mentionWarnings` in `ComposeBox` and overlooked [1] the fact that it ended up being more or less completely un-typechecked, in 20bd98a. I'll add a TODO in the next commit, saying we should fix that. [1] zulip#4101 (comment)
- Loading branch information
1 parent
90c5994
commit ca25891
Showing
4 changed files
with
29 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters