Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3372914
D9769.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9769.diff
View Options
diff --git a/lib/types/react-types.js b/lib/types/react-types.js
new file mode 100644
--- /dev/null
+++ b/lib/types/react-types.js
@@ -0,0 +1,6 @@
+// @flow
+
+// Flow 0.217 introduces React.RefSetter
+export type ReactRefSetter<I> =
+ | { current: null | I, ... }
+ | ((null | I) => mixed);
diff --git a/web/account/password-input.react.js b/web/account/password-input.react.js
--- a/web/account/password-input.react.js
+++ b/web/account/password-input.react.js
@@ -5,6 +5,7 @@
import SWMansionIcon, {
type Icon,
} from 'lib/components/SWMansionIcon.react.js';
+import type { ReactRefSetter } from 'lib/types/react-types.js';
import css from './password-input.css';
import Button from '../components/button.react.js';
@@ -12,7 +13,10 @@
type PasswordInputProps = BaseInputProps;
-function PasswordInput(props: PasswordInputProps, ref): React.Node {
+function PasswordInput(
+ props: PasswordInputProps,
+ ref: ReactRefSetter<HTMLInputElement>,
+): React.Node {
const [htmlInputType, setHtmlInputType] = React.useState<'password' | 'text'>(
'password',
);
diff --git a/web/components/search.react.js b/web/components/search.react.js
--- a/web/components/search.react.js
+++ b/web/components/search.react.js
@@ -3,6 +3,7 @@
import * as React from 'react';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
+import type { ReactRefSetter } from 'lib/types/react-types.js';
import ClearSearchButton from './clear-search-button.react.js';
import css from './search.css';
@@ -15,7 +16,10 @@
+onClearText?: () => mixed,
};
-function Search(props: Props, ref): React.Node {
+function Search(
+ props: Props,
+ ref: ReactRefSetter<HTMLInputElement>,
+): React.Node {
const { searchText, onChangeText, placeholder, onClearText, ...rest } = props;
const showClearButton = !!searchText;
diff --git a/web/modals/input.react.js b/web/modals/input.react.js
--- a/web/modals/input.react.js
+++ b/web/modals/input.react.js
@@ -3,6 +3,8 @@
import classNames from 'classnames';
import * as React from 'react';
+import type { ReactRefSetter } from 'lib/types/react-types.js';
+
import css from './input.css';
export type BaseInputProps = {
@@ -22,7 +24,10 @@
+maxLength?: number,
};
-function Input(props: InputProps, ref): React.Node {
+function Input(
+ props: InputProps,
+ ref: ReactRefSetter<HTMLInputElement>,
+): React.Node {
const {
label: labelProp,
disabled = false,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 8:14 AM (14 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580860
Default Alt Text
D9769.diff (2 KB)
Attached To
Mode
D9769: [Flow202][web][skip-ci] [3/x] Type React.forwardRef input functions
Attached
Detach File
Event Timeline
Log In to Comment