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

[0.64] Do not throw error on deprecated acceptsKeyboardFocus property usage #9444

Merged
merged 3 commits into from
Jan 31, 2022
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
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "[Win32] Move acceptsKeyboardFocus back to just a warning",
"packageName": "@office-iss/react-native-win32",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {ViewProps} from './ViewPropTypes';
const React = require('react');
import ViewNativeComponent from './ViewNativeComponent';
const TextAncestor = require('../../Text/TextAncestor');
import warnOnce from '../../Utilities/warnOnce'; // [Windows]
import invariant from 'invariant'; // [Windows]

export type Props = ViewProps;
Expand All @@ -30,14 +31,15 @@ const View: React.AbstractComponent<
ViewProps,
React.ElementRef<typeof ViewNativeComponent>,
> = React.forwardRef((props: ViewProps, forwardedRef) => {
// [Windows
invariant(
// $FlowFixMe Wanting to catch untyped usages
!props || props.acceptsKeyboardFocus === undefined,
'Support for the "acceptsKeyboardFocus" property has been removed in favor of "focusable"',
);
// Windows]

// [Win32 Intercept props to warn about them going away
// $FlowFixMe react-native-win32 doesn't have forked types in Flow yet
if (props.acceptsKeyboardFocus !== undefined) {
warnOnce(
'deprecated-acceptsKeyboardFocus',
'"acceptsKeyboardFocus" has been deprecated in favor of "focusable" and will be removed soon',
);
}
// Win32]
return (
// [Windows
// In core this is a TextAncestor.Provider value={false} See
Expand Down