From 5cdb3984dfbe1c2ff28a304b2a58f0149b4f0f3b Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Sat, 23 May 2026 11:00:44 -0700 Subject: [PATCH] Add *Instance type exports for all built-in components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Add a publicly exported `*Instance` type for every built-in component in `index.js.flow`, giving consumers a consistent way to type refs for any React Native component. Affects the Strict TypeScript API (opt-in generated TS types) only. #### Motivation + RFC NOTE: Draft implementation for the recommended approach in https://github.com/react-native-community/discussions-and-proposals/pull/1003. Alternative to https://github.com/facebook/react-native/pull/56673. #### New types | Component | Instance Type | Type Value | |---|---|---| | `ActivityIndicator` | `ActivityIndicatorInstance` | `HostInstance` | | `Button` | `ButtonInstance` | `ButtonRef` (platform-dependent) | | `DrawerLayoutAndroid` | `DrawerLayoutAndroidInstance` | `DrawerLayoutAndroidMethods` | | `FlatList` | `FlatListInstance` | `FlatList<>` | | `Image` | `ImageInstance` | `HostInstance` | | `ImageBackground` | `ImageBackgroundInstance` | `ImageBackground` (class) | | `KeyboardAvoidingView` | `KeyboardAvoidingViewInstance` | `KeyboardAvoidingView` (class) | | `Modal` | `ModalInstance` | `HostInstance` | | `Pressable` | `PressableInstance` | `HostInstance` | | `ProgressBarAndroid` | `ProgressBarAndroidInstance` | `HostInstance` | | `RefreshControl` | `RefreshControlInstance` | `RefreshControl` (class) | | `SafeAreaView` | `SafeAreaViewInstance` | `HostInstance` | | `ScrollView` | `ScrollViewInstance` | `extends HostInstance, ScrollViewImperativeMethods` | | `SectionList` | `SectionListInstance` | `SectionList<>` | | `StatusBar` | `StatusBarInstance` | `StatusBar` (class) | | `Switch` | `SwitchInstance` | `HostInstance` | | `Text` | `TextInstance` | `HostInstance` | | `TextInput` | `TextInputInstance` | `extends ReactNativeElement` (existing) | | `TouchableHighlight` | `TouchableHighlightInstance` | `HostInstance` | | `TouchableNativeFeedback` | `TouchableNativeFeedbackInstance` | `TouchableNativeFeedback` (class) | | `TouchableOpacity` | `TouchableOpacityInstance` | `HostInstance` | | `View` | `ViewInstance` | `HostInstance` | | `VirtualizedList` | `VirtualizedListInstance` | `React.ElementRef` | | `VirtualizedSectionList` | `VirtualizedSectionListInstance` | `React.ElementRef` | #### Renames - `PublicScrollViewInstance` → `ScrollViewInstance` (old name kept as deprecated alias; internal usages in `ScrollView.js` and `FlatList.js` updated) - `PublicModalInstance` → `ModalInstance` (old name kept as deprecated alias) #### Skipped (no ref support) `InputAccessoryView`, `experimental_LayoutConformance`, `TouchableWithoutFeedback`, `Touchable` (namespace) Changelog: [General][Added] - **Strict TypeScript API**: Add `*Instance` ref types for all built-in components Differential Revision: D106144383 --- .../ActivityIndicator/ActivityIndicator.js | 3 + .../Libraries/Components/Button.js | 2 + .../DrawerLayoutAndroid.android.js | 2 + .../DrawerAndroid/DrawerLayoutAndroid.ios.js | 2 + .../DrawerAndroid/DrawerLayoutAndroidTypes.js | 2 + .../Keyboard/KeyboardAvoidingView.js | 2 + .../Components/Pressable/Pressable.js | 3 + .../ProgressBarAndroid.android.js | 3 + .../ProgressBarAndroid/ProgressBarAndroid.js | 3 + .../RefreshControl/RefreshControl.js | 2 + .../Components/SafeAreaView/SafeAreaView.js | 3 + .../Components/ScrollView/ScrollView.js | 46 ++++----- .../Components/StatusBar/StatusBar.js | 2 + .../Libraries/Components/Switch/Switch.js | 3 + .../Components/TextInput/TextInput.js | 1 + .../Touchable/TouchableHighlight.js | 3 + .../Touchable/TouchableNativeFeedback.js | 2 + .../Components/Touchable/TouchableOpacity.js | 3 + .../Libraries/Components/View/View.js | 3 + .../Libraries/Image/Image.android.js | 2 + .../react-native/Libraries/Image/Image.ios.js | 2 + .../Libraries/Image/ImageBackground.js | 2 + .../Libraries/Image/ImageTypes.flow.js | 2 + .../react-native/Libraries/Lists/FlatList.js | 6 +- .../Libraries/Lists/SectionList.js | 2 + .../Libraries/Lists/VirtualizedList.js | 3 + .../Libraries/Lists/VirtualizedSectionList.js | 4 + .../react-native/Libraries/Modal/Modal.js | 5 +- packages/react-native/Libraries/Text/Text.js | 3 + packages/react-native/ReactNativeApi.d.ts | 97 ++++++++++++++----- packages/react-native/index.js.flow | 53 ++++++++-- 31 files changed, 210 insertions(+), 61 deletions(-) diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 28bc1886ee00..d2d079c1891d 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -10,8 +10,11 @@ 'use strict'; import type {HostComponent} from '../../../src/private/types/HostComponent'; +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from '../View/ViewPropTypes'; +export type ActivityIndicatorInstance = HostInstance; + import StyleSheet, {type ColorValue} from '../../StyleSheet/StyleSheet'; import Platform from '../../Utilities/Platform'; import View from '../View/View'; diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 40a926d8ac15..f8aa7ea3e891 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -286,6 +286,8 @@ const NativeTouchable: type ButtonRef = React.ElementRef; +export type ButtonInstance = ButtonRef; + const Button: component( ref?: React.RefSetter, ...props: ButtonProps diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index bde8466c0b8d..64bf5165c524 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -302,4 +302,6 @@ const styles = StyleSheet.create({ }, }); +export type DrawerLayoutAndroidInstance = DrawerLayoutAndroid; + export default DrawerLayoutAndroid as $FlowFixMe; diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js index cfaf89fea761..4d70f35bfac5 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js @@ -12,4 +12,6 @@ import DrawerLayoutAndroidFallback from './DrawerLayoutAndroidFallback'; +export type DrawerLayoutAndroidInstance = DrawerLayoutAndroidFallback; + export default DrawerLayoutAndroidFallback; diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js index e100c6006eed..26cc85563a2d 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js @@ -136,3 +136,5 @@ export interface DrawerLayoutAndroidMethods { ): void; setNativeProps(nativeProps: Object): void; } + +export type DrawerLayoutAndroidInstance = DrawerLayoutAndroidMethods; diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 5a829fc9d457..87ac6de0665a 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -298,4 +298,6 @@ class KeyboardAvoidingView extends React.Component< } } +export type KeyboardAvoidingViewInstance = KeyboardAvoidingView; + export default KeyboardAvoidingView; diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index a1fd57921ee3..bb631c321c2a 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -8,6 +8,7 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import type { GestureResponderEvent, @@ -16,6 +17,8 @@ import type { } from '../../Types/CoreEventTypes'; import type {ViewProps} from '../View/ViewPropTypes'; +export type PressableInstance = HostInstance; + import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import usePressability from '../../Pressability/usePressability'; import {type RectOrSize} from '../../StyleSheet/Rect'; diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index aadcb2aee3ec..3c5f0e68e98a 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -8,10 +8,13 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes'; import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeComponent'; +export type ProgressBarAndroidInstance = HostInstance; + const React = require('react'); export type {ProgressBarAndroidProps}; diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js index 447327cb6695..9a509e467862 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js @@ -10,11 +10,14 @@ 'use strict'; +import type {HostInstance} from '../../../src/private/types/HostInstance'; import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent'; import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes'; import Platform from '../../Utilities/Platform'; +export type ProgressBarAndroidInstance = HostInstance; + export type {ProgressBarAndroidProps}; // A utility type to preserve the semantics of the union uses in the definition diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 184fcb9eb3f5..57e75e1b4df0 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -205,4 +205,6 @@ class RefreshControl extends React.Component { }; } +export type RefreshControlInstance = RefreshControl; + export default RefreshControl; diff --git a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js index 34097b8ea3b4..1dd49d3afd88 100644 --- a/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -8,8 +8,11 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from '../View/ViewPropTypes'; +export type SafeAreaViewInstance = HostInstance; + import Platform from '../../Utilities/Platform'; import View from '../View/View'; import * as React from 'react'; diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index 1911429065ba..4f3a4fe3bb8f 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -139,7 +139,7 @@ export interface ScrollViewImperativeMethods { readonly getScrollableNode: () => ?number; readonly getInnerViewNode: () => ?number; readonly getInnerViewRef: () => InnerViewInstance | null; - readonly getNativeScrollRef: () => PublicScrollViewInstance | null; + readonly getNativeScrollRef: () => ScrollViewInstance | null; readonly scrollTo: ( options?: ScrollViewScrollToOptions | number, deprecatedX?: number, @@ -167,10 +167,13 @@ export interface ScrollViewImperativeMethods { export type DecelerationRateType = 'fast' | 'normal' | number; export type ScrollResponderType = ScrollViewImperativeMethods; -export interface PublicScrollViewInstance +export interface ScrollViewInstance extends HostInstance, ScrollViewImperativeMethods {} +/** @deprecated Use ScrollViewInstance instead */ +export type PublicScrollViewInstance = ScrollViewInstance; + type InnerViewInstance = React.ElementRef; export type ScrollViewPropsIOS = Readonly<{ @@ -677,7 +680,7 @@ type ScrollViewBaseProps = Readonly<{ * all of ScrollView's public methods, in addition to native methods like * measure, measureLayout, etc. */ - scrollViewRef?: React.RefSetter, + scrollViewRef?: React.RefSetter, }>; /** @build-types emit-as-interface Nativewind compatibility */ @@ -874,7 +877,7 @@ class ScrollView extends React.Component { getNativeScrollRef: ScrollViewImperativeMethods['getNativeScrollRef'] = () => { // Object.assign in _scrollView's mutator augments nativeInstance in place, - // so it is already a PublicScrollViewInstance at runtime. + // so it is already a ScrollViewInstance at runtime. // $FlowFixMe[incompatible-type] return this._scrollView.nativeInstance; }; @@ -1170,7 +1173,7 @@ class ScrollView extends React.Component { (instance: InnerViewInstance): InnerViewInstance => instance, ); - _scrollView: RefForwarder = + _scrollView: RefForwarder = createRefForwarder(nativeInstance => { // This is a hack. Ideally we would forwardRef to the underlying // host component. However, since ScrollView has it's own methods that can be @@ -1183,22 +1186,19 @@ class ScrollView extends React.Component { // $FlowFixMe[prop-missing] - Known issue with appending custom methods. // $FlowFixMe[incompatible-type] // $FlowFixMe[unsafe-object-assign] - const publicInstance: PublicScrollViewInstance = Object.assign( - nativeInstance, - { - getScrollResponder: this.getScrollResponder, - getScrollableNode: this.getScrollableNode, - getInnerViewNode: this.getInnerViewNode, - getInnerViewRef: this.getInnerViewRef, - getNativeScrollRef: this.getNativeScrollRef, - scrollTo: this.scrollTo, - scrollToEnd: this.scrollToEnd, - flashScrollIndicators: this.flashScrollIndicators, - scrollResponderZoomTo: this.scrollResponderZoomTo, - scrollResponderScrollNativeHandleToKeyboard: - this.scrollResponderScrollNativeHandleToKeyboard, - }, - ); + const publicInstance: ScrollViewInstance = Object.assign(nativeInstance, { + getScrollResponder: this.getScrollResponder, + getScrollableNode: this.getScrollableNode, + getInnerViewNode: this.getInnerViewNode, + getInnerViewRef: this.getInnerViewRef, + getNativeScrollRef: this.getNativeScrollRef, + scrollTo: this.scrollTo, + scrollToEnd: this.scrollToEnd, + flashScrollIndicators: this.flashScrollIndicators, + scrollResponderZoomTo: this.scrollResponderZoomTo, + scrollResponderScrollNativeHandleToKeyboard: + this.scrollResponderScrollNativeHandleToKeyboard, + }); return publicInstance; }); @@ -1935,13 +1935,13 @@ function createRefForwarder( // component and we need to map `ref` to a differently named prop. This can be // removed when `ScrollView` is a functional component. const ScrollViewWrapper: component( - ref?: React.RefSetter, + ref?: React.RefSetter, ...props: ScrollViewProps ) = function Wrapper({ ref, ...props }: { - ref?: React.RefSetter, + ref?: React.RefSetter, ...ScrollViewProps, }): React.Node { return ref == null ? ( diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 5df3131bdcf0..5f63e0f03eb8 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -509,4 +509,6 @@ class StatusBar extends React.Component { } } +export type StatusBarInstance = StatusBar; + export default StatusBar; diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 790cf7716ff9..767d5e592270 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -8,11 +8,14 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ColorValue} from '../../StyleSheet/StyleSheet'; import type {NativeSyntheticEvent} from '../../Types/CoreEventTypes'; import type {AccessibilityState} from '../View/ViewAccessibility'; import type {ViewProps} from '../View/ViewPropTypes'; +export type SwitchInstance = HostInstance; + import StyleSheet from '../../StyleSheet/StyleSheet'; import Platform from '../../Utilities/Platform'; import useMergeRefs from '../../Utilities/useMergeRefs'; diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index adca4e337572..0206446c9262 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -117,6 +117,7 @@ export type { TextInputKeyPressEvent, TextInputProps, TextInputSelectionChangeEvent, + TextInputInstance, TextInputSubmitEditingEvent, }; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index 9dc8b606a0f4..ecd6f63204ba 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -8,10 +8,13 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ColorValue} from '../../StyleSheet/StyleSheet'; import type {AccessibilityState} from '../View/ViewAccessibility'; import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; +export type TouchableHighlightInstance = HostInstance; + import View from '../../Components/View/View'; import Pressability, { type PressabilityConfig, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index 31943e6f6781..ad3452621c02 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -409,4 +409,6 @@ const getBackgroundProp = TouchableNativeFeedback.displayName = 'TouchableNativeFeedback'; +export type TouchableNativeFeedbackInstance = TouchableNativeFeedback; + export default TouchableNativeFeedback; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 72d7ad49f2f9..852603410cb0 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -8,9 +8,12 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; +export type TouchableOpacityInstance = HostInstance; + import Animated from '../../Animated/Animated'; import Easing from '../../Animated/Easing'; import Pressability, { diff --git a/packages/react-native/Libraries/Components/View/View.js b/packages/react-native/Libraries/Components/View/View.js index c2486bde14a5..9bc8acab1e90 100644 --- a/packages/react-native/Libraries/Components/View/View.js +++ b/packages/react-native/Libraries/Components/View/View.js @@ -8,10 +8,13 @@ * @format */ +import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from './ViewPropTypes'; import TextAncestorContext from '../../Text/TextAncestorContext'; import ViewNativeComponent from './ViewNativeComponent'; + +export type ViewInstance = HostInstance; import * as React from 'react'; import {use} from 'react'; diff --git a/packages/react-native/Libraries/Image/Image.android.js b/packages/react-native/Libraries/Image/Image.android.js index 4ca519311030..da729075676f 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -14,6 +14,8 @@ import type {RootTag} from '../Types/RootTagTypes'; import type {ImageProps} from './ImageProps'; import type {AbstractImageAndroid, ImageAndroid} from './ImageTypes.flow'; +export type ImageInstance = HostInstance; + import flattenStyle from '../StyleSheet/flattenStyle'; import StyleSheet from '../StyleSheet/StyleSheet'; import ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; diff --git a/packages/react-native/Libraries/Image/Image.ios.js b/packages/react-native/Libraries/Image/Image.ios.js index 0580736dac42..6a41f4dccd5c 100644 --- a/packages/react-native/Libraries/Image/Image.ios.js +++ b/packages/react-native/Libraries/Image/Image.ios.js @@ -15,6 +15,8 @@ import type {ImageProps} from './ImageProps'; import type {AbstractImageIOS, ImageIOS} from './ImageTypes.flow'; import type {ImageSize} from './NativeImageLoaderAndroid'; +export type ImageInstance = HostInstance; + import {createRootTag} from '../ReactNative/RootTag'; import flattenStyle from '../StyleSheet/flattenStyle'; import StyleSheet from '../StyleSheet/StyleSheet'; diff --git a/packages/react-native/Libraries/Image/ImageBackground.js b/packages/react-native/Libraries/Image/ImageBackground.js index 26af42951df4..628c7cbebd4c 100644 --- a/packages/react-native/Libraries/Image/ImageBackground.js +++ b/packages/react-native/Libraries/Image/ImageBackground.js @@ -105,4 +105,6 @@ class ImageBackground extends React.Component { } } +export type ImageBackgroundInstance = ImageBackground; + export default ImageBackground; diff --git a/packages/react-native/Libraries/Image/ImageTypes.flow.js b/packages/react-native/Libraries/Image/ImageTypes.flow.js index 6058d6367bd7..24b6332889b6 100644 --- a/packages/react-native/Libraries/Image/ImageTypes.flow.js +++ b/packages/react-native/Libraries/Image/ImageTypes.flow.js @@ -10,6 +10,8 @@ import type {HostInstance} from '../..'; import type {RootTag} from '../Types/RootTagTypes'; + +export type ImageInstance = HostInstance; import type {ResolvedAssetSource} from './AssetSourceResolver'; import type {ImageProps as ImagePropsType} from './ImageProps'; import type {ImageSource} from './ImageSource'; diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 43256b3f79db..ff4563be2406 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -8,7 +8,7 @@ * @format */ -import type {PublicScrollViewInstance} from '../Components/ScrollView/ScrollView'; +import type {ScrollViewInstance} from '../Components/ScrollView/ScrollView'; import type {ViewStyleProp} from '../StyleSheet/StyleSheet'; import type { ListRenderItem, @@ -398,7 +398,7 @@ class FlatList extends React.PureComponent> { /** * Provides a reference to the underlying host component */ - getNativeScrollRef(): ?PublicScrollViewInstance { + getNativeScrollRef(): ?ScrollViewInstance { if (this._listRef) { return this._listRef.getScrollRef(); } @@ -706,4 +706,6 @@ const styles = StyleSheet.create({ row: {flexDirection: 'row'}, }); +export type FlatListInstance = FlatList<>; + export default FlatList; diff --git a/packages/react-native/Libraries/Lists/SectionList.js b/packages/react-native/Libraries/Lists/SectionList.js index 27bd227006b2..489a5c932368 100644 --- a/packages/react-native/Libraries/Lists/SectionList.js +++ b/packages/react-native/Libraries/Lists/SectionList.js @@ -265,3 +265,5 @@ export default class SectionList< this._wrapperListRef = ref; }; } + +export type SectionListInstance = SectionList<>; diff --git a/packages/react-native/Libraries/Lists/VirtualizedList.js b/packages/react-native/Libraries/Lists/VirtualizedList.js index df18a2742993..b095a35ffafd 100644 --- a/packages/react-native/Libraries/Lists/VirtualizedList.js +++ b/packages/react-native/Libraries/Lists/VirtualizedList.js @@ -11,11 +11,14 @@ 'use strict'; import VirtualizedLists from '@react-native/virtualized-lists'; +import * as React from 'react'; type VirtualizedListType = typeof VirtualizedLists.VirtualizedList; const VirtualizedListComponent: VirtualizedListType = VirtualizedLists.VirtualizedList; +export type VirtualizedListInstance = React.ElementRef; + export type { ListRenderItemInfo, ListRenderItem, diff --git a/packages/react-native/Libraries/Lists/VirtualizedSectionList.js b/packages/react-native/Libraries/Lists/VirtualizedSectionList.js index a4ea79b997b7..a8b9799b18c1 100644 --- a/packages/react-native/Libraries/Lists/VirtualizedSectionList.js +++ b/packages/react-native/Libraries/Lists/VirtualizedSectionList.js @@ -11,12 +11,16 @@ 'use strict'; import VirtualizedLists from '@react-native/virtualized-lists'; +import * as React from 'react'; type VirtualizedSectionListType = typeof VirtualizedLists.VirtualizedSectionList; const VirtualizedSectionList: VirtualizedSectionListType = VirtualizedLists.VirtualizedSectionList; +export type VirtualizedSectionListInstance = + React.ElementRef; + export type { SectionBase, ScrollToLocationParamsType, diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 80a652ff80c1..a4ac0e387c4e 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -36,7 +36,10 @@ type ModalEventDefinitions = { modalDismissed: [{modalID: number}], }; -export type PublicModalInstance = HostInstance; +export type ModalInstance = HostInstance; + +/** @deprecated Use ModalInstance instead */ +export type PublicModalInstance = ModalInstance; const ModalEventEmitter = Platform.OS === 'ios' && NativeModalManager != null diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index 8e7b29cb6096..204b231f4a17 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -8,12 +8,15 @@ * @format */ +import type {HostInstance} from '../../src/private/types/HostInstance'; import type {TextStyleProp} from '../StyleSheet/StyleSheet'; import type {____TextStyle_Internal as TextStyleInternal} from '../StyleSheet/StyleSheetTypes'; import type {GestureResponderEvent} from '../Types/CoreEventTypes'; import type {NativeTextProps} from './TextNativeComponent'; import type {PressRetentionOffset, TextProps} from './TextProps'; +export type TextInstance = HostInstance; + import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import * as PressabilityDebug from '../Pressability/PressabilityDebug'; import usePressability from '../Pressability/usePressability'; diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index abd52ddb4370..fb682da7fd11 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<08dd369849273136812ea5edbda6e1df>> + * @generated SignedSource<> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -401,7 +401,7 @@ declare const ScrollView: typeof ScrollViewWrapper & ScrollViewComponentStatics declare const ScrollViewContext_default: React.Context declare const ScrollViewWrapper: ( props: ScrollViewProps & { - ref?: React.Ref + ref?: React.Ref }, ) => React.ReactNode declare const sequence: typeof $$AnimatedImplementation.sequence @@ -1202,6 +1202,7 @@ declare type ActiveCallback = ( gestureState: PanResponderGestureState, ) => boolean declare type ActivityIndicator = typeof ActivityIndicator +declare type ActivityIndicatorInstance = HostInstance declare type ActivityIndicatorIOSProps = { readonly hidesWhenStopped?: boolean } @@ -1760,6 +1761,7 @@ declare type Builtin = ( ...$$REST$$: ReadonlyArray ) => Date | Error | RegExp | unknown declare type Button = typeof Button +declare type ButtonInstance = ButtonRef declare interface ButtonProps { readonly accessibilityActions?: ReadonlyArray readonly accessibilityHint?: string @@ -2097,6 +2099,7 @@ declare class DrawerLayoutAndroid_default render(): React.ReactNode setNativeProps(nativeProps: Object): void } +declare type DrawerLayoutAndroidInstance = DrawerLayoutAndroidMethods declare interface DrawerLayoutAndroidMethods { blur(): void closeDrawer(): void @@ -2330,7 +2333,7 @@ declare class FlatList extends React.PureComponent< componentDidUpdate(prevProps: FlatListProps): void constructor(props: FlatListProps) flashScrollIndicators(): void - getNativeScrollRef(): null | PublicScrollViewInstance | undefined + getNativeScrollRef(): null | ScrollViewInstance | undefined getScrollableNode(): any getScrollResponder(): null | ScrollResponderType | undefined recordInteraction(): void @@ -2360,6 +2363,7 @@ declare class FlatList extends React.PureComponent< } declare type FlatListBaseProps = RequiredFlatListProps & OptionalFlatListProps +declare type FlatListInstance = FlatList declare interface FlatListProps extends Readonly< Omit< @@ -2541,6 +2545,7 @@ declare class ImageBackground extends React.Component { render(): React.ReactNode setNativeProps(props: {}): void } +declare type ImageBackgroundInstance = ImageBackground declare interface ImageBackgroundProps extends Readonly> { readonly children?: React.ReactNode @@ -2591,6 +2596,7 @@ declare type ImageErrorEvent = NativeSyntheticEvent< declare type ImageErrorEventData = { error: string } +declare type ImageInstance = HostInstance declare type ImageIOS = AbstractImageIOS & ImageComponentStaticsIOS declare type ImageLoadEvent = NativeSyntheticEvent> declare type ImageLoadEventData = { @@ -2870,6 +2876,7 @@ declare class KeyboardAvoidingView extends React.Component< constructor(props: KeyboardAvoidingViewProps) render(): React.ReactNode } +declare type KeyboardAvoidingViewInstance = KeyboardAvoidingView declare interface KeyboardAvoidingViewProps extends Readonly { readonly behavior?: "height" | "padding" | "position" readonly contentContainerStyle?: ViewStyleProp @@ -3176,6 +3183,7 @@ declare interface ModalBaseProps { transparent?: boolean visible?: boolean } +declare type ModalInstance = HostInstance declare type ModalProps = ModalBaseProps & ModalPropsIOS & ModalPropsAndroid & @@ -3838,6 +3846,7 @@ declare type PressableBaseProps = { readonly testID?: string readonly testOnly_pressed?: boolean } +declare type PressableInstance = HostInstance declare interface PressableProps extends Readonly< Omit & PressableBaseProps @@ -3863,6 +3872,7 @@ declare type ProgressBarAndroidBaseProps = { readonly color?: ColorValue readonly testID?: string } +declare type ProgressBarAndroidInstance = HostInstance declare type ProgressBarAndroidNativeComponentType = typeof $$ProgressBarAndroidNativeComponent declare type ProgressBarAndroidProps = @@ -3880,13 +3890,10 @@ declare type PromiseTask = { name: string gen: () => Promise } -declare type PublicModalInstance = HostInstance +declare type PublicModalInstance = ModalInstance declare type PublicRootInstance = symbol & { __PublicRootInstance__: string } -declare interface PublicScrollViewInstance - extends HostInstance, - ScrollViewImperativeMethods {} declare type PublicTextInstance = ReturnType declare interface PushNotification { finish(result: string): void @@ -4173,6 +4180,7 @@ declare type RefreshControlBaseProps = { readonly progressViewOffset?: number readonly refreshing: boolean } +declare type RefreshControlInstance = RefreshControl declare interface RefreshControlProps extends Readonly< ViewProps & @@ -4405,6 +4413,7 @@ declare type Runnables = { [appKey: string]: Runnable } declare type SafeAreaView = typeof SafeAreaView +declare type SafeAreaViewInstance = HostInstance declare type ScaledSize = DisplayMetrics declare type ScheduleLocalNotificationDetails = PresentLocalNotificationDetails & { @@ -4450,7 +4459,7 @@ declare type ScrollViewBaseProps = { readonly removeClippedSubviews?: boolean readonly scrollEnabled?: boolean readonly scrollEventThrottle?: number - readonly scrollViewRef?: React.Ref + readonly scrollViewRef?: React.Ref readonly showsVerticalScrollIndicator?: boolean readonly snapToAlignment?: "center" | "end" | "start" readonly snapToEnd?: boolean @@ -4476,7 +4485,7 @@ declare interface ScrollViewImperativeMethods { readonly flashScrollIndicators: () => void readonly getInnerViewNode: () => number | undefined readonly getInnerViewRef: () => InnerViewInstance | null - readonly getNativeScrollRef: () => null | PublicScrollViewInstance + readonly getNativeScrollRef: () => null | ScrollViewInstance readonly getScrollableNode: () => number | undefined readonly getScrollResponder: () => ScrollResponderType readonly scrollResponderScrollNativeHandleToKeyboard: ( @@ -4503,6 +4512,9 @@ declare interface ScrollViewImperativeMethods { options?: ScrollViewScrollToOptions | undefined, ) => void } +declare interface ScrollViewInstance + extends HostInstance, + ScrollViewImperativeMethods {} declare interface ScrollViewProps extends Readonly< ViewProps & @@ -4610,6 +4622,7 @@ declare type SectionListData< | (Readonly> & SectionT) | (SectionBase & SectionT) | SectionT +declare type SectionListInstance = SectionList declare interface SectionListProps extends Readonly< Omit< @@ -4951,6 +4964,7 @@ declare type StatusBarBaseProps = { readonly barStyle?: "dark-content" | "default" | "light-content" readonly hidden?: boolean } +declare type StatusBarInstance = StatusBar declare type StatusBarProps = Readonly< StatusBarPropsAndroid & StatusBarPropsIOS & StatusBarBaseProps > @@ -5000,6 +5014,7 @@ declare type SwitchChangeEventData = { readonly target: number readonly value: boolean } +declare type SwitchInstance = HostInstance declare type SwitchNativeProps = Readonly< ViewProps & { disabled?: WithDefault @@ -5386,6 +5401,7 @@ declare type TextInputSubmitEditingEventData = Readonly< } > declare type TextInputType = InternalTextInput & TextInputComponentStatics +declare type TextInstance = HostInstance declare type TextLayoutEvent = NativeSyntheticEvent declare type TextLayoutEventData = { readonly lines: Array @@ -5477,6 +5493,7 @@ declare type TouchableHighlightBaseProps = { readonly testOnly_pressed?: boolean readonly underlayColor?: ColorValue } +declare type TouchableHighlightInstance = HostInstance declare interface TouchableHighlightProps extends Readonly< TouchableWithoutFeedbackProps & @@ -5520,6 +5537,7 @@ declare class TouchableNativeFeedback extends React.Component< componentWillUnmount(): void render(): React.ReactNode } +declare type TouchableNativeFeedbackInstance = TouchableNativeFeedback declare type TouchableNativeFeedbackProps = Readonly< TouchableWithoutFeedbackProps & TouchableNativeFeedbackTVProps & { @@ -5557,6 +5575,7 @@ declare type TouchableOpacityBaseProps = { readonly hostRef?: React.Ref> readonly style?: Animated.WithAnimatedValue } +declare type TouchableOpacityInstance = HostInstance declare type TouchableOpacityProps = Readonly< TouchableWithoutFeedbackProps & TouchableOpacityTVProps & @@ -5794,6 +5813,7 @@ declare type ViewConfig = { readonly uiViewClassName: string readonly validAttributes: AttributeConfiguration } +declare type ViewInstance = HostInstance declare interface ViewProps extends Readonly< DirectEventProps & @@ -5879,12 +5899,15 @@ declare function VirtualizedListContextResetter($$PARAM_0$$: { }): React.ReactNode declare type VirtualizedListContextResetterT = typeof VirtualizedListContextResetter +declare type VirtualizedListInstance = React.ComponentRef declare type VirtualizedListProps = ScrollViewProps & RequiredVirtualizedListProps & OptionalVirtualizedListProps declare type VirtualizedListT = typeof VirtualizedList_default declare type VirtualizedListType = typeof $$index.VirtualizedList declare type VirtualizedSectionList = typeof VirtualizedSectionList +declare type VirtualizedSectionListInstance = + React.ComponentRef declare type VirtualizedSectionListProps< ItemT, SectionT = DefaultVirtualizedSectionT, @@ -6000,6 +6023,7 @@ export { ActionSheetIOS, // b558559e ActionSheetIOSOptions, // 1756eb5a ActivityIndicator, // f06b0687 + ActivityIndicatorInstance, // 6ac360b7 ActivityIndicatorProps, // 5e976856 Alert, // 5bf12165 AlertButton, // bf1a3b60 @@ -6007,7 +6031,7 @@ export { AlertOptions, // a0cdac0f AlertType, // 5ab91217 AndroidKeyboardEvent, // e03becc8 - Animated, // 1a47480c + Animated, // dac556c2 AppConfig, // ce4209a7 AppRegistry, // 5edf0524 AppState, // 12012be5 @@ -6020,6 +6044,7 @@ export { BlurEvent, // e6151a1f BoxShadowValue, // b679703f Button, // 869e5a89 + ButtonInstance, // c02f61d2 ButtonProps, // 349967e6 Clipboard, // 41addb89 CodegenTypes, // 0b8108a8 @@ -6039,6 +6064,7 @@ export { DisplayMetrics, // 1dc35cef DisplayMetricsAndroid, // 872e62eb DrawerLayoutAndroid, // eb4bcfa5 + DrawerLayoutAndroidInstance, // c0694352 DrawerLayoutAndroidProps, // 1ddb208e DrawerSlideEvent, // 0256d35a DropShadowValue, // e9df2606 @@ -6054,8 +6080,9 @@ export { EventSubscription, // b8d084aa ExtendedExceptionData, // 5a6ccf5a FilterFunction, // bf24c0e3 - FlatList, // e47faa4e - FlatListProps, // 22cacca0 + FlatList, // f29e5bae + FlatListInstance, // d705d4fe + FlatListProps, // 9ac3710e FocusEvent, // 62fc1eb8 FontVariant, // 7c7558bb GestureResponderEvent, // f693e9a5 @@ -6069,8 +6096,10 @@ export { IgnorePattern, // ec6f6ece Image, // 1891541a ImageBackground, // cf95f60b + ImageBackgroundInstance, // 811a9a31 ImageBackgroundProps, // c68c896d ImageErrorEvent, // d3ee606e + ImageInstance, // 2c122c2d ImageLoadEvent, // 6b547ea5 ImageProgressEventIOS, // 4c866a82 ImageProps, // 801d1e1c @@ -6094,6 +6123,7 @@ export { KeyUpEvent, // bc6bd87b Keyboard, // 49414c97 KeyboardAvoidingView, // c8c29c8d + KeyboardAvoidingViewInstance, // 63a460fc KeyboardAvoidingViewProps, // 4114f649 KeyboardEvent, // c3f895d4 KeyboardEventEasing, // af4091c8 @@ -6119,9 +6149,10 @@ export { MeasureInWindowOnSuccessCallback, // a285f598 MeasureLayoutOnSuccessCallback, // 3592502a MeasureOnSuccessCallback, // 82824e59 - Modal, // bdd9bb3f - ModalBaseProps, // 3cca97dc - ModalProps, // aa4211df + Modal, // 37f44aff + ModalBaseProps, // 17e2ed28 + ModalInstance, // fbd32990 + ModalProps, // 32ff7e1c ModalPropsAndroid, // 515fb173 ModalPropsIOS, // 144bbc95 ModeChangeEvent, // a5e9864f @@ -6161,10 +6192,12 @@ export { PressabilityEventHandlers, // 3e6c0f56 Pressable, // 0241ba70 PressableAndroidRippleConfig, // ee32eaca + PressableInstance, // c93aef84 PressableProps, // a9048420 PressableStateCallbackType, // 9af36561 ProcessedColorValue, // 33f74304 ProgressBarAndroid, // 00fcd180 + ProgressBarAndroidInstance, // de8a2c3a ProgressBarAndroidProps, // f59f8f03 PromiseTask, // 5102c862 PublicRootInstance, // 8040afd7 @@ -6175,6 +6208,7 @@ export { Rationale, // 5df1b1c1 ReactNativeVersion, // abd76827 RefreshControl, // ed67a3b2 + RefreshControlInstance, // c502c711 RefreshControlProps, // bfc35644 RefreshControlPropsAndroid, // 99f64c97 RefreshControlPropsIOS, // 72a36381 @@ -6188,20 +6222,23 @@ export { Runnable, // 594dd93a Runnables, // 4367c557 SafeAreaView, // a7cd92bb + SafeAreaViewInstance, // a9027869 ScaledSize, // 07e417c7 ScrollEvent, // 5d529218 - ScrollResponderType, // 197f0107 + ScrollResponderType, // 190f136e ScrollToLocationParamsType, // d7ecdad1 - ScrollView, // 938178e6 - ScrollViewImperativeMethods, // 27f6b917 - ScrollViewProps, // d5d9f043 + ScrollView, // ba50902e + ScrollViewImperativeMethods, // ea8c81c5 + ScrollViewInstance, // e9ff1b20 + ScrollViewProps, // 038eaec5 ScrollViewPropsAndroid, // 44210553 ScrollViewPropsIOS, // b34b696c ScrollViewScrollToOptions, // 3313411e SectionBase, // b376bddc - SectionList, // 6b202d76 + SectionList, // 2a3caa23 SectionListData, // 119baf83 - SectionListProps, // 6bdbf0ef + SectionListInstance, // eb3accfa + SectionListProps, // 0c74fddf SectionListRenderItem, // 1fad0435 SectionListRenderItemInfo, // 745e1992 Separators, // 6a45f7e3 @@ -6215,6 +6252,7 @@ export { SimpleTask, // 0e619d11 StatusBar, // 5e08d563 StatusBarAnimation, // 7fd047e6 + StatusBarInstance, // 09bf1476 StatusBarProps, // 06c98add StatusBarStyle, // 986b2051 StyleProp, // fa0e9b4a @@ -6222,6 +6260,7 @@ export { SubmitBehavior, // c4ddf490 Switch, // 015be3f7 SwitchChangeEvent, // 63e9c50b + SwitchInstance, // 9fddadca SwitchProps, // 0dbf23ea Systrace, // 626d178c TVViewPropsIOS, // 330ce7b5 @@ -6229,27 +6268,32 @@ export { TaskProvider, // 266dedf2 Text, // 608149e8 TextContentType, // 239b3ecc - TextInput, // 3b7016bb + TextInput, // b541a946 TextInputAndroidProps, // 3f09ce49 TextInputChangeEvent, // 3ab11bb4 TextInputContentSizeChangeEvent, // f71f8571 TextInputEndEditingEvent, // e5f70633 TextInputFocusEvent, // 020507e6 TextInputIOSProps, // 0d05a855 + TextInputInstance, // a8cc5e25 TextInputKeyPressEvent, // 3924ad9b - TextInputProps, // 96c07405 + TextInputProps, // 910fb55d TextInputSelectionChangeEvent, // d4d10630 TextInputSubmitEditingEvent, // 22885c31 + TextInstance, // 9ac50c01 TextLayoutEvent, // 73ab173e TextProps, // 4c29419c TextStyle, // bb9b7a58 ToastAndroid, // 88a8969a Touchable, // da3239ee TouchableHighlight, // 49bbefe7 + TouchableHighlightInstance, // 96d47f78 TouchableHighlightProps, // f14a1131 TouchableNativeFeedback, // d89b59a8 + TouchableNativeFeedbackInstance, // beb58e1e TouchableNativeFeedbackProps, // a88ade2e TouchableOpacity, // 8d1b023b + TouchableOpacityInstance, // 09bc64ed TouchableOpacityProps, // 908e84b9 TouchableWithoutFeedback, // 71d446ec TouchableWithoutFeedbackProps, // e0c1c566 @@ -6260,15 +6304,18 @@ export { UTFSequence, // ad625158 Vibration, // 31e4bbf8 View, // 234d8db5 + ViewInstance, // 1a59bec1 ViewProps, // 6d644e8b ViewPropsAndroid, // ac650c5c ViewPropsIOS, // 58ee19bf ViewStyle, // 00a0f8fb VirtualViewMode, // 6be59722 VirtualizedList, // 68c7345e - VirtualizedListProps, // 9453ce86 + VirtualizedListInstance, // 423ee7c0 + VirtualizedListProps, // a9901686 VirtualizedSectionList, // 9fd9cd61 - VirtualizedSectionListProps, // 7a993da5 + VirtualizedSectionListInstance, // 12b706d5 + VirtualizedSectionListProps, // 90e14aed WrapperComponentProvider, // 9cf3844c codegenNativeCommands, // 628a7c0a codegenNativeComponent, // 2baac257 diff --git a/packages/react-native/index.js.flow b/packages/react-native/index.js.flow index 9f2eac497d63..b2f596090c86 100644 --- a/packages/react-native/index.js.flow +++ b/packages/react-native/index.js.flow @@ -22,21 +22,26 @@ // #region Components -export type {ActivityIndicatorProps} from './Libraries/Components/ActivityIndicator/ActivityIndicator'; +export type { + ActivityIndicatorInstance, + ActivityIndicatorProps, +} from './Libraries/Components/ActivityIndicator/ActivityIndicator'; export {default as ActivityIndicator} from './Libraries/Components/ActivityIndicator/ActivityIndicator'; -export type {ButtonProps} from './Libraries/Components/Button'; +export type {ButtonInstance, ButtonProps} from './Libraries/Components/Button'; export {default as Button} from './Libraries/Components/Button'; export type { + DrawerLayoutAndroidInstance, DrawerLayoutAndroidProps, DrawerSlideEvent, -} from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; +} from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes'; export {default as DrawerLayoutAndroid} from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; -export type {FlatListProps} from './Libraries/Lists/FlatList'; +export type {FlatListInstance, FlatListProps} from './Libraries/Lists/FlatList'; export {default as FlatList} from './Libraries/Lists/FlatList'; +export type {ImageInstance} from './Libraries/Image/ImageTypes.flow'; export type { ImageBackgroundProps, ImageErrorEvent, @@ -56,12 +61,16 @@ export type { ImageURISource, } from './Libraries/Image/ImageSource'; export {default as Image} from './Libraries/Image/Image'; +export type {ImageBackgroundInstance} from './Libraries/Image/ImageBackground'; export {default as ImageBackground} from './Libraries/Image/ImageBackground'; export type {InputAccessoryViewProps} from './Libraries/Components/TextInput/InputAccessoryView'; export {default as InputAccessoryView} from './Libraries/Components/TextInput/InputAccessoryView'; -export type {KeyboardAvoidingViewProps} from './Libraries/Components/Keyboard/KeyboardAvoidingView'; +export type { + KeyboardAvoidingViewInstance, + KeyboardAvoidingViewProps, +} from './Libraries/Components/Keyboard/KeyboardAvoidingView'; export {default as KeyboardAvoidingView} from './Libraries/Components/Keyboard/KeyboardAvoidingView'; export type {LayoutConformanceProps} from './Libraries/Components/LayoutConformance/LayoutConformance'; @@ -69,6 +78,7 @@ export {default as experimental_LayoutConformance} from './Libraries/Components/ export type { ModalBaseProps, + ModalInstance, ModalProps, ModalPropsAndroid, ModalPropsIOS, @@ -77,25 +87,32 @@ export {default as Modal} from './Libraries/Modal/Modal'; export type { PressableAndroidRippleConfig, + PressableInstance, PressableProps, PressableStateCallbackType, } from './Libraries/Components/Pressable/Pressable'; export {default as Pressable} from './Libraries/Components/Pressable/Pressable'; -export type {ProgressBarAndroidProps} from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; +export type { + ProgressBarAndroidInstance, + ProgressBarAndroidProps, +} from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; export {default as ProgressBarAndroid} from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; export type { + RefreshControlInstance, RefreshControlProps, RefreshControlPropsAndroid, RefreshControlPropsIOS, } from './Libraries/Components/RefreshControl/RefreshControl'; export {default as RefreshControl} from './Libraries/Components/RefreshControl/RefreshControl'; +export type {SafeAreaViewInstance} from './Libraries/Components/SafeAreaView/SafeAreaView'; export {default as SafeAreaView} from './Libraries/Components/SafeAreaView/SafeAreaView'; export type { ScrollViewImperativeMethods, + ScrollViewInstance, ScrollViewScrollToOptions, ScrollResponderType, ScrollViewProps, @@ -105,6 +122,7 @@ export type { export {default as ScrollView} from './Libraries/Components/ScrollView/ScrollView'; export type { + SectionListInstance, SectionListProps, SectionListRenderItem, SectionListRenderItemInfo, @@ -114,6 +132,7 @@ export {default as SectionList} from './Libraries/Lists/SectionList'; export type { StatusBarAnimation, + StatusBarInstance, StatusBarProps, StatusBarStyle, } from './Libraries/Components/StatusBar/StatusBar'; @@ -121,11 +140,12 @@ export {default as StatusBar} from './Libraries/Components/StatusBar/StatusBar'; export type { SwitchChangeEvent, + SwitchInstance, SwitchProps, } from './Libraries/Components/Switch/Switch'; export {default as Switch} from './Libraries/Components/Switch/Switch'; -export type {TextProps} from './Libraries/Text/Text'; +export type {TextInstance, TextProps} from './Libraries/Text/Text'; export {default as Text} from './Libraries/Text/Text'; export type {NativeTextProps as unstable_NativeTextProps} from './Libraries/Text/TextNativeComponent'; export {NativeText as unstable_NativeText} from './Libraries/Text/TextNativeComponent'; @@ -138,6 +158,7 @@ export type { InputModeOptions, TextContentType, TextInputAndroidProps, + TextInputInstance, TextInputIOSProps, TextInputProps, TextInputChangeEvent, @@ -154,13 +175,22 @@ export {default as TextInput} from './Libraries/Components/TextInput/TextInput'; export {default as Touchable} from './Libraries/Components/Touchable/Touchable'; -export type {TouchableHighlightProps} from './Libraries/Components/Touchable/TouchableHighlight'; +export type { + TouchableHighlightInstance, + TouchableHighlightProps, +} from './Libraries/Components/Touchable/TouchableHighlight'; export {default as TouchableHighlight} from './Libraries/Components/Touchable/TouchableHighlight'; -export type {TouchableNativeFeedbackProps} from './Libraries/Components/Touchable/TouchableNativeFeedback'; +export type { + TouchableNativeFeedbackInstance, + TouchableNativeFeedbackProps, +} from './Libraries/Components/Touchable/TouchableNativeFeedback'; export {default as TouchableNativeFeedback} from './Libraries/Components/Touchable/TouchableNativeFeedback'; -export type {TouchableOpacityProps} from './Libraries/Components/Touchable/TouchableOpacity'; +export type { + TouchableOpacityInstance, + TouchableOpacityProps, +} from './Libraries/Components/Touchable/TouchableOpacity'; export {default as TouchableOpacity} from './Libraries/Components/Touchable/TouchableOpacity'; export type {TouchableWithoutFeedbackProps} from './Libraries/Components/Touchable/TouchableWithoutFeedback'; @@ -181,6 +211,7 @@ export type { ViewPropsAndroid, ViewPropsIOS, } from './Libraries/Components/View/ViewPropTypes'; +export type {ViewInstance} from './Libraries/Components/View/View'; export {default as View} from './Libraries/Components/View/View'; export {default as unstable_NativeView} from './Libraries/Components/View/ViewNativeComponent'; @@ -191,6 +222,7 @@ export type { Separators, VirtualizedListProps, } from './Libraries/Lists/VirtualizedList'; +export type {VirtualizedListInstance} from './Libraries/Lists/VirtualizedList'; export {default as VirtualizedList} from './Libraries/Lists/VirtualizedList'; export type { @@ -198,6 +230,7 @@ export type { SectionBase, VirtualizedSectionListProps, } from './Libraries/Lists/VirtualizedSectionList'; +export type {VirtualizedSectionListInstance} from './Libraries/Lists/VirtualizedSectionList'; export {default as VirtualizedSectionList} from './Libraries/Lists/VirtualizedSectionList'; // #endregion