Skip to content

Commit 7638301

Browse files
committed
[fix] Defaults and fallback logic for web props
1 parent 3e74ed0 commit 7638301

File tree

4 files changed

+85
-54
lines changed

4 files changed

+85
-54
lines changed

packages/react-native-web/src/exports/CheckBox/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ const CheckBox: React.AbstractComponent<
6666
checked: value,
6767
disabled: disabled,
6868
onChange: handleChange,
69-
readOnly: readOnly || ariaReadOnly || other.accessibilityReadOnly,
69+
readOnly:
70+
readOnly === true ||
71+
ariaReadOnly === true ||
72+
other.accessibilityReadOnly === true,
7073
ref: forwardedRef,
7174
style: [styles.nativeControl, styles.cursorInherit],
7275
type: 'checkbox'

packages/react-native-web/src/exports/TextInput/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const TextInput: React.AbstractComponent<
135135
placeholderTextColor,
136136
readOnly = false,
137137
returnKeyType,
138-
rows = 1,
138+
rows,
139139
secureTextEntry = false,
140140
selection,
141141
selectTextOnFocus,
@@ -389,18 +389,14 @@ const TextInput: React.AbstractComponent<
389389
if (editable != null) {
390390
warnOnce('editable', 'editable is deprecated. Use readOnly.');
391391
}
392-
supportedProps.readOnly = readOnly || !editable;
392+
supportedProps.readOnly = readOnly === true || editable === false;
393393
if (numberOfLines != null) {
394394
warnOnce(
395395
'numberOfLines',
396396
'TextInput numberOfLines is deprecated. Use rows.'
397397
);
398398
}
399-
supportedProps.rows = multiline
400-
? rows != null
401-
? rows
402-
: numberOfLines
403-
: undefined;
399+
supportedProps.rows = multiline ? (rows != null ? rows : numberOfLines) : 1;
404400
supportedProps.spellCheck = spellCheck != null ? spellCheck : autoCorrect;
405401
supportedProps.style = [
406402
{ '--placeholderTextColor': placeholderTextColor },

packages/react-native-web/src/modules/createDOMProps/__tests__/index-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('modules/createDOMProps', () => {
7171
expect(_props).toMatchInlineSnapshot(`
7272
{
7373
"aria-activedescendant": "activedescendant",
74-
"aria-atomic": true,
74+
"aria-atomic": "activedescendant",
7575
"aria-autocomplete": "list",
7676
"aria-busy": true,
7777
"aria-checked": true,
@@ -112,6 +112,7 @@ describe('modules/createDOMProps', () => {
112112
"aria-setsize": 5,
113113
"aria-sort": "ascending",
114114
"aria-valuemax": 5,
115+
"aria-valuemin": 0,
115116
"aria-valuenow": 3,
116117
"aria-valuetext": "3",
117118
"className": "className",

0 commit comments

Comments
 (0)