Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Aug 22, 2024
1 parent b39ea24 commit c7364cc
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 170 deletions.
16 changes: 0 additions & 16 deletions packages/react-native/Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,6 @@ const Button: React.AbstractComponent<ButtonProps> = (props: ButtonProps) => {
? 'no-hide-descendants'
: importantForAccessibility;

// [macOS
let _passthroughAllKeyEvents = passthroughAllKeyEvents;
let _validKeysDown = validKeysDown;
let _validKeysUp = validKeysUp;
if (keyDownEvents || keyUpEvents) {
_passThroughAllKeyboardEvents = true;
_validKeysDown = undefined;
_validKeysUp = undefined;
}
// macOS]

return (
<Touchable
accessible={accessible}
Expand All @@ -486,11 +475,6 @@ const Button: React.AbstractComponent<ButtonProps> = (props: ButtonProps) => {
onBlur={onBlur}
onKeyDown={onKeyDown}
onKeyUp={onKeyUp}
validKeysDown={_validKeysDown}
validKeysUp={_validKeysUp}
passthroughAllKeyEvents={_passthroughAllKeyEvents}
keyDownEvents={keyDownEvents}
keyUpEvents={keyUpEvents}
tooltip={tooltip}
// macOS]
touchSoundDisabled={touchSoundDisabled}>
Expand Down
20 changes: 0 additions & 20 deletions packages/react-native/Libraries/Components/Pressable/Pressable.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
onBlur,
onKeyDown,
onKeyUp,
validKeysDown,
validKeysUp,
passthroughAllKeyEvents,
keyDownEvents,
keyUpEvents,
Expand Down Expand Up @@ -420,17 +418,6 @@ function Pressable(props: Props, forwardedRef): React.Node {

const accessibilityLabel = ariaLabel ?? props.accessibilityLabel;

// [macOS
let _passthroughAllKeyEvents = passthroughAllKeyEvents;
let _validKeysDown = validKeysDown;
let _validKeysUp = validKeysUp;
if (keyDownEvents || keyUpEvents) {
_passThroughAllKeyboardEvents = true;
_validKeysDown = undefined;
_validKeysUp = undefined;
}
// macOS]

const restPropsWithDefaults: React.ElementConfig<typeof View> = {
...restProps,
...android_rippleConfig?.viewProps,
Expand All @@ -444,13 +431,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
accessibilityLabel,
accessibilityState: _accessibilityState,
focusable: focusable !== false && !disabled, // macOS]
// [macOS
validKeysDown: _validKeysDown,
validKeysUp: _validKeysUp,
passthroughAllKeyEvents: _passthroughAllKeyEvents,
keyDownEvents,
keyUpEvents,
// macOS]
accessibilityValue,
hitSlop,
};
Expand Down
23 changes: 23 additions & 0 deletions packages/react-native/Libraries/Components/View/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ const View: React.AbstractComponent<
nativeID,
pointerEvents,
tabIndex,
// [macOS
passthroughAllKeyEvents,
validKeysDown,
validKeysUp,
keyDownEvents,
keyUpEvents,
// macOS]
...otherProps
}: ViewProps,
forwardedRef,
Expand Down Expand Up @@ -102,6 +109,17 @@ const View: React.AbstractComponent<
// $FlowFixMe[sketchy-null-mixed]
const newPointerEvents = style?.pointerEvents || pointerEvents;

// [macOS
let _passthroughAllKeyEvents = passthroughAllKeyEvents;
let _validKeysDown = validKeysDown;
let _validKeysUp = validKeysUp;
if (keyDownEvents || keyUpEvents) {
_passthroughAllKeyEvents = true;
_validKeysDown = keyDownEvents;
_validKeysUp = keyUpEvents;
}
// macOS]

const actualView = (
<ViewNativeComponent
{...otherProps}
Expand All @@ -123,6 +141,11 @@ const View: React.AbstractComponent<
style={style}
// $FlowFixMe[incompatible-type]
pointerEvents={newPointerEvents}
// [macOS
passthroughAllKeyEvents={_passthroughAllKeyEvents}
validKeysDown={_validKeysDown}
validKeysUp={_validKeysUp}
// macOS]
ref={forwardedRef}
/>
);
Expand Down
Loading

0 comments on commit c7364cc

Please sign in to comment.