diff --git a/lib/types/react-types.js b/lib/types/react-types.js --- a/lib/types/react-types.js +++ b/lib/types/react-types.js @@ -1,8 +1,3 @@ // @flow -// Flow 0.217 introduces React.RefSetter -export type ReactRefSetter = - | { current: null | I, ... } - | ((null | I) => mixed); - export type ReactRef = { current: null | T }; diff --git a/native/account/registration/registration-text-input.react.js b/native/account/registration/registration-text-input.react.js --- a/native/account/registration/registration-text-input.react.js +++ b/native/account/registration/registration-text-input.react.js @@ -3,8 +3,6 @@ import * as React from 'react'; import { TextInput } from 'react-native'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import { useStyles, useColors, @@ -16,7 +14,7 @@ function ForwardedRegistrationTextInput( props: Props, - ref: ReactRefSetter>, + ref: React.RefSetter>, ): React.Node { const { onFocus, diff --git a/native/bottom-sheet/bottom-sheet.react.js b/native/bottom-sheet/bottom-sheet.react.js --- a/native/bottom-sheet/bottom-sheet.react.js +++ b/native/bottom-sheet/bottom-sheet.react.js @@ -4,8 +4,6 @@ import invariant from 'invariant'; import * as React from 'react'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import BottomSheetBackdrop from './bottom-sheet-backdrop.react.js'; import { handleTotalHeight } from './bottom-sheet-constants.js'; import BottomSheetHandle from './bottom-sheet-handle.react.js'; @@ -19,7 +17,7 @@ function ForwardedBottomSheet( props: Props, - ref: ReactRefSetter, + ref: React.RefSetter, ): React.Node { const { children, onClosed } = props; diff --git a/native/chat/chat-tab-bar.react.js b/native/chat/chat-tab-bar.react.js --- a/native/chat/chat-tab-bar.react.js +++ b/native/chat/chat-tab-bar.react.js @@ -12,8 +12,6 @@ import type { MeasureOnSuccessCallback } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import { TabBarItem } from 'react-native-tab-view'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import { nuxTip, NUXTipsContext, @@ -35,7 +33,7 @@ invariant(tipsContext, 'NUXTipsContext should be defined'); const { registerTipButton } = tipsContext; - const registerRef: ReactRefSetter> = + const registerRef: React.RefSetter> = React.useCallback( element => { const tipType = ButtonTitleToTip[props.route.name]; diff --git a/native/chat/chat-thread-list-search.react.js b/native/chat/chat-thread-list-search.react.js --- a/native/chat/chat-thread-list-search.react.js +++ b/native/chat/chat-thread-list-search.react.js @@ -10,8 +10,6 @@ type SharedValue, } from 'react-native-reanimated'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import type { SearchStatus } from './chat-thread-list.react.js'; import Button from '../components/button.react.js'; import Search from '../components/search.react.js'; @@ -31,7 +29,7 @@ }; function ForwardedChatThreadListSearch( props: Props, - ref: ReactRefSetter>, + ref: React.RefSetter>, ): React.Node { const { searchText, diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js --- a/native/chat/chat.react.js +++ b/native/chat/chat.react.js @@ -32,7 +32,6 @@ import { isLoggedIn } from 'lib/selectors/user-selectors.js'; import { threadSettingsNotificationsCopy } from 'lib/shared/thread-settings-notifications-utils.js'; import { threadIsPending, threadIsSidebar } from 'lib/shared/thread-utils.js'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; import BackgroundChatThreadList from './background-chat-thread-list.react.js'; import ChatHeader from './chat-header.react.js'; @@ -383,7 +382,7 @@ invariant(tipsContext, 'NUXTipsContext should be defined'); const { registerTipButton } = tipsContext; - const communityDrawerButtonRegisterRef: ReactRefSetter< + const communityDrawerButtonRegisterRef: React.RefSetter< React.ElementRef, > = React.useCallback( element => { diff --git a/native/components/gesture-touchable-opacity.react.js b/native/components/gesture-touchable-opacity.react.js --- a/native/components/gesture-touchable-opacity.react.js +++ b/native/components/gesture-touchable-opacity.react.js @@ -18,8 +18,6 @@ useAnimatedStyle, } from 'react-native-reanimated'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import type { AnimatedViewStyle, ViewStyle } from '../types/styles.js'; import { useSharedValueForBoolean } from '../utils/animation-utils.js'; @@ -48,7 +46,7 @@ }; function ForwardedGestureTouchableOpacity( props: Props, - ref: ReactRefSetter, + ref: React.RefSetter, ) { const { onPress: innerOnPress, onLongPress: innerOnLongPress } = props; const onPress = React.useCallback(() => { diff --git a/native/components/search.react.js b/native/components/search.react.js --- a/native/components/search.react.js +++ b/native/components/search.react.js @@ -10,7 +10,6 @@ } from 'react-native'; import { isLoggedIn } from 'lib/selectors/user-selectors.js'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; import SWMansionIcon from './swmansion-icon.react.js'; import TextInput from './text-input.react.js'; @@ -28,7 +27,7 @@ function ForwardedSearch( props: Props, - ref: ReactRefSetter>, + ref: React.RefSetter>, ) { const { onChangeText, searchText, containerStyle, active, ...rest } = props; diff --git a/native/components/selectable-text-input.react.ios.js b/native/components/selectable-text-input.react.ios.js --- a/native/components/selectable-text-input.react.ios.js +++ b/native/components/selectable-text-input.react.ios.js @@ -4,7 +4,6 @@ import * as React from 'react'; import type { Selection } from 'lib/shared/mention-utils.js'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; // eslint-disable-next-line import/extensions import ClearableTextInput from './clearable-text-input.react'; @@ -16,7 +15,7 @@ const SelectableTextInput = React.forwardRef(function BaseSelectableTextInput( props: SelectableTextInputProps, - ref: ReactRefSetter, + ref: React.RefSetter, ): React.Node { const { clearableTextInputRef, diff --git a/native/components/selectable-text-input.react.js b/native/components/selectable-text-input.react.js --- a/native/components/selectable-text-input.react.js +++ b/native/components/selectable-text-input.react.js @@ -2,8 +2,6 @@ import * as React from 'react'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - // eslint-disable-next-line import/extensions import ClearableTextInput from './clearable-text-input.react'; import type { @@ -14,7 +12,7 @@ const SelectableTextInput = React.forwardRef(function BaseSelectableTextInput( props: SelectableTextInputProps, - ref: ReactRefSetter, + ref: React.RefSetter, ): React.Node { const { clearableTextInputRef, diff --git a/native/components/tag-input.react.js b/native/components/tag-input.react.js --- a/native/components/tag-input.react.js +++ b/native/components/tag-input.react.js @@ -13,8 +13,6 @@ Platform, } from 'react-native'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import TextInput from './text-input.react.js'; import { useSelector } from '../redux/redux-utils.js'; import { useColors, type Colors } from '../themes/colors.js'; @@ -460,7 +458,7 @@ return React.forwardRef, BaseTagInput>( function ForwardedTagInput( props: BaseConfig, - ref: ReactRefSetter>, + ref: React.RefSetter>, ) { const windowWidth = useSelector(state => state.dimensions.width); const colors = useColors(); diff --git a/native/components/text-input.react.js b/native/components/text-input.react.js --- a/native/components/text-input.react.js +++ b/native/components/text-input.react.js @@ -3,14 +3,12 @@ import * as React from 'react'; import { TextInput } from 'react-native'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; - import { useKeyboardAppearance } from '../themes/colors.js'; type Props = React.ElementConfig; function ForwardedTextInput( props: Props, - ref: ReactRefSetter>, + ref: React.RefSetter>, ): React.Node { const keyboardAppearance = useKeyboardAppearance(); return ( 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,7 +5,6 @@ import SWMansionIcon, { type Icon, } from 'lib/components/swmansion-icon.react.js'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; import css from './password-input.css'; import Button from '../components/button.react.js'; @@ -15,7 +14,7 @@ function PasswordInput( props: PasswordInputProps, - ref: ReactRefSetter, + ref: React.RefSetter, ): 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 @@ -4,7 +4,6 @@ import * as React from 'react'; import SWMansionIcon from 'lib/components/swmansion-icon.react.js'; -import type { ReactRefSetter } from 'lib/types/react-types.js'; import ClearSearchButton from './clear-search-button.react.js'; import css from './search.css'; @@ -19,7 +18,7 @@ function Search( props: Props, - ref: ReactRefSetter, + ref: React.RefSetter, ): React.Node { const { searchText, onChangeText, placeholder, onClearText, ...rest } = props; 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,8 +3,6 @@ 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 = { @@ -26,7 +24,7 @@ function Input( props: InputProps, - ref: ReactRefSetter, + ref: React.RefSetter, ): React.Node { const { label: labelProp,