diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 08fdf276faa..d0fb5c4be14 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -25,7 +25,7 @@ import View from '../View/View'; import Keyboard from './Keyboard'; import * as React from 'react'; -type Props = $ReadOnly<{ +export type KeyboardAvoidingViewProps = $ReadOnly<{ ...ViewProps, /** @@ -59,7 +59,10 @@ type State = { * View that moves out of the way when the keyboard appears by automatically * adjusting its height, position, or bottom padding. */ -class KeyboardAvoidingView extends React.Component { +class KeyboardAvoidingView extends React.Component< + KeyboardAvoidingViewProps, + State, +> { _frame: ?ViewLayout = null; _keyboardEvent: ?KeyboardEvent = null; _subscriptions: Array = []; @@ -67,7 +70,7 @@ class KeyboardAvoidingView extends React.Component { _initialFrameHeight: number = 0; _bottom: number = 0; - constructor(props: Props) { + constructor(props: KeyboardAvoidingViewProps) { super(props); this.state = {bottom: 0}; this.viewRef = React.createRef(); @@ -175,7 +178,7 @@ class KeyboardAvoidingView extends React.Component { } }; - componentDidUpdate(_: Props, prevState: State): void { + componentDidUpdate(_: KeyboardAvoidingViewProps, prevState: State): void { const enabled = this.props.enabled ?? true; if (enabled && this._bottom !== prevState.bottom) { this.setState({bottom: this._bottom}); diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index f9901a49672..f063ce87850 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -1528,7 +1528,7 @@ declare export default Keyboard; `; exports[`public API should not change unintentionally Libraries/Components/Keyboard/KeyboardAvoidingView.js 1`] = ` -"type Props = $ReadOnly<{ +"export type KeyboardAvoidingViewProps = $ReadOnly<{ ...ViewProps, behavior?: ?(\\"height\\" | \\"position\\" | \\"padding\\"), contentContainerStyle?: ?ViewStyleProp, @@ -1538,10 +1538,12 @@ exports[`public API should not change unintentionally Libraries/Components/Keybo type State = { bottom: number, }; -declare class KeyboardAvoidingView extends React.Component { +declare class KeyboardAvoidingView + extends React.Component +{ viewRef: { current: React.ElementRef | null, ... }; - constructor(props: Props): void; - componentDidUpdate(_: Props, prevState: State): void; + constructor(props: KeyboardAvoidingViewProps): void; + componentDidUpdate(_: KeyboardAvoidingViewProps, prevState: State): void; componentDidMount(): void; componentWillUnmount(): void; render(): React.Node; diff --git a/scripts/build/build-types/buildTypes.js b/scripts/build/build-types/buildTypes.js index 4d153ebcaac..e26d8a207c9 100644 --- a/scripts/build/build-types/buildTypes.js +++ b/scripts/build/build-types/buildTypes.js @@ -39,7 +39,8 @@ const ENTRY_POINTS = [ 'packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js', 'packages/react-native/Libraries/Components/Button.js', 'packages/react-native/Libraries/Components/Clipboard/Clipboard.js', - 'packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js', + 'packages/react-native/Libraries/Components/Keyboard/Keyboard.js', + 'packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js', 'packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js', 'packages/react-native/Libraries/Components/ScrollView/ScrollView.js', 'packages/react-native/Libraries/Interaction/InteractionManager.js',