Skip to content

Commit 102fde7

Browse files
zoontekmeta-codesync[bot]
authored andcommitted
Deprecate InputAccessoryView (#57402)
Summary: Deprecates `InputAccessoryView` as part of the effort to keep core lean. It is iOS only, and `react-native-keyboard-controller` [`KeyboardStickyView`](https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view) is a better, cross-platform alternative. This adds a `deprecated` JSDoc tag to the component and its props (Flow and TypeScript) and a one-time runtime warning when the component is imported. No behavior changes. ## Changelog: [ANDROID] [DEPRECATED] - Deprecate `InputAccessoryView` Pull Request resolved: #57402 Test Plan: - `deprecated` shows a strikethrough on `InputAccessoryView` in editors. - Importing/rendering `InputAccessoryView` logs the deprecation warning once. Reviewed By: cortinico Differential Revision: D110333743 Pulled By: Abbondanzo fbshipit-source-id: 3e59afc0c3016619e9c4950c6f2b240bef146fad
1 parent 0a60ec9 commit 102fde7

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
1717
*
1818
* To use this component wrap your custom toolbar with the InputAccessoryView component, and set a nativeID. Then, pass
1919
* that nativeID as the inputAccessoryViewID of whatever TextInput you desire.
20+
*
21+
* InputAccessoryView is deprecated and will be removed in a future release.
22+
* @deprecated
2023
*/
2124
export class InputAccessoryView extends React.Component<InputAccessoryViewProps> {}
2225

26+
/**
27+
* InputAccessoryView is deprecated and will be removed in a future release.
28+
* @deprecated
29+
*/
2330
export interface InputAccessoryViewProps {
2431
backgroundColor?: ColorValue | undefined;
2532

packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import useWindowDimensions from '../../Utilities/useWindowDimensions';
1818
import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
1919
import * as React from 'react';
2020

21-
/** @build-types emit-as-interface Expo compatibility */
21+
/**
22+
* InputAccessoryView is deprecated and will be removed in a future release.
23+
* @deprecated
24+
* @build-types emit-as-interface Expo compatibility
25+
*/
2226
export type InputAccessoryViewProps = Readonly<{
2327
readonly children: React.Node,
2428
/**
@@ -36,8 +40,10 @@ export type InputAccessoryViewProps = Readonly<{
3640
*
3741
* This component can also be used to create sticky text inputs (text inputs which are anchored to the top of the keyboard). To do this, wrap a `TextInput` with `InputAccessoryView` and don't set a `nativeID`.
3842
*
39-
* @see https://reactnative.dev/docs/inputaccessoryview
43+
* InputAccessoryView is deprecated and will be removed in a future release.
44+
*
4045
* @platform ios
46+
* @deprecated
4147
*/
4248
const InputAccessoryView: React.ComponentType<InputAccessoryViewProps> = (
4349
props: InputAccessoryViewProps,

packages/react-native/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ module.exports = {
7777
return require('./Libraries/Image/ImageBackground').default;
7878
},
7979
get InputAccessoryView() {
80+
warnOnce(
81+
'input-accessory-view-deprecated',
82+
'InputAccessoryView is deprecated and will be removed in a future release.',
83+
);
8084
return require('./Libraries/Components/TextInput/InputAccessoryView')
8185
.default;
8286
},

0 commit comments

Comments
 (0)