Skip to content

Commit

Permalink
Merge commit '6f7eae5c583090bd62ca60a4c3170445e5a0a751' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Aug 21, 2024
2 parents 990e603 + 1164bc9 commit 8ba4df2
Show file tree
Hide file tree
Showing 41 changed files with 750 additions and 2,130 deletions.
2 changes: 1 addition & 1 deletion packages/helloworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-native": "1000.0.0"
"react-native-macos": "workspace:*"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-test-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@react-native/babel-preset": "0.75.0-main",
"react-native": "*"
"react-native-macos": "workspace:*"
},
"peerDependencies": {
"react": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ - (RCTPlatformView *)viewWithModuleName:(NSString *)moduleName // [macOS]
initWithSurface:surface
sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];

#if !TARGET_OS_OSX // [macOS] TODO SAAD
#if !TARGET_OS_OSX // [macOS]
surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
#endif // [macOS]
if (self->_configuration.customizeRootView != nil) {
Expand Down Expand Up @@ -185,7 +185,7 @@ - (RCTPlatformView *)createRootViewWithBridge:(RCTBridge *)bridge
BOOL enableFabric = self->_configuration.fabricEnabled;
RCTPlatformView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric); // [macOS]

#if !TARGET_OS_OSX // [macOS] TODO SAAD
#if !TARGET_OS_OSX // [macOS]
rootView.backgroundColor = [UIColor systemBackgroundColor];
#endif // [macOS]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ class TouchableBounce extends React.Component<Props, State> {
hitSlop={this.props.hitSlop}
// [macOS
acceptsFirstMouse={
this.props.acceptsFirstMouse !== false && !this.props.disabled
this.props.acceptsFirstMouse !== false &&
this.props.acceptsFirstMouse !== undefined &&
!this.props.disabled
}
enableFocusRing={
(this.props.enableFocusRing === undefined ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,8 @@ class TouchableHighlight extends React.Component<Props, State> {

// BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
// adopting `Pressability`, so preserve that behavior.
const {
onBlur,
onFocus,
onMouseEnter, // [macOS]
onMouseLeave, // [macOS]
...eventHandlersWithoutBlurAndFocus
} = this.state.pressability.getEventHandlers();
const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} =
this.state.pressability.getEventHandlers();

const accessibilityState =
this.props.disabled != null
Expand Down Expand Up @@ -355,16 +350,16 @@ class TouchableHighlight extends React.Component<Props, State> {
testID={this.props.testID}
// [macOS
acceptsFirstMouse={
this.props.acceptsFirstMouse !== false && !this.props.disabled
this.props.acceptsFirstMouse !== false &&
this.props.acceptsFirstMouse !== undefined &&
!this.props.disabled
}
enableFocusRing={
(this.props.enableFocusRing === undefined ||
this.props.enableFocusRing === true) &&
!this.props.disabled
}
tooltip={this.props.tooltip}
onMouseEnter={this.props.onMouseEnter}
onMouseLeave={this.props.onMouseLeave}
onDragEnter={this.props.onDragEnter}
onDragLeave={this.props.onDragLeave}
onDrop={this.props.onDrop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ class TouchableOpacity extends React.Component<Props, State> {
!this.props.disabled
}
acceptsFirstMouse={
this.props.acceptsFirstMouse !== false && !this.props.disabled
this.props.acceptsFirstMouse !== false &&
this.props.acceptsFirstMouse !== undefined &&
!this.props.disabled
}
tooltip={this.props.tooltip}
onMouseEnter={this.props.onMouseEnter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import type {EdgeInsetsOrSizeProp} from '../../StyleSheet/EdgeInsetsPropType';
import type {
BlurEvent,
FocusEvent,
KeyEvent,
KeyEvent, // [macOS]
LayoutEvent,
MouseEvent,
MouseEvent, // [macOS]
PressEvent,
// [macOS]
} from '../../Types/CoreEventTypes';
// [macOS
import type {DraggedTypesType} from '../View/DraggedType';
Expand Down Expand Up @@ -130,15 +129,15 @@ const PASSTHROUGH_PROPS = [
'validKeysDown',
'validKeysUp',
'onLayout',
// [macOS
// [macOS
'onMouseEnter',
'onMouseLeave',
'onDragEnter',
'onDragLeave',
'onDrop',
'draggedTypes',
'tooltip',
// macOS]
// macOS]
'testID',
];

Expand Down Expand Up @@ -250,11 +249,11 @@ module.exports = function TouchableWithoutFeedback(props: Props): React.Node {
!props.disabled,
// [macOS
acceptsFirstMouse:
this.props.acceptsFirstMouse !== false &&
props.acceptsFirstMouse !== false &&
props.onPress !== undefined &&
!props.disabled,
enableFocusRing:
this.props.enableFocusRing !== false &&
props.enableFocusRing !== false &&
props.onPress !== undefined &&
!props.disabled,
// macOS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`TouchableHighlight renders correctly 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityValue={
Object {
"max": undefined,
Expand Down Expand Up @@ -99,7 +99,7 @@ exports[`TouchableHighlight with disabled state should be disabled when disabled

exports[`TouchableHighlight with disabled state should disable button when accessibilityState is disabled 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityState={
Object {
"disabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`TouchableOpacity renders correctly 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityState={
Object {
"busy": undefined,
Expand Down Expand Up @@ -92,7 +92,7 @@ exports[`TouchableOpacity renders in disabled state when a disabled prop is pass

exports[`TouchableOpacity renders in disabled state when a key disabled in accessibilityState is passed 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityState={
Object {
"busy": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`TouchableWithoutFeedback renders correctly 1`] = `
<Text
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityState={
Object {
"busy": undefined,
Expand All @@ -13,7 +13,7 @@ exports[`TouchableWithoutFeedback renders correctly 1`] = `
}
}
accessible={true}
enableFocusRing={true}
enableFocusRing={false}
focusable={false}
onClick={[Function]}
onKeyDown={[Function]}
Expand Down Expand Up @@ -85,7 +85,7 @@ exports[`TouchableWithoutFeedback with disabled state should be disabled when di

exports[`TouchableWithoutFeedback with disabled state should disable button when accessibilityState is disabled 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityState={
Object {
"busy": undefined,
Expand All @@ -96,7 +96,7 @@ exports[`TouchableWithoutFeedback with disabled state should disable button when
}
}
accessible={true}
enableFocusRing={true}
enableFocusRing={false}
focusable={false}
onClick={[Function]}
onKeyDown={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ exports[`<Button /> should be disabled when disabled={true} and accessibilitySta

exports[`<Button /> should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no} 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
Object {
Expand Down Expand Up @@ -278,7 +278,7 @@ exports[`<Button /> should be set importantForAccessibility={no-hide-descendants

exports[`<Button /> should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no-hide-descendants} 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
Object {
Expand Down Expand Up @@ -344,7 +344,7 @@ exports[`<Button /> should be set importantForAccessibility={no-hide-descendants

exports[`<Button /> should not be disabled when disabled={false} and accessibilityState={{disabled: false}} 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
Object {
Expand Down Expand Up @@ -410,7 +410,7 @@ exports[`<Button /> should not be disabled when disabled={false} and accessibili

exports[`<Button /> should not be disabled when disabled={false} and accessibilityState={{disabled: true}} 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
Object {
Expand Down Expand Up @@ -546,7 +546,7 @@ exports[`<Button /> should overwrite accessibilityState with value of disabled p

exports[`<Button /> should render as expected 1`] = `
<View
acceptsFirstMouse={true}
acceptsFirstMouse={false}
accessibilityRole="button"
accessibilityState={
Object {
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/Libraries/Image/RCTImageLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
- (instancetype)initWithRedirectDelegate:(id<RCTImageRedirectProtocol>)redirectDelegate
loadersProvider:(NSArray<id<RCTImageURLLoader>> * (^)(RCTModuleRegistry *))getLoaders
decodersProvider:(NSArray<id<RCTImageDataDecoder>> * (^)(RCTModuleRegistry *))getDecoders;
- (NSInteger)activeTasks; // [macOS]
@end

/**
Expand Down
6 changes: 0 additions & 6 deletions packages/react-native/Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,6 @@ - (void)dequeueTasks
});
}

// [macOS
- (NSInteger)activeTasks {
return _activeTasks;
}
// macOS]

/**
* This returns either an image, or raw image data, depending on the loading
* path taken. This is useful if you want to skip decoding, e.g. when preloading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ exports[`LogBoxInspectorStackFrames should render stack frames with 1 frame coll
}
>
<View
acceptsFirstMouse={true}
accessibilityState={
Object {
"busy": undefined,
Expand All @@ -149,8 +150,11 @@ exports[`LogBoxInspectorStackFrames should render stack frames with 1 frame coll
}
}
accessible={true}
enableFocusRing={true}
focusable={true}
onClick={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type CursorValue =
| 'sw-resize'
| 'text'
| 'url'
| 'vertical-text'
| 'w-resize'
| 'wait'
| 'zoom-in'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export type CursorValue =
| 'sw-resize'
| 'text'
| 'url'
| 'vertical-text'
| 'w-resize'
| 'wait'
| 'zoom-in'
| 'zoom-out';
// macOS]


/**
* React Native's layout system is based on Flexbox and is powered both
* on iOS and Android by an open source project called `Yoga`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ @implementation RCTBaseTextInputView {
BOOL _hasInputAccessoryView;
// [macOS] remove explicit _predictedText ivar declaration
BOOL _didMoveToWindow;
#if TARGET_OS_OSX // [macOS avoids duplicating effects of textInputDid(Begin|End)Editing calls
BOOL _isCurrentlyEditing;
#endif // macOS]
}

#if !TARGET_OS_OSX // [macOS]
Expand Down Expand Up @@ -72,9 +75,12 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // [macOS]
_bridge = bridge;
_eventDispatcher = bridge.eventDispatcher;
#if !TARGET_OS_OSX // [macOS] TODO - Implement for macOS and visionOS?
[self initializeReturnKeyType];
#if TARGET_OS_OSX // [macOS
_isCurrentlyEditing = NO;
#endif // macOS]
#if TARGET_OS_IOS // [macOS] [visionOS]
[self initializeReturnKeyType];
#endif // [macOS] [visionOS]
}

return self;
Expand Down Expand Up @@ -450,6 +456,13 @@ - (BOOL)textInputShouldBeginEditing

- (void)textInputDidBeginEditing
{
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
if (_isCurrentlyEditing) {
return;
}
_isCurrentlyEditing = YES;
#endif // macOS]

if (_clearTextOnFocus) {
self.backedTextInputView.attributedText = [NSAttributedString new];
}
Expand Down Expand Up @@ -478,6 +491,13 @@ - (BOOL)textInputShouldEndEditing

- (void)textInputDidEndEditing
{
#if TARGET_OS_OSX // [macOS consolidate duplicate callbacks
if (!_isCurrentlyEditing) {
return;
}
_isCurrentlyEditing = NO;
#endif // macOS]

self.ghostText = nil; // [macOS]

[_eventDispatcher sendTextEventWithType:RCTTextEventTypeEnd
Expand Down Expand Up @@ -839,7 +859,7 @@ - (void)didMoveToWindow
{
if (self.autoFocus && !_didMoveToWindow) {
[self.backedTextInputView reactFocus];
#if !TARGET_OS_OSX // [macOS] TODO - Implement for macOS and visionOS?
#if TARGET_OS_IOS // [macOS] [visionOS]
[self initializeReturnKeyType];
#endif // [macOS]
} else {
Expand All @@ -851,7 +871,7 @@ - (void)didMoveToWindow

#pragma mark - Custom Input Accessory View

#if TARGET_OS_IOS // [macOS] [visionOS]
#if TARGET_OS_IOS // [macOS] [visionOS] Input Accessory Views are only a concept on iOS
- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
if ([changedProps containsObject:@"inputAccessoryViewID"] && self.inputAccessoryViewID) {
Expand Down Expand Up @@ -985,6 +1005,7 @@ - (void)handleInputAccessoryDoneButton
#endif // [macOS] [visionOS]

// [macOS
#pragma mark - Ghost Text

- (NSDictionary<NSAttributedStringKey, id> *)ghostTextAttributes
{
Expand Down
Loading

0 comments on commit 8ba4df2

Please sign in to comment.