From 4bcd09d86028997bbe9863483937318a640161de Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Wed, 24 Aug 2022 18:10:39 -0300 Subject: [PATCH] chore: Deprecate TextInput editable prop --- Libraries/Components/TextInput/TextInput.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 3f9f196db5dec2..7edd56e00e45e5 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -22,6 +22,7 @@ import TextInputState from './TextInputState'; import invariant from 'invariant'; import nullthrows from 'nullthrows'; import setAndForwardRef from '../../Utilities/setAndForwardRef'; +import warnOnce from '../../Utilities/warnOnce'; import usePressability from '../../Pressability/usePressability'; @@ -528,6 +529,7 @@ export type Props = $ReadOnly<{| defaultValue?: ?Stringish, /** + * @deprecated - use readOnly instead * If `false`, text is not editable. The default value is `true`. */ editable?: ?boolean, @@ -1396,6 +1398,13 @@ const ExportedForwardRef: React.AbstractComponent< React.ElementRef> & ImperativeMethods, >, ) { + if (__DEV__ && editable !== undefined) { + warnOnce( + 'TextInput-editable-prop-deprecated', + 'The editable prop from TextInput has been deprecated and will be removed in a future release. Please use the readOnly prop instead', + ); + } + return (