react-native-macos 0.68.60 → 0.68.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Pressability/Pressability.js +23 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Views/RCTView.m +6 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/template/Gemfile +1 -1
- package/template/Gemfile.lock +2 -2
- package/template/_ruby-version +1 -1
- package/template/package.json +1 -1
|
@@ -628,12 +628,35 @@ export default class Pressability {
|
|
|
628
628
|
if (onKeyDown != null) {
|
|
629
629
|
onKeyDown(event);
|
|
630
630
|
}
|
|
631
|
+
// Pressables on macOS should respond to the enter/return and spacebar keys.
|
|
632
|
+
// The keyDown event triggers a press event as well as the pressIn effect mimicking a native control behavior.
|
|
633
|
+
if (
|
|
634
|
+
(event.nativeEvent.key === 'Enter' ||
|
|
635
|
+
event.nativeEvent.key === ' ') &&
|
|
636
|
+
event.defaultPrevented !== true
|
|
637
|
+
) {
|
|
638
|
+
const {onPress, onPressIn} = this._config;
|
|
639
|
+
// $FlowFixMe: PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
640
|
+
onPressIn && onPressIn(event);
|
|
641
|
+
// $FlowFixMe: PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
642
|
+
onPress && onPress(event);
|
|
643
|
+
}
|
|
631
644
|
},
|
|
632
645
|
onKeyUp: (event: KeyEvent): void => {
|
|
633
646
|
const {onKeyUp} = this._config;
|
|
634
647
|
if (onKeyUp != null) {
|
|
635
648
|
onKeyUp(event);
|
|
636
649
|
}
|
|
650
|
+
// The keyUp event triggers the pressOut effect.
|
|
651
|
+
if (
|
|
652
|
+
(event.nativeEvent.key === 'Enter' ||
|
|
653
|
+
event.nativeEvent.key === ' ') &&
|
|
654
|
+
event.defaultPrevented !== true
|
|
655
|
+
) {
|
|
656
|
+
const {onPressOut} = this._config;
|
|
657
|
+
// $FlowFixMe: PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
658
|
+
onPressOut && onPressOut(event);
|
|
659
|
+
}
|
|
637
660
|
},
|
|
638
661
|
};
|
|
639
662
|
// ]TODO(macOS GH#774)
|
package/React/Base/RCTVersion.m
CHANGED
package/React/Views/RCTView.m
CHANGED
|
@@ -1632,6 +1632,12 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1632
1632
|
NSArray<NSString *> *validKeys = keyDown ? self.validKeysDown : self.validKeysUp;
|
|
1633
1633
|
NSString *key = [RCTViewKeyboardEvent keyFromEvent:event];
|
|
1634
1634
|
|
|
1635
|
+
// If the view is focusable and the component didn't explicity set the validKeysDown or Up,
|
|
1636
|
+
// allow enter/return and spacebar key events to mimic the behavior of native controls.
|
|
1637
|
+
if (self.focusable && validKeys == nil) {
|
|
1638
|
+
validKeys = @[@"Enter", @" "];
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1635
1641
|
// Only post events for keys we care about
|
|
1636
1642
|
if (![validKeys containsObject:key]) {
|
|
1637
1643
|
return nil;
|
package/package.json
CHANGED
package/template/Gemfile
CHANGED
package/template/Gemfile.lock
CHANGED
package/template/_ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0.
|
|
1
|
+
3.0.5
|