Skip to content

Commit fc423ba

Browse files
committed
Remove API deprecation warnings
Removes warnings for non-standard APIs in React Native, given there has been no upstream interest in deprecating them. And the standards-based approach to cross-platform React is instead being built into React Strict DOM.
1 parent abc4abb commit fc423ba

File tree

9 files changed

+122
-8
lines changed

9 files changed

+122
-8
lines changed

packages/react-native-web-docs/src/pages/docs/concepts/accessibility.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Accessibility in {{ site.name }} combines several separate web APIs into a cohes
2020

2121
## Accessibility Props API
2222

23-
{{ site.name }} includes APIs for making accessible apps. (Note that the React Native-specific `accessibility*` props are deprecated in favor of `aria-*` props).
23+
{{ site.name }} includes APIs for making accessible apps. (Note that for compatibility with existing React Native code, the React Native-specific `accessibility*` props are also supported.)
2424

2525
{% call macro.prop('aria-activedescendant', '?string') %}
2626
Equivalent to [aria-activedescendant](https://www.w3.org/TR/wai-aria-1.2/#aria-activedescendant).

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as React from 'react';
1212
import StyleSheet from '../StyleSheet';
1313
import TouchableOpacity from '../TouchableOpacity';
1414
import Text from '../Text';
15-
import { warnOnce } from '../../modules/warnOnce';
15+
//import { warnOnce } from '../../modules/warnOnce';
1616

1717
type ButtonProps = {|
1818
accessibilityLabel?: ?string,
@@ -27,7 +27,7 @@ const Button: React.AbstractComponent<
2727
ButtonProps,
2828
React.ElementRef<typeof TouchableOpacity>
2929
> = React.forwardRef((props, forwardedRef) => {
30-
warnOnce('Button', 'Button is deprecated. Please use Pressable.');
30+
// warnOnce('Button', 'Button is deprecated. Please use Pressable.');
3131

3232
const { accessibilityLabel, color, disabled, onPress, testID, title } = props;
3333

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

+2
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ function compose(style1: any, style2: any): any {
113113
);
114114
}
115115
/* eslint-enable prefer-rest-params */
116+
/*
116117
console.warn(
117118
'StyleSheet.compose(a, b) is deprecated; use array syntax, i.e., [a,b].'
118119
);
120+
*/
119121
}
120122
return [style1, style2];
121123
}

packages/react-native-web/src/exports/StyleSheet/preprocess.js

+4
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,22 @@ export const preprocess = <T: {| [key: string]: any |}>(
186186
nextStyle[prop] = value.toString();
187187
} else if (prop === 'fontVariant') {
188188
if (Array.isArray(value) && value.length > 0) {
189+
/*
189190
warnOnce(
190191
'fontVariant',
191192
'"fontVariant" style array value is deprecated. Use space-separated values.'
192193
);
194+
*/
193195
value = value.join(' ');
194196
}
195197
nextStyle[prop] = value;
196198
} else if (prop === 'textAlignVertical') {
199+
/*
197200
warnOnce(
198201
'textAlignVertical',
199202
'"textAlignVertical" style is deprecated. Use "verticalAlign".'
200203
);
204+
*/
201205
if (style.verticalAlign == null) {
202206
nextStyle.verticalAlign = value === 'center' ? 'middle' : value;
203207
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import useResponderEvents from '../../modules/useResponderEvents';
2424
import StyleSheet from '../StyleSheet';
2525
import TextAncestorContext from './TextAncestorContext';
2626
import { useLocaleContext, getLocaleDirection } from '../../modules/useLocale';
27-
import { warnOnce } from '../../modules/warnOnce';
27+
//import { warnOnce } from '../../modules/warnOnce';
2828

2929
const forwardPropsList = Object.assign(
3030
{},
@@ -73,12 +73,14 @@ const Text: React.AbstractComponent<TextProps, HTMLElement & PlatformMethods> =
7373
...rest
7474
} = props;
7575

76+
/*
7677
if (selectable != null) {
7778
warnOnce(
7879
'selectable',
7980
'selectable prop is deprecated. Use styles.userSelect.'
8081
);
8182
}
83+
*/
8284

8385
const hasTextAncestor = React.useContext(TextAncestorContext);
8486
const hostRef = React.useRef(null);

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import useResponderEvents from '../../modules/useResponderEvents';
2525
import { getLocaleDirection, useLocaleContext } from '../../modules/useLocale';
2626
import StyleSheet from '../StyleSheet';
2727
import TextInputState from '../../modules/TextInputState';
28-
import { warnOnce } from '../../modules/warnOnce';
28+
//import { warnOnce } from '../../modules/warnOnce';
2929

3030
/**
3131
* Determines whether a 'selection' prop differs from a node's existing
@@ -163,7 +163,7 @@ const TextInput: React.AbstractComponent<
163163
type = 'text';
164164
}
165165
} else if (keyboardType != null) {
166-
warnOnce('keyboardType', 'keyboardType is deprecated. Use inputMode.');
166+
// warnOnce('keyboardType', 'keyboardType is deprecated. Use inputMode.');
167167
switch (keyboardType) {
168168
case 'email-address':
169169
type = 'email';
@@ -394,26 +394,32 @@ const TextInput: React.AbstractComponent<
394394
supportedProps.autoCorrect = autoCorrect ? 'on' : 'off';
395395
// 'auto' by default allows browsers to infer writing direction
396396
supportedProps.dir = dir !== undefined ? dir : 'auto';
397+
/*
397398
if (returnKeyType != null) {
398399
warnOnce('returnKeyType', 'returnKeyType is deprecated. Use enterKeyHint.');
399400
}
401+
*/
400402
supportedProps.enterKeyHint = enterKeyHint || returnKeyType;
401403
supportedProps.inputMode = _inputMode;
402404
supportedProps.onBlur = handleBlur;
403405
supportedProps.onChange = handleChange;
404406
supportedProps.onFocus = handleFocus;
405407
supportedProps.onKeyDown = handleKeyDown;
406408
supportedProps.onSelect = handleSelectionChange;
409+
/*
407410
if (editable != null) {
408411
warnOnce('editable', 'editable is deprecated. Use readOnly.');
409412
}
413+
*/
410414
supportedProps.readOnly = readOnly === true || editable === false;
415+
/*
411416
if (numberOfLines != null) {
412417
warnOnce(
413418
'numberOfLines',
414419
'TextInput numberOfLines is deprecated. Use rows.'
415420
);
416421
}
422+
*/
417423
supportedProps.rows = multiline ? (rows != null ? rows : numberOfLines) : 1;
418424
supportedProps.spellCheck = spellCheck != null ? spellCheck : autoCorrect;
419425
supportedProps.style = [

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import useMergeRefs from '../../modules/useMergeRefs';
2020
import usePressEvents from '../../modules/usePressEvents';
2121
import StyleSheet from '../StyleSheet';
2222
import View from '../View';
23-
import { warnOnce } from '../../modules/warnOnce';
23+
//import { warnOnce } from '../../modules/warnOnce';
2424

2525
type ViewStyle = $PropertyType<ViewProps, 'style'>;
2626

@@ -71,10 +71,12 @@ function hasPressHandler(props): boolean {
7171
* If you wish to have several child components, wrap them in a View.
7272
*/
7373
function TouchableHighlight(props: Props, forwardedRef): React.Node {
74+
/*
7475
warnOnce(
7576
'TouchableHighlight',
7677
'TouchableHighlight is deprecated. Please use Pressable.'
7778
);
79+
*/
7880

7981
const {
8082
activeOpacity,

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import useMergeRefs from '../../modules/useMergeRefs';
1919
import usePressEvents from '../../modules/usePressEvents';
2020
import StyleSheet from '../StyleSheet';
2121
import View from '../View';
22-
import { warnOnce } from '../../modules/warnOnce';
22+
//import { warnOnce } from '../../modules/warnOnce';
2323

2424
type ViewStyle = $PropertyType<ViewProps, 'style'>;
2525

@@ -34,10 +34,12 @@ type Props = $ReadOnly<{|
3434
* On press down, the opacity of the wrapped view is decreased, dimming it.
3535
*/
3636
function TouchableOpacity(props: Props, forwardedRef): React.Node {
37+
/*
3738
warnOnce(
3839
'TouchableOpacity',
3940
'TouchableOpacity is deprecated. Please use Pressable.'
4041
);
42+
*/
4143

4244
const {
4345
activeOpacity,

0 commit comments

Comments
 (0)