From 102fde7b6bf699dac9769b5336d9bbde2e228109 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Thu, 9 Jul 2026 19:57:24 -0700 Subject: [PATCH] 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: https://github.com/react/react-native/pull/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 --- .../Components/TextInput/InputAccessoryView.d.ts | 7 +++++++ .../Components/TextInput/InputAccessoryView.js | 10 ++++++++-- packages/react-native/index.js | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts index d64911fcaf4..e5a9a711e22 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts @@ -17,9 +17,16 @@ import {ViewStyle} from '../../StyleSheet/StyleSheetTypes'; * * To use this component wrap your custom toolbar with the InputAccessoryView component, and set a nativeID. Then, pass * that nativeID as the inputAccessoryViewID of whatever TextInput you desire. + * + * InputAccessoryView is deprecated and will be removed in a future release. + * @deprecated */ export class InputAccessoryView extends React.Component {} +/** + * InputAccessoryView is deprecated and will be removed in a future release. + * @deprecated + */ export interface InputAccessoryViewProps { backgroundColor?: ColorValue | undefined; diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js index 4b2e7d961c4..e00db0a1fa3 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js @@ -18,7 +18,11 @@ import useWindowDimensions from '../../Utilities/useWindowDimensions'; import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent'; import * as React from 'react'; -/** @build-types emit-as-interface Expo compatibility */ +/** + * InputAccessoryView is deprecated and will be removed in a future release. + * @deprecated + * @build-types emit-as-interface Expo compatibility + */ export type InputAccessoryViewProps = Readonly<{ readonly children: React.Node, /** @@ -36,8 +40,10 @@ export type InputAccessoryViewProps = Readonly<{ * * 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`. * - * @see https://reactnative.dev/docs/inputaccessoryview + * InputAccessoryView is deprecated and will be removed in a future release. + * * @platform ios + * @deprecated */ const InputAccessoryView: React.ComponentType = ( props: InputAccessoryViewProps, diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 0fb660e9aaf..80fb9723e4f 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -77,6 +77,10 @@ module.exports = { return require('./Libraries/Image/ImageBackground').default; }, get InputAccessoryView() { + warnOnce( + 'input-accessory-view-deprecated', + 'InputAccessoryView is deprecated and will be removed in a future release.', + ); return require('./Libraries/Components/TextInput/InputAccessoryView') .default; },