Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32178520
D15046.1765070699.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
17 KB
Referenced Files
None
Subscribers
None
D15046.1765070699.diff
View Options
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
@@ -86,10 +86,15 @@
},
};
-const RegistrationTextInput: React.ComponentType<Props> = React.forwardRef<
- Props,
- React.ElementRef<typeof TextInput>,
->(ForwardedRegistrationTextInput);
+type RegistrationTextInputComponentType = component(
+ ref: React.RefSetter<React.ElementRef<typeof TextInput>>,
+ ...Props
+);
+
+const RegistrationTextInput: RegistrationTextInputComponentType =
+ React.forwardRef<Props, React.ElementRef<typeof TextInput>>(
+ ForwardedRegistrationTextInput,
+ );
RegistrationTextInput.displayName = 'RegistrationTextInput';
const MemoizedRegistrationTextInput: typeof RegistrationTextInput = React.memo<
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
@@ -9,6 +9,7 @@
import BottomSheetHandle from './bottom-sheet-handle.react.js';
import { BottomSheetContext } from './bottom-sheet-provider.react.js';
import { useStyles } from '../themes/colors.js';
+import type { BottomSheetRef } from '../types/bottom-sheet.js';
type Props = {
+children: React.Node,
@@ -63,7 +64,12 @@
},
};
-const BottomSheet: React.ComponentType<Props> = React.forwardRef<
+type BottomSheetComponentType = component(
+ ref: React.RefSetter<BottomSheetRef>,
+ ...Props
+);
+
+const BottomSheet: BottomSheetComponentType = React.forwardRef<
Props,
React.ElementRef<typeof GorhomBottomSheet>,
>(ForwardedBottomSheet);
diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js
--- a/native/chat/chat-input-bar.react.js
+++ b/native/chat/chat-input-bar.react.js
@@ -79,7 +79,10 @@
import Button from '../components/button.react.js';
// eslint-disable-next-line import/extensions
import ClearableTextInput from '../components/clearable-text-input.react';
-import type { SyncedSelectionData } from '../components/selectable-text-input.js';
+import type {
+ SyncedSelectionData,
+ SelectableTextInputRef,
+} from '../components/selectable-text-input.js';
// eslint-disable-next-line import/extensions
import SelectableTextInput from '../components/selectable-text-input.react';
import SingleLine from '../components/single-line.react.js';
@@ -500,8 +503,7 @@
const textInputRef = React.useRef<?React.ElementRef<typeof TextInput>>();
const clearableTextInputRef = React.useRef<?ClearableTextInput>();
- const selectableTextInputRef =
- React.useRef<?React.ElementRef<typeof SelectableTextInput>>();
+ const selectableTextInputRef = React.useRef<?SelectableTextInputRef>();
const setTextInputRef = React.useCallback(
(ref: ?React.ElementRef<typeof TextInput>) => {
textInputRef.current = ref;
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
@@ -154,10 +154,15 @@
},
};
-const ChatThreadListSearch: React.ComponentType<Props> = React.forwardRef<
- Props,
- React.ElementRef<typeof BaseTextInput>,
->(ForwardedChatThreadListSearch);
+type ChatThreadListSearchComponentType = component(
+ ref: React.RefSetter<React.ElementRef<typeof BaseTextInput>>,
+ ...Props
+);
+
+const ChatThreadListSearch: ChatThreadListSearchComponentType =
+ React.forwardRef<Props, React.ElementRef<typeof BaseTextInput>>(
+ ForwardedChatThreadListSearch,
+ );
ChatThreadListSearch.displayName = 'ChatThreadListSearch';
export default ChatThreadListSearch;
diff --git a/native/components/directory-prompt-bottom-sheet.react.js b/native/components/directory-prompt-bottom-sheet.react.js
--- a/native/components/directory-prompt-bottom-sheet.react.js
+++ b/native/components/directory-prompt-bottom-sheet.react.js
@@ -18,6 +18,7 @@
type NavigationRoute,
NUXTipOverlayBackdropRouteName,
} from '../navigation/route-names.js';
+import type { BottomSheetRef } from '../types/bottom-sheet.js';
export type DirectoryPromptBottomSheetParams = {
+communities: $ReadOnlyArray<ClientCommunityInfoWithCommunityName>,
@@ -39,7 +40,7 @@
const { goBack, navigate } = navigation;
const { communities } = route.params;
- const bottomSheetRef = React.useRef(null);
+ const bottomSheetRef = React.useRef<?BottomSheetRef>(null);
const bottomSheetContext = React.useContext(BottomSheetContext);
invariant(bottomSheetContext, 'bottomSheetContext should be set');
diff --git a/native/components/full-screen-view-modal.react.js b/native/components/full-screen-view-modal.react.js
--- a/native/components/full-screen-view-modal.react.js
+++ b/native/components/full-screen-view-modal.react.js
@@ -9,6 +9,7 @@
TouchableOpacity,
Platform,
} from 'react-native';
+import type { LegacyHostInstanceMethods } from 'react-native/src/private/types/HostInstance';
import {
type PinchGestureEvent,
type PanGestureEvent,
@@ -44,7 +45,6 @@
import type { NavigationRoute } from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { derivedDimensionsInfoSelector } from '../selectors/dimensions-selectors.js';
-import type { NativeMethods } from '../types/react-native.js';
import type { UserProfileBottomSheetNavigationProp } from '../user-profile/user-profile-bottom-sheet-navigator.react.js';
import { clamp } from '../utils/animation-utils.js';
@@ -55,10 +55,6 @@
const decayConfig = { deceleration: 0.99 };
-type TouchableOpacityInstance = React.ComponentType<
- React.ElementConfig<typeof TouchableOpacity>,
->;
-
type ButtonDimensions = {
+x: number,
+y: number,
@@ -129,7 +125,7 @@
);
const closeButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ React.useRef<?React.ElementRef<typeof TouchableOpacity>>();
const mediaIconsRef = React.useRef<?React.ElementRef<typeof View>>();
const closeButtonDimensions = useSharedValue({
@@ -154,9 +150,11 @@
if (!closeButton) {
return;
}
- closeButton.measure((x, y, width, height, pageX, pageY) => {
- closeButtonDimensions.value = { x: pageX, y: pageY, width, height };
- });
+ ((closeButton: any): LegacyHostInstanceMethods).measure(
+ (x, y, width, height, pageX, pageY) => {
+ closeButtonDimensions.value = { x: pageX, y: pageY, width, height };
+ },
+ );
}, [closeButtonDimensions]);
const onMediaIconsLayout = React.useCallback(() => {
@@ -165,9 +163,11 @@
return;
}
- mediaIconsContainer.measure((x, y, width, height, pageX, pageY) => {
- mediaIconsDimensions.value = { x: pageX, y: pageY, width, height };
- });
+ ((mediaIconsContainer: any): LegacyHostInstanceMethods).measure(
+ (x, y, width, height, pageX, pageY) => {
+ mediaIconsDimensions.value = { x: pageX, y: pageY, width, height };
+ },
+ );
}, [mediaIconsDimensions]);
const insets = useSafeAreaInsets();
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
@@ -102,10 +102,14 @@
);
}
-const Search: React.ComponentType<Props> = React.forwardRef<
- Props,
- React.ElementRef<typeof BaseTextInput>,
->(ForwardedSearch);
+type SearchComponentType = component(
+ ref: React.RefSetter<React.ElementRef<typeof BaseTextInput>>,
+ ...Props
+);
+
+const Search = React.forwardRef<Props, React.ElementRef<typeof BaseTextInput>>(
+ ForwardedSearch,
+);
Search.displayName = 'Search';
const unboundStyles = {
@@ -138,7 +142,7 @@
},
};
-const MemoizedSearch: typeof Search = React.memo<
+const MemoizedSearch: SearchComponentType = React.memo<
Props,
React.ElementRef<typeof BaseTextInput>,
>(Search);
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
@@ -131,7 +131,12 @@
);
});
-const MemoizedSelectableTextInput: React.ComponentType<SelectableTextInputProps> =
+type MemoizedSelectableTextInputComponent = component(
+ ref: React.RefSetter<SelectableTextInputRef>,
+ ...SelectableTextInputProps
+);
+
+const MemoizedSelectableTextInput: MemoizedSelectableTextInputComponent =
React.memo<SelectableTextInputProps, SelectableTextInputRef>(
SelectableTextInput,
);
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
@@ -76,7 +76,12 @@
);
});
-const MemoizedSelectableTextInput: React.ComponentType<SelectableTextInputProps> =
+type MemoizedSelectableTextInputComponent = component(
+ ref: React.RefSetter<SelectableTextInputRef>,
+ ...SelectableTextInputProps
+);
+
+const MemoizedSelectableTextInput: MemoizedSelectableTextInputComponent =
React.memo<SelectableTextInputProps, SelectableTextInputRef>(
SelectableTextInput,
);
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
@@ -459,7 +459,12 @@
typeof BaseTagInput.defaultProps,
>;
-function createTagInput<T>(): React.ComponentType<BaseConfig<T>> {
+type TagInputComponentType<T> = component(
+ ref: React.RefSetter<BaseTagInput<T>>,
+ ...BaseConfig<T>
+);
+
+function createTagInput<T>(): TagInputComponentType<T> {
return React.forwardRef<BaseConfig<T>, BaseTagInput<T>>(
function ForwardedTagInput(
props: BaseConfig<T>,
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
@@ -16,7 +16,12 @@
);
}
-const WrappedTextInput: React.ComponentType<Props> = React.forwardRef<
+type WrappedTextInputComponentType = component(
+ ref: React.RefSetter<React.ElementRef<typeof TextInput>>,
+ ...Props
+);
+
+const WrappedTextInput: WrappedTextInputComponentType = React.forwardRef<
Props,
React.ElementRef<typeof TextInput>,
>(ForwardedTextInput);
diff --git a/native/media/camera-modal.react.js b/native/media/camera-modal.react.js
--- a/native/media/camera-modal.react.js
+++ b/native/media/camera-modal.react.js
@@ -13,6 +13,7 @@
Animated,
Easing,
} from 'react-native';
+import type { LegacyHostInstanceMethods } from 'react-native/src/private/types/HostInstance';
import filesystem from 'react-native-fs';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import Orientation from 'react-native-orientation-locker';
@@ -94,10 +95,6 @@
} catch (e) {}
}
-type TouchableOpacityInstance = React.ComponentType<
- React.ElementConfig<typeof TouchableOpacity>,
->;
-
type Dimensions = {
+x: number,
+y: number,
@@ -441,7 +438,7 @@
}, []);
const closeButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ React.useRef<?React.ElementRef<typeof TouchableOpacity>>();
const closeButtonDimensions = useSharedValue({
x: -1,
y: -1,
@@ -450,7 +447,7 @@
});
const photoButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ React.useRef<?React.ElementRef<typeof TouchableOpacity>>();
const photoButtonDimensions = useSharedValue({
x: -1,
y: -1,
@@ -459,7 +456,7 @@
});
const switchCameraButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ React.useRef<?React.ElementRef<typeof TouchableOpacity>>();
const switchCameraButtonDimensions = useSharedValue({
x: -1,
y: -1,
@@ -468,7 +465,7 @@
});
const flashButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ React.useRef<?React.ElementRef<typeof TouchableOpacity>>();
const flashButtonDimensions = useSharedValue({
x: -1,
y: -1,
@@ -480,25 +477,29 @@
if (!closeButtonRef.current) {
return;
}
- closeButtonRef.current.measure((x, y, width, height, pageX, pageY) => {
- closeButtonDimensions.value = { x: pageX, y: pageY, width, height };
- });
+ ((closeButtonRef.current: any): LegacyHostInstanceMethods).measure(
+ (x, y, width, height, pageX, pageY) => {
+ closeButtonDimensions.value = { x: pageX, y: pageY, width, height };
+ },
+ );
}, [closeButtonDimensions]);
const onPhotoButtonLayout = React.useCallback(() => {
if (!photoButtonRef.current) {
return;
}
- photoButtonRef.current.measure((x, y, width, height, pageX, pageY) => {
- photoButtonDimensions.value = { x: pageX, y: pageY, width, height };
- });
+ ((photoButtonRef.current: any): LegacyHostInstanceMethods).measure(
+ (x, y, width, height, pageX, pageY) => {
+ photoButtonDimensions.value = { x: pageX, y: pageY, width, height };
+ },
+ );
}, [photoButtonDimensions]);
const onSwitchCameraButtonLayout = React.useCallback(() => {
if (!switchCameraButtonRef.current) {
return;
}
- switchCameraButtonRef.current.measure(
+ ((switchCameraButtonRef.current: any): LegacyHostInstanceMethods).measure(
(x, y, width, height, pageX, pageY) => {
switchCameraButtonDimensions.value = {
x: pageX,
@@ -525,9 +526,11 @@
if (!flashButtonRef.current) {
return;
}
- flashButtonRef.current.measure((x, y, width, height, pageX, pageY) => {
- flashButtonDimensions.value = { x: pageX, y: pageY, width, height };
- });
+ ((flashButtonRef.current: any): LegacyHostInstanceMethods).measure(
+ (x, y, width, height, pageX, pageY) => {
+ flashButtonDimensions.value = { x: pageX, y: pageY, width, height };
+ },
+ );
}, [flashButtonDimensions]);
const insets = useSafeAreaInsets();
diff --git a/native/media/video-playback-modal.react.js b/native/media/video-playback-modal.react.js
--- a/native/media/video-playback-modal.react.js
+++ b/native/media/video-playback-modal.react.js
@@ -40,11 +40,6 @@
VerticalBounds,
LayoutCoordinates,
} from '../types/layout-types.js';
-import type { NativeMethods } from '../types/react-native.js';
-
-type TouchableOpacityInstance = React.ComponentType<
- React.ElementConfig<typeof TouchableOpacity>,
->;
type VideoRef = {
+seek: number => mixed,
@@ -134,8 +129,7 @@
const closeButtonY = useSharedValue(-1);
const closeButtonWidth = useSharedValue(-1);
const closeButtonHeight = useSharedValue(-1);
- const closeButtonRef =
- React.useRef<?React.ElementRef<TouchableOpacityInstance>>();
+ const closeButtonRef = React.useRef<?React.ElementRef<typeof View>>();
const closeButton = closeButtonRef.current;
const onCloseButtonLayoutCalledRef = React.useRef(false);
const onCloseButtonLayout = React.useCallback(() => {
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
@@ -41,8 +41,12 @@
</div>
);
}
+type ForwardedPasswordInputComponentType = component(
+ ref: React.RefSetter<HTMLInputElement>,
+ ...PasswordInputProps
+);
-const ForwardedPasswordInput: React.ComponentType<PasswordInputProps> =
+const ForwardedPasswordInput: ForwardedPasswordInputComponentType =
React.forwardRef<PasswordInputProps, HTMLInputElement>(PasswordInput);
export default ForwardedPasswordInput;
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
@@ -58,7 +58,12 @@
);
}
-const ForwardedSearch: React.ComponentType<Props> = React.forwardRef<
+type ForwardedSearchComponentType = component(
+ ref: React.RefSetter<HTMLInputElement>,
+ ...Props
+);
+
+const ForwardedSearch: ForwardedSearchComponentType = React.forwardRef<
Props,
HTMLInputElement,
>(Search);
diff --git a/web/media/loadable-video.react.js b/web/media/loadable-video.react.js
--- a/web/media/loadable-video.react.js
+++ b/web/media/loadable-video.react.js
@@ -23,7 +23,10 @@
+multimediaClassName?: string,
};
-function LoadableVideo(props: Props, videoRef: React.Ref<'video'>): React.Node {
+function LoadableVideo(
+ props: Props,
+ videoRef: React.RefSetter<HTMLVideoElement>,
+): React.Node {
const {
uri,
thumbHashDataURL,
@@ -97,7 +100,12 @@
);
}
-const MemoizedLoadableVideo: React.ComponentType<Props> = React.memo<
+type MemoizedLoadableVideoComponentType = component(
+ ref: React.RefSetter<HTMLVideoElement>,
+ ...Props
+);
+
+const MemoizedLoadableVideo: MemoizedLoadableVideoComponentType = React.memo<
Props,
HTMLVideoElement,
>(React.forwardRef<Props, HTMLVideoElement>(LoadableVideo));
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
@@ -59,7 +59,12 @@
);
}
-const ForwardedInput: React.ComponentType<InputProps> = React.forwardRef<
+type ForwardedInputComponentType = component(
+ ref: React.RefSetter<HTMLInputElement>,
+ ...InputProps
+);
+
+const ForwardedInput: ForwardedInputComponentType = React.forwardRef<
InputProps,
HTMLInputElement,
>(Input);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 1:24 AM (20 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841951
Default Alt Text
D15046.1765070699.diff (17 KB)
Attached To
Mode
D15046: [Flow262][skip-ci] Fix React refs
Attached
Detach File
Event Timeline
Log In to Comment