Skip to content

Commit 2017605

Browse files
feat: Update TextInput logic to readOnly take priority over editable
1 parent a07a65c commit 2017605

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,8 @@ const ExportedForwardRef: React.AbstractComponent<
13881388
allowFontScaling = true,
13891389
rejectResponderTermination = true,
13901390
underlineColorAndroid = 'transparent',
1391-
readOnly = false,
1391+
readOnly,
1392+
editable,
13921393
...restProps
13931394
},
13941395
forwardedRef: ReactRefSetter<
@@ -1400,7 +1401,7 @@ const ExportedForwardRef: React.AbstractComponent<
14001401
allowFontScaling={allowFontScaling}
14011402
rejectResponderTermination={rejectResponderTermination}
14021403
underlineColorAndroid={underlineColorAndroid}
1403-
editable={!readOnly}
1404+
editable={readOnly !== undefined ? !readOnly : editable}
14041405
{...restProps}
14051406
forwardedRef={forwardedRef}
14061407
/>

Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ exports[`TextInput tests should render as expected: should deep render when mock
44
<RCTSinglelineTextInputView
55
accessible={true}
66
allowFontScaling={true}
7-
editable={true}
87
focusable={true}
98
forwardedRef={null}
109
mostRecentEventCount={0}
@@ -34,7 +33,6 @@ exports[`TextInput tests should render as expected: should deep render when not
3433
<RCTSinglelineTextInputView
3534
accessible={true}
3635
allowFontScaling={true}
37-
editable={true}
3836
focusable={true}
3937
forwardedRef={null}
4038
mostRecentEventCount={0}

0 commit comments

Comments
 (0)