Skip to content

Commit 05ec7e0

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Add basic definition of DOM APIs in legacy TypeScript types (#54124)
Summary: Pull Request resolved: #54124 Changelog: [General][Fixed] Fixed missing type definitions for new DOM APIs in legacy TypeScript types. Fixes #54103. Reviewed By: huntie Differential Revision: D84363784 fbshipit-source-id: f92362c78c72da986b26ea18c673f90fd4b48fca
1 parent 2f83923 commit 05ec7e0

File tree

11 files changed

+136
-26
lines changed

11 files changed

+136
-26
lines changed

packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
1414
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
1515
import {LayoutChangeEvent} from '../../Types/CoreEventTypes';
@@ -46,7 +46,7 @@ export interface ActivityIndicatorProps extends ViewProps {
4646
}
4747

4848
declare class ActivityIndicatorComponent extends React.Component<ActivityIndicatorProps> {}
49-
declare const ActivityIndicatorBase: Constructor<NativeMethods> &
49+
declare const ActivityIndicatorBase: Constructor<HostInstance> &
5050
typeof ActivityIndicatorComponent;
5151
export class ActivityIndicator extends ActivityIndicatorBase {}
5252

packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ColorValue} from '../../StyleSheet/StyleSheet';
1414
import {
1515
NativeSyntheticEvent,
@@ -121,7 +121,7 @@ interface DrawerPosition {
121121
}
122122

123123
declare class DrawerLayoutAndroidComponent extends React.Component<DrawerLayoutAndroidProps> {}
124-
declare const DrawerLayoutAndroidBase: Constructor<NativeMethods> &
124+
declare const DrawerLayoutAndroidBase: Constructor<HostInstance> &
125125
typeof DrawerLayoutAndroidComponent;
126126
export class DrawerLayoutAndroid extends DrawerLayoutAndroidBase {
127127
/**

packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ColorValue} from '../../StyleSheet/StyleSheet';
1414
import {ViewProps} from '../View/ViewPropTypes';
1515

@@ -72,7 +72,7 @@ export interface ProgressBarAndroidProps extends ViewProps {
7272
* that the app is loading or there is some activity in the app.
7373
*/
7474
declare class ProgressBarAndroidComponent extends React.Component<ProgressBarAndroidProps> {}
75-
declare const ProgressBarAndroidBase: Constructor<NativeMethods> &
75+
declare const ProgressBarAndroidBase: Constructor<HostInstance> &
7676
typeof ProgressBarAndroidComponent;
7777
/**
7878
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.

packages/react-native/Libraries/Components/RefreshControl/RefreshControl.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ColorValue} from '../../StyleSheet/StyleSheet';
1414
import {ViewProps} from '../View/ViewPropTypes';
1515

@@ -80,7 +80,7 @@ export interface RefreshControlProps
8080
* in the `onRefresh` function otherwise the refresh indicator will stop immediately.
8181
*/
8282
declare class RefreshControlComponent extends React.Component<RefreshControlProps> {}
83-
declare const RefreshControlBase: Constructor<NativeMethods> &
83+
declare const RefreshControlBase: Constructor<HostInstance> &
8484
typeof RefreshControlComponent;
8585
export class RefreshControl extends RefreshControlBase {
8686
static SIZE: Object; // Undocumented

packages/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ViewProps} from '../View/ViewPropTypes';
1414

1515
/**
@@ -23,7 +23,7 @@ import {ViewProps} from '../View/ViewPropTypes';
2323
*/
2424
declare class SafeAreaViewComponent extends React.Component<ViewProps> {}
2525

26-
declare const SafeAreaViewBase: Constructor<NativeMethods> &
26+
declare const SafeAreaViewBase: Constructor<HostInstance> &
2727
typeof SafeAreaViewComponent;
2828

2929
/**

packages/react-native/Libraries/Components/Switch/Switch.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
12-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1313
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
1414
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
1515
import {ViewProps} from '../View/ViewPropTypes';
@@ -114,5 +114,5 @@ export interface SwitchProps extends SwitchPropsIOS {
114114
* the supplied `value` prop instead of the expected result of any user actions.
115115
*/
116116
declare class SwitchComponent extends React.Component<SwitchProps> {}
117-
declare const SwitchBase: Constructor<NativeMethods> & typeof SwitchComponent;
117+
declare const SwitchBase: Constructor<HostInstance> & typeof SwitchComponent;
118118
export class Switch extends SwitchBase {}

packages/react-native/Libraries/Components/TextInput/TextInput.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
1212
import {TimerMixin} from '../../../types/private/TimerMixin';
13-
import {
14-
HostInstance,
15-
NativeMethods,
16-
} from '../../../types/public/ReactNativeTypes';
13+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1714
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
1815
import {TextStyle} from '../../StyleSheet/StyleSheetTypes';
1916
import {
@@ -1029,7 +1026,7 @@ interface TextInputState {
10291026
* @see https://reactnative.dev/docs/textinput#methods
10301027
*/
10311028
declare class TextInputComponent extends React.Component<TextInputProps> {}
1032-
declare const TextInputBase: Constructor<NativeMethods> &
1029+
declare const TextInputBase: Constructor<HostInstance> &
10331030
Constructor<TimerMixin> &
10341031
typeof TextInputComponent;
10351032
export class TextInput extends TextInputBase {

packages/react-native/Libraries/Components/View/View.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type * as React from 'react';
1111
import {Constructor} from '../../../types/private/Utilities';
1212
import {ViewProps} from './ViewPropTypes';
13-
import {NativeMethods} from '../../../types/public/ReactNativeTypes';
13+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
1414

1515
/**
1616
* The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling,
@@ -19,7 +19,7 @@ import {NativeMethods} from '../../../types/public/ReactNativeTypes';
1919
* whether that is a UIView, <div>, android.view, etc.
2020
*/
2121
declare class ViewComponent extends React.Component<ViewProps> {}
22-
declare const ViewBase: Constructor<NativeMethods> & typeof ViewComponent;
22+
declare const ViewBase: Constructor<HostInstance> & typeof ViewComponent;
2323
export class View extends ViewBase {
2424
/**
2525
* Is 3D Touch / Force Touch available (i.e. will touch events include `force`)

packages/react-native/Libraries/Image/Image.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as React from 'react';
1111
import {Constructor} from '../../types/private/Utilities';
1212
import {AccessibilityProps} from '../Components/View/ViewAccessibility';
1313
import {Insets} from '../../types/public/Insets';
14-
import {NativeMethods} from '../../types/public/ReactNativeTypes';
14+
import {HostInstance} from '../../types/public/ReactNativeTypes';
1515
import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
1616
import {ImageStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
1717
import {LayoutChangeEvent, NativeSyntheticEvent} from '../Types/CoreEventTypes';
@@ -338,7 +338,7 @@ export interface ImageSize {
338338
}
339339

340340
declare class ImageComponent extends React.Component<ImageProps> {}
341-
declare const ImageBase: Constructor<NativeMethods> & typeof ImageComponent;
341+
declare const ImageBase: Constructor<HostInstance> & typeof ImageComponent;
342342
export class Image extends ImageBase {
343343
static getSize(uri: string): Promise<ImageSize>;
344344
static getSize(
@@ -384,6 +384,6 @@ export interface ImageBackgroundProps extends ImagePropsBase {
384384
}
385385

386386
declare class ImageBackgroundComponent extends React.Component<ImageBackgroundProps> {}
387-
declare const ImageBackgroundBase: Constructor<NativeMethods> &
387+
declare const ImageBackgroundBase: Constructor<HostInstance> &
388388
typeof ImageBackgroundComponent;
389389
export class ImageBackground extends ImageBackgroundBase {}

packages/react-native/Libraries/Text/Text.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import type * as React from 'react';
1111
import {Constructor} from '../../types/private/Utilities';
1212
import {AccessibilityProps} from '../Components/View/ViewAccessibility';
13-
import {NativeMethods} from '../../types/public/ReactNativeTypes';
13+
import {HostInstance} from '../../types/public/ReactNativeTypes';
1414
import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
1515
import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
1616
import {
@@ -224,7 +224,7 @@ export interface TextProps
224224
* A React component for displaying text which supports nesting, styling, and touch handling.
225225
*/
226226
declare class TextComponent extends React.Component<TextProps> {}
227-
declare const TextBase: Constructor<NativeMethods> & typeof TextComponent;
227+
declare const TextBase: Constructor<HostInstance> & typeof TextComponent;
228228
export class Text extends TextBase {}
229229

230230
export const unstable_TextAncestorContext: React.Context<boolean>;

0 commit comments

Comments
 (0)