Skip to content

chore: Deprecate TextInput editable prop #34492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1396,6 +1398,13 @@ const ExportedForwardRef: React.AbstractComponent<
React.ElementRef<HostComponent<mixed>> & 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 (
<InternalTextInput
allowFontScaling={allowFontScaling}
Expand Down