mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
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
This commit is contained in:
1 parent
0a60ec9dea
commit
102fde7b6b
3 files changed
+19
-2
No files matched your search
@@ -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<InputAccessoryViewProps> {}
|
||||
|
||||
/**
|
||||
* InputAccessoryView is deprecated and will be removed in a future release.
|
||||
* @deprecated
|
||||
*/
|
||||
export interface InputAccessoryViewProps {
|
||||
backgroundColor?: ColorValue | undefined;
|
||||
|
||||
|
||||
@@ -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<InputAccessoryViewProps> = (
|
||||
props: InputAccessoryViewProps,
|
||||
|
||||
Vendored
+4
@@ -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;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user