Skip to content
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

Remove API deprecation warnings #2726

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Accessibility in {{ site.name }} combines several separate web APIs into a cohes

## Accessibility Props API

{{ site.name }} includes APIs for making accessible apps. (Note that the React Native-specific `accessibility*` props are deprecated in favor of `aria-*` props).
{{ 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.)

{% call macro.prop('aria-activedescendant', '?string') %}
Equivalent to [aria-activedescendant](https://www.w3.org/TR/wai-aria-1.2/#aria-activedescendant).
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-web/src/exports/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as React from 'react';
import StyleSheet from '../StyleSheet';
import TouchableOpacity from '../TouchableOpacity';
import Text from '../Text';
import { warnOnce } from '../../modules/warnOnce';
//import { warnOnce } from '../../modules/warnOnce';

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

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

Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/StyleSheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ function compose(style1: any, style2: any): any {
);
}
/* eslint-enable prefer-rest-params */
/*
console.warn(
'StyleSheet.compose(a, b) is deprecated; use array syntax, i.e., [a,b].'
);
*/
}
return [style1, style2];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,22 @@ export const preprocess = <T: {| [key: string]: any |}>(
nextStyle[prop] = value.toString();
} else if (prop === 'fontVariant') {
if (Array.isArray(value) && value.length > 0) {
/*
warnOnce(
'fontVariant',
'"fontVariant" style array value is deprecated. Use space-separated values.'
);
*/
value = value.join(' ');
}
nextStyle[prop] = value;
} else if (prop === 'textAlignVertical') {
/*
warnOnce(
'textAlignVertical',
'"textAlignVertical" style is deprecated. Use "verticalAlign".'
);
*/
if (style.verticalAlign == null) {
nextStyle.verticalAlign = value === 'center' ? 'middle' : value;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native-web/src/exports/Text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import useResponderEvents from '../../modules/useResponderEvents';
import StyleSheet from '../StyleSheet';
import TextAncestorContext from './TextAncestorContext';
import { useLocaleContext, getLocaleDirection } from '../../modules/useLocale';
import { warnOnce } from '../../modules/warnOnce';
//import { warnOnce } from '../../modules/warnOnce';

const forwardPropsList = Object.assign(
{},
Expand Down Expand Up @@ -73,12 +73,14 @@ const Text: React.AbstractComponent<TextProps, HTMLElement & PlatformMethods> =
...rest
} = props;

/*
if (selectable != null) {
warnOnce(
'selectable',
'selectable prop is deprecated. Use styles.userSelect.'
);
}
*/

const hasTextAncestor = React.useContext(TextAncestorContext);
const hostRef = React.useRef(null);
Expand Down
10 changes: 8 additions & 2 deletions packages/react-native-web/src/exports/TextInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import useResponderEvents from '../../modules/useResponderEvents';
import { getLocaleDirection, useLocaleContext } from '../../modules/useLocale';
import StyleSheet from '../StyleSheet';
import TextInputState from '../../modules/TextInputState';
import { warnOnce } from '../../modules/warnOnce';
//import { warnOnce } from '../../modules/warnOnce';

/**
* Determines whether a 'selection' prop differs from a node's existing
Expand Down Expand Up @@ -163,7 +163,7 @@ const TextInput: React.AbstractComponent<
type = 'text';
}
} else if (keyboardType != null) {
warnOnce('keyboardType', 'keyboardType is deprecated. Use inputMode.');
// warnOnce('keyboardType', 'keyboardType is deprecated. Use inputMode.');
switch (keyboardType) {
case 'email-address':
type = 'email';
Expand Down Expand Up @@ -394,26 +394,32 @@ const TextInput: React.AbstractComponent<
supportedProps.autoCorrect = autoCorrect ? 'on' : 'off';
// 'auto' by default allows browsers to infer writing direction
supportedProps.dir = dir !== undefined ? dir : 'auto';
/*
if (returnKeyType != null) {
warnOnce('returnKeyType', 'returnKeyType is deprecated. Use enterKeyHint.');
}
*/
supportedProps.enterKeyHint = enterKeyHint || returnKeyType;
supportedProps.inputMode = _inputMode;
supportedProps.onBlur = handleBlur;
supportedProps.onChange = handleChange;
supportedProps.onFocus = handleFocus;
supportedProps.onKeyDown = handleKeyDown;
supportedProps.onSelect = handleSelectionChange;
/*
if (editable != null) {
warnOnce('editable', 'editable is deprecated. Use readOnly.');
}
*/
supportedProps.readOnly = readOnly === true || editable === false;
/*
if (numberOfLines != null) {
warnOnce(
'numberOfLines',
'TextInput numberOfLines is deprecated. Use rows.'
);
}
*/
supportedProps.rows = multiline ? (rows != null ? rows : numberOfLines) : 1;
supportedProps.spellCheck = spellCheck != null ? spellCheck : autoCorrect;
supportedProps.style = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import useMergeRefs from '../../modules/useMergeRefs';
import usePressEvents from '../../modules/usePressEvents';
import StyleSheet from '../StyleSheet';
import View from '../View';
import { warnOnce } from '../../modules/warnOnce';
//import { warnOnce } from '../../modules/warnOnce';

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

Expand Down Expand Up @@ -71,10 +71,12 @@ function hasPressHandler(props): boolean {
* If you wish to have several child components, wrap them in a View.
*/
function TouchableHighlight(props: Props, forwardedRef): React.Node {
/*
warnOnce(
'TouchableHighlight',
'TouchableHighlight is deprecated. Please use Pressable.'
);
*/

const {
activeOpacity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import useMergeRefs from '../../modules/useMergeRefs';
import usePressEvents from '../../modules/usePressEvents';
import StyleSheet from '../StyleSheet';
import View from '../View';
import { warnOnce } from '../../modules/warnOnce';
//import { warnOnce } from '../../modules/warnOnce';

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

Expand All @@ -34,10 +34,12 @@ type Props = $ReadOnly<{|
* On press down, the opacity of the wrapped view is decreased, dimming it.
*/
function TouchableOpacity(props: Props, forwardedRef): React.Node {
/*
warnOnce(
'TouchableOpacity',
'TouchableOpacity is deprecated. Please use Pressable.'
);
*/

const {
activeOpacity,
Expand Down
Loading
Loading