Skip to content

Commit c5ba16c

Browse files
chore: Deprecate TextInput editable prop
1 parent f3def13 commit c5ba16c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import TextInputState from './TextInputState';
2222
import invariant from 'invariant';
2323
import nullthrows from 'nullthrows';
2424
import setAndForwardRef from '../../Utilities/setAndForwardRef';
25+
import warnOnce from '../../Utilities/warnOnce';
2526

2627
import usePressability from '../../Pressability/usePressability';
2728

@@ -528,6 +529,7 @@ export type Props = $ReadOnly<{|
528529
defaultValue?: ?Stringish,
529530

530531
/**
532+
* @deprecated - use only readOnly instead
531533
* If `false`, text is not editable. The default value is `true`.
532534
*/
533535
editable?: ?boolean,
@@ -1396,6 +1398,13 @@ const ExportedForwardRef: React.AbstractComponent<
13961398
React.ElementRef<HostComponent<mixed>> & ImperativeMethods,
13971399
>,
13981400
) {
1401+
if (__DEV__ && editable !== undefined) {
1402+
warnOnce(
1403+
'TextInput-editable-prop-deprecated',
1404+
'The editable prop from TextInput has been deprecated and will be removed in a future release. Please use the readOnly prop instead',
1405+
);
1406+
}
1407+
13991408
return (
14001409
<InternalTextInput
14011410
allowFontScaling={allowFontScaling}

0 commit comments

Comments
 (0)