react-native-macos 0.78.2 → 0.78.4
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/Components/TextInput/TextInput.d.ts +16 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +2 -0
- package/Libraries/Components/TextInput/TextInput.js +7 -3
- package/Libraries/Components/TextInput/TextInputState.js +5 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Lists/FillRateHelper.js +3 -3
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionList.d.ts +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +2 -2
- package/Libraries/Lists/ViewabilityHelper.js +3 -3
- package/Libraries/Lists/VirtualizeUtils.js +2 -2
- package/Libraries/Lists/VirtualizedList.js +3 -3
- package/Libraries/Lists/VirtualizedListContext.js +2 -2
- package/Libraries/Lists/VirtualizedSectionList.js +3 -3
- package/Libraries/Modal/Modal.js +1 -1
- package/Libraries/Network/RCTDataRequestHandler.mm +17 -3
- package/Libraries/Network/RCTFileRequestHandler.mm +17 -3
- package/Libraries/Text/Text.d.ts +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +7 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +11 -4
- package/React/Views/RCTViewKeyboardEvent.m +24 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +13 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +0 -3
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +24 -13
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +5 -1
- package/package.json +12 -12
- package/scripts/cocoapods/utils.rb +11 -5
- package/sdks/hermes-engine/hermes-engine.podspec +3 -4
- package/sdks/hermes-engine/hermes-utils.rb +70 -18
- package/types/index.d.ts +1 -1
|
@@ -1089,6 +1089,22 @@ interface TextInputState {
|
|
|
1089
1089
|
* noop if it wasn't focused
|
|
1090
1090
|
*/
|
|
1091
1091
|
blurTextInput(textField?: HostInstance): void;
|
|
1092
|
+
|
|
1093
|
+
// [macOS
|
|
1094
|
+
/**
|
|
1095
|
+
* @param textField ref of the text field that was focused
|
|
1096
|
+
* Call on custom implementations of TextInput to notify the control was focused
|
|
1097
|
+
* noop if it was already focused
|
|
1098
|
+
*/
|
|
1099
|
+
onTextInputFocus(textField?: HostInstance): void;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* @param textField ref of the text field that was blurred
|
|
1103
|
+
* Call on custom implementations of TextInput to notify the control was blurred
|
|
1104
|
+
* noop if it wasn't focused
|
|
1105
|
+
*/
|
|
1106
|
+
onTextInputBlur(textField?: HostInstance): void;
|
|
1107
|
+
// macOS]
|
|
1092
1108
|
}
|
|
1093
1109
|
|
|
1094
1110
|
/**
|
|
@@ -1255,6 +1255,8 @@ export type TextInputComponentStatics = $ReadOnly<{|
|
|
|
1255
1255
|
currentlyFocusedField: () => ?number,
|
|
1256
1256
|
focusTextInput: (textField: ?HostInstance) => void,
|
|
1257
1257
|
blurTextInput: (textField: ?HostInstance) => void,
|
|
1258
|
+
onTextInputFocus: (textField: ?HostInstance) => void, // [macOS]
|
|
1259
|
+
onTextInputBlur: (textField: ?HostInstance) => void, // [macOS]
|
|
1258
1260
|
|}>,
|
|
1259
1261
|
|}>;
|
|
1260
1262
|
|
|
@@ -1166,7 +1166,7 @@ function useTextInputStateSynchronization_STATE({
|
|
|
1166
1166
|
mostRecentEventCount: number,
|
|
1167
1167
|
selection: ?Selection,
|
|
1168
1168
|
inputRef: React.RefObject<null | HostInstance>,
|
|
1169
|
-
text
|
|
1169
|
+
text?: string,
|
|
1170
1170
|
viewCommands: ViewCommands,
|
|
1171
1171
|
}): {
|
|
1172
1172
|
setLastNativeText: string => void,
|
|
@@ -1247,7 +1247,7 @@ function useTextInputStateSynchronization_REFS({
|
|
|
1247
1247
|
mostRecentEventCount: number,
|
|
1248
1248
|
selection: ?Selection,
|
|
1249
1249
|
inputRef: React.RefObject<null | HostInstance>,
|
|
1250
|
-
text
|
|
1250
|
+
text?: string,
|
|
1251
1251
|
viewCommands: ViewCommands,
|
|
1252
1252
|
}): {
|
|
1253
1253
|
setLastNativeText: string => void,
|
|
@@ -1474,7 +1474,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1474
1474
|
? props.value
|
|
1475
1475
|
: typeof props.defaultValue === 'string'
|
|
1476
1476
|
? props.defaultValue
|
|
1477
|
-
:
|
|
1477
|
+
: undefined;
|
|
1478
1478
|
|
|
1479
1479
|
const viewCommands =
|
|
1480
1480
|
AndroidTextInputCommands ||
|
|
@@ -2045,6 +2045,8 @@ ExportedForwardRef.State = {
|
|
|
2045
2045
|
currentlyFocusedField: TextInputState.currentlyFocusedField,
|
|
2046
2046
|
focusTextInput: TextInputState.focusTextInput,
|
|
2047
2047
|
blurTextInput: TextInputState.blurTextInput,
|
|
2048
|
+
onTextInputFocus: TextInputState.focusInput, // [macOS]
|
|
2049
|
+
onTextInputBlur: TextInputState.blurInput, // [macOS]
|
|
2048
2050
|
};
|
|
2049
2051
|
|
|
2050
2052
|
export type TextInputComponentStatics = $ReadOnly<{|
|
|
@@ -2053,6 +2055,8 @@ export type TextInputComponentStatics = $ReadOnly<{|
|
|
|
2053
2055
|
currentlyFocusedField: typeof TextInputState.currentlyFocusedField,
|
|
2054
2056
|
focusTextInput: typeof TextInputState.focusTextInput,
|
|
2055
2057
|
blurTextInput: typeof TextInputState.blurTextInput,
|
|
2058
|
+
onTextInputFocus: typeof TextInputState.focusInput, // [macOS]
|
|
2059
|
+
onTextInputBlur: typeof TextInputState.blurInput, // [macOS]
|
|
2056
2060
|
|}>,
|
|
2057
2061
|
|}>;
|
|
2058
2062
|
|
|
@@ -103,7 +103,11 @@ function focusTextInput(textField: ?HostInstance) {
|
|
|
103
103
|
|
|
104
104
|
if (textField != null) {
|
|
105
105
|
const fieldCanBeFocused =
|
|
106
|
-
currentlyFocusedInputRef
|
|
106
|
+
// [macOS currentlyFocusedInputRef does not account for the fact that any arbritrary view can
|
|
107
|
+
// recieve focus on desktop. https://github.com/facebook/react-native/pull/52472/ fixes this,
|
|
108
|
+
// disable the check for now
|
|
109
|
+
// currentlyFocusedInputRef !== textField &&
|
|
110
|
+
// macOS]
|
|
107
111
|
// $FlowFixMe - `currentProps` is missing in `NativeMethods`
|
|
108
112
|
textField.currentProps?.editable !== false;
|
|
109
113
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {RenderItemProps} from '@react-native-
|
|
13
|
+
import type {RenderItemProps} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const ScrollView = require('../Components/ScrollView/ScrollView');
|
|
16
16
|
const TouchableHighlight = require('../Components/Touchable/TouchableHighlight');
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import {typeof FillRateHelper as FillRateHelperType} from '@react-native-
|
|
13
|
+
import {typeof FillRateHelper as FillRateHelperType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const FillRateHelper: FillRateHelperType =
|
|
16
|
-
require('@react-native-
|
|
16
|
+
require('@react-native-macos/virtualized-lists').FillRateHelper; // [macOS]
|
|
17
17
|
|
|
18
|
-
export type {FillRateInfo} from '@react-native-
|
|
18
|
+
export type {FillRateInfo} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
19
19
|
module.exports = FillRateHelper;
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
ViewToken,
|
|
14
14
|
VirtualizedListProps,
|
|
15
15
|
ViewabilityConfig,
|
|
16
|
-
} from '@react-native-
|
|
16
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
17
17
|
import type {ScrollViewComponent} from '../Components/ScrollView/ScrollView';
|
|
18
18
|
import type {StyleProp} from '../StyleSheet/StyleSheet';
|
|
19
19
|
import type {ViewStyle} from '../StyleSheet/StyleSheetTypes';
|
|
@@ -15,14 +15,14 @@ import type {
|
|
|
15
15
|
RenderItemType,
|
|
16
16
|
ViewabilityConfigCallbackPair,
|
|
17
17
|
ViewToken,
|
|
18
|
-
} from '@react-native-
|
|
18
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
19
19
|
|
|
20
20
|
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
21
21
|
import {type ScrollResponderType} from '../Components/ScrollView/ScrollView';
|
|
22
22
|
import {
|
|
23
23
|
VirtualizedList,
|
|
24
24
|
keyExtractor as defaultKeyExtractor,
|
|
25
|
-
} from '@react-native-
|
|
25
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
26
26
|
import memoizeOne from 'memoize-one';
|
|
27
27
|
|
|
28
28
|
const View = require('../Components/View/View');
|
|
@@ -11,7 +11,7 @@ import type * as React from 'react';
|
|
|
11
11
|
import type {
|
|
12
12
|
ListRenderItemInfo,
|
|
13
13
|
VirtualizedListWithoutRenderItemProps,
|
|
14
|
-
} from '@react-native-
|
|
14
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
15
15
|
import type {
|
|
16
16
|
ScrollView,
|
|
17
17
|
ScrollViewProps,
|
|
@@ -15,10 +15,10 @@ import type {
|
|
|
15
15
|
ScrollToLocationParamsType,
|
|
16
16
|
SectionBase as _SectionBase,
|
|
17
17
|
VirtualizedSectionListProps,
|
|
18
|
-
} from '@react-native-
|
|
18
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
19
19
|
|
|
20
20
|
import Platform from '../Utilities/Platform';
|
|
21
|
-
import {VirtualizedSectionList} from '@react-native-
|
|
21
|
+
import {VirtualizedSectionList} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
22
22
|
import * as React from 'react';
|
|
23
23
|
|
|
24
24
|
type Item = any;
|
|
@@ -15,11 +15,11 @@ import type {
|
|
|
15
15
|
ScrollToLocationParamsType,
|
|
16
16
|
SectionBase as _SectionBase,
|
|
17
17
|
VirtualizedSectionListProps,
|
|
18
|
-
} from '@react-native-
|
|
18
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
19
19
|
import type {ElementRef} from 'react';
|
|
20
20
|
|
|
21
21
|
import Platform from '../Utilities/Platform';
|
|
22
|
-
import {VirtualizedSectionList} from '@react-native-
|
|
22
|
+
import {VirtualizedSectionList} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
23
23
|
import React, {forwardRef, useImperativeHandle, useRef} from 'react';
|
|
24
24
|
|
|
25
25
|
type Item = any;
|
|
@@ -14,11 +14,11 @@ export type {
|
|
|
14
14
|
ViewToken,
|
|
15
15
|
ViewabilityConfig,
|
|
16
16
|
ViewabilityConfigCallbackPair,
|
|
17
|
-
} from '@react-native-
|
|
17
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
18
18
|
|
|
19
|
-
import {typeof ViewabilityHelper as ViewabilityHelperType} from '@react-native-
|
|
19
|
+
import {typeof ViewabilityHelper as ViewabilityHelperType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
20
20
|
|
|
21
21
|
const ViewabilityHelper: ViewabilityHelperType =
|
|
22
|
-
require('@react-native-
|
|
22
|
+
require('@react-native-macos/virtualized-lists').ViewabilityHelper; // [macOS]
|
|
23
23
|
|
|
24
24
|
module.exports = ViewabilityHelper;
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import {typeof keyExtractor as KeyExtractorType} from '@react-native-
|
|
13
|
+
import {typeof keyExtractor as KeyExtractorType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const keyExtractor: KeyExtractorType =
|
|
16
|
-
require('@react-native-
|
|
16
|
+
require('@react-native-macos/virtualized-lists').keyExtractor; // [macOS]
|
|
17
17
|
|
|
18
18
|
module.exports = {keyExtractor};
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import {typeof VirtualizedList as VirtualizedListType} from '@react-native-
|
|
13
|
+
import {typeof VirtualizedList as VirtualizedListType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const VirtualizedList: VirtualizedListType =
|
|
16
|
-
require('@react-native-
|
|
16
|
+
require('@react-native-macos/virtualized-lists').VirtualizedList; // [macOS]
|
|
17
17
|
|
|
18
18
|
export type {
|
|
19
19
|
RenderItemProps,
|
|
20
20
|
RenderItemType,
|
|
21
21
|
Separators,
|
|
22
|
-
} from '@react-native-
|
|
22
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
23
23
|
module.exports = VirtualizedList;
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterType} from '@react-native-
|
|
13
|
+
import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const VirtualizedListContextResetter: VirtualizedListContextResetterType =
|
|
16
|
-
require('@react-native-
|
|
16
|
+
require('@react-native-macos/virtualized-lists').VirtualizedListContextResetter; // [macOS]
|
|
17
17
|
|
|
18
18
|
module.exports = {VirtualizedListContextResetter};
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import {typeof VirtualizedSectionList as VirtualizedSectionListType} from '@react-native-
|
|
13
|
+
import {typeof VirtualizedSectionList as VirtualizedSectionListType} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
14
14
|
|
|
15
15
|
const VirtualizedSectionList: VirtualizedSectionListType =
|
|
16
|
-
require('@react-native-
|
|
16
|
+
require('@react-native-macos/virtualized-lists').VirtualizedSectionList; // [macOS]
|
|
17
17
|
|
|
18
18
|
export type {
|
|
19
19
|
SectionBase,
|
|
20
20
|
ScrollToLocationParamsType,
|
|
21
|
-
} from '@react-native-
|
|
21
|
+
} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
22
22
|
module.exports = VirtualizedSectionList;
|
package/Libraries/Modal/Modal.js
CHANGED
|
@@ -17,7 +17,7 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
|
|
17
17
|
import ModalInjection from './ModalInjection';
|
|
18
18
|
import NativeModalManager from './NativeModalManager';
|
|
19
19
|
import RCTModalHostView from './RCTModalHostViewNativeComponent';
|
|
20
|
-
import {VirtualizedListContextResetter} from '@react-native-
|
|
20
|
+
import {VirtualizedListContextResetter} from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
21
21
|
|
|
22
22
|
const ScrollView = require('../Components/ScrollView/ScrollView');
|
|
23
23
|
const View = require('../Components/View/View');
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#import <React/RCTDataRequestHandler.h>
|
|
9
9
|
#import <ReactCommon/RCTTurboModule.h>
|
|
10
10
|
|
|
11
|
+
#import <mutex>
|
|
12
|
+
|
|
11
13
|
#import "RCTNetworkPlugins.h"
|
|
12
14
|
|
|
13
15
|
@interface RCTDataRequestHandler () <RCTTurboModule>
|
|
@@ -15,14 +17,22 @@
|
|
|
15
17
|
|
|
16
18
|
@implementation RCTDataRequestHandler {
|
|
17
19
|
NSOperationQueue *_queue;
|
|
20
|
+
std::mutex _operationHandlerMutexLock;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
RCT_EXPORT_MODULE()
|
|
21
24
|
|
|
22
25
|
- (void)invalidate
|
|
23
26
|
{
|
|
24
|
-
|
|
25
|
-
_queue
|
|
27
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
28
|
+
if (_queue) {
|
|
29
|
+
for (NSOperation *operation in _queue.operations) {
|
|
30
|
+
if (!operation.isCancelled && !operation.isFinished) {
|
|
31
|
+
[operation cancel];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
_queue = nil;
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
|
@@ -32,6 +42,7 @@ RCT_EXPORT_MODULE()
|
|
|
32
42
|
|
|
33
43
|
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
|
34
44
|
{
|
|
45
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
35
46
|
// Lazy setup
|
|
36
47
|
if (!_queue) {
|
|
37
48
|
_queue = [NSOperationQueue new];
|
|
@@ -73,7 +84,10 @@ RCT_EXPORT_MODULE()
|
|
|
73
84
|
|
|
74
85
|
- (void)cancelRequest:(NSOperation *)op
|
|
75
86
|
{
|
|
76
|
-
|
|
87
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
88
|
+
if (!op.isCancelled && !op.isFinished) {
|
|
89
|
+
[op cancel];
|
|
90
|
+
}
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#import <React/RCTFileRequestHandler.h>
|
|
9
9
|
|
|
10
|
+
#import <mutex>
|
|
11
|
+
|
|
10
12
|
#if !TARGET_OS_OSX // [macOS]
|
|
11
13
|
#import <MobileCoreServices/MobileCoreServices.h>
|
|
12
14
|
#else // [macOS
|
|
@@ -23,14 +25,22 @@
|
|
|
23
25
|
|
|
24
26
|
@implementation RCTFileRequestHandler {
|
|
25
27
|
NSOperationQueue *_fileQueue;
|
|
28
|
+
std::mutex _operationHandlerMutexLock;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
RCT_EXPORT_MODULE()
|
|
29
32
|
|
|
30
33
|
- (void)invalidate
|
|
31
34
|
{
|
|
32
|
-
|
|
33
|
-
_fileQueue
|
|
35
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
36
|
+
if (_fileQueue) {
|
|
37
|
+
for (NSOperation *operation in _fileQueue.operations) {
|
|
38
|
+
if (!operation.isCancelled && !operation.isFinished) {
|
|
39
|
+
[operation cancel];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_fileQueue = nil;
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
|
@@ -40,6 +50,7 @@ RCT_EXPORT_MODULE()
|
|
|
40
50
|
|
|
41
51
|
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
|
42
52
|
{
|
|
53
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
43
54
|
// Lazy setup
|
|
44
55
|
if (!_fileQueue) {
|
|
45
56
|
_fileQueue = [NSOperationQueue new];
|
|
@@ -91,7 +102,10 @@ RCT_EXPORT_MODULE()
|
|
|
91
102
|
|
|
92
103
|
- (void)cancelRequest:(NSOperation *)op
|
|
93
104
|
{
|
|
94
|
-
|
|
105
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
106
|
+
if (!op.isCancelled && !op.isFinished) {
|
|
107
|
+
[op cancel];
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
|
|
97
111
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
package/Libraries/Text/Text.d.ts
CHANGED
|
@@ -513,6 +513,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
|
|
|
513
513
|
|
|
514
514
|
- (void)textInputDidBeginEditing
|
|
515
515
|
{
|
|
516
|
+
#if TARGET_OS_OSX // [macOS
|
|
517
|
+
if (_isCurrentlyEditing) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
_isCurrentlyEditing = YES;
|
|
521
|
+
#endif // macOS]
|
|
522
|
+
|
|
516
523
|
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus
|
|
517
524
|
reactTag:self.reactTag
|
|
518
525
|
text:[self.backedTextInputView.attributedText.string copy]
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
|
|
162
162
|
- (NSArray<NSAttributedStringKey> *)validAttributesForMarkedText
|
|
163
163
|
{
|
|
164
|
-
return ((NSTextView *)self.currentEditor).validAttributesForMarkedText;
|
|
164
|
+
return ((NSTextView *)self.currentEditor).validAttributesForMarkedText ?: @[];
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
#endif // macOS]
|
|
@@ -18,7 +18,7 @@ const Switch = require('../Components/Switch/Switch').default;
|
|
|
18
18
|
const TextInput = require('../Components/TextInput/TextInput');
|
|
19
19
|
const View = require('../Components/View/View');
|
|
20
20
|
const Text = require('../Text/Text');
|
|
21
|
-
const {VirtualizedList} = require('@react-native-
|
|
21
|
+
const {VirtualizedList} = require('@react-native-macos/virtualized-lists'); // [macOS]
|
|
22
22
|
const React = require('react');
|
|
23
23
|
const ReactTestRenderer = require('react-test-renderer');
|
|
24
24
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
using namespace facebook::react;
|
|
26
26
|
|
|
27
|
+
static NSString *sRCTDevLoadingViewWindowIdentifier = @"RCTDevLoadingViewWindow";
|
|
28
|
+
|
|
27
29
|
@interface RCTDevLoadingView () <NativeDevLoadingViewSpec>
|
|
28
30
|
@end
|
|
29
31
|
|
|
@@ -121,16 +123,17 @@ RCT_EXPORT_MODULE()
|
|
|
121
123
|
|
|
122
124
|
self->_showDate = [NSDate date];
|
|
123
125
|
|
|
124
|
-
RCTPlatformWindow *mainWindow = RCTKeyWindow(); // [macOS]
|
|
125
126
|
#if !TARGET_OS_OSX // [macOS]
|
|
127
|
+
UIWindow *mainWindow = RCTKeyWindow();
|
|
126
128
|
self->_window = [[UIWindow alloc] initWithWindowScene:mainWindow.windowScene];
|
|
127
129
|
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
|
|
128
130
|
self->_window.rootViewController = [UIViewController new];
|
|
129
131
|
#else // [macOS
|
|
130
|
-
self->_window = [[
|
|
132
|
+
self->_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 375, 20)
|
|
131
133
|
styleMask:NSWindowStyleMaskBorderless
|
|
132
134
|
backing:NSBackingStoreBuffered
|
|
133
135
|
defer:YES];
|
|
136
|
+
[self->_window setIdentifier:sRCTDevLoadingViewWindowIdentifier];
|
|
134
137
|
#endif // macOS]
|
|
135
138
|
|
|
136
139
|
self->_container = [[RCTUIView alloc] init]; // [macOS]
|
|
@@ -220,7 +223,11 @@ RCT_EXPORT_METHOD(hide)
|
|
|
220
223
|
self->_hiding = false;
|
|
221
224
|
}];
|
|
222
225
|
#else // [macOS]
|
|
223
|
-
[RCTKeyWindow()
|
|
226
|
+
for (NSWindow *window in [RCTKeyWindow() sheets]) {
|
|
227
|
+
if ([[window identifier] isEqualToString:sRCTDevLoadingViewWindowIdentifier]) {
|
|
228
|
+
[RCTKeyWindow() endSheet:window];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
224
231
|
self->_window = nil;
|
|
225
232
|
self->_hiding = false;
|
|
226
233
|
#endif // macOS]
|
|
@@ -350,4 +357,4 @@ RCT_EXPORT_METHOD(hide)
|
|
|
350
357
|
Class RCTDevLoadingViewCls(void)
|
|
351
358
|
{
|
|
352
359
|
return RCTDevLoadingView.class;
|
|
353
|
-
}
|
|
360
|
+
}
|
|
@@ -63,6 +63,30 @@
|
|
|
63
63
|
return @"PageUp";
|
|
64
64
|
} else if (code == NSPageDownFunctionKey) {
|
|
65
65
|
return @"PageDown";
|
|
66
|
+
} else if (code == NSF1FunctionKey) {
|
|
67
|
+
return @"F1";
|
|
68
|
+
} else if (code == NSF2FunctionKey) {
|
|
69
|
+
return @"F2";
|
|
70
|
+
} else if (code == NSF3FunctionKey) {
|
|
71
|
+
return @"F3";
|
|
72
|
+
} else if (code == NSF4FunctionKey) {
|
|
73
|
+
return @"F4";
|
|
74
|
+
} else if (code == NSF5FunctionKey) {
|
|
75
|
+
return @"F5";
|
|
76
|
+
} else if (code == NSF6FunctionKey) {
|
|
77
|
+
return @"F6";
|
|
78
|
+
} else if (code == NSF7FunctionKey) {
|
|
79
|
+
return @"F7";
|
|
80
|
+
} else if (code == NSF8FunctionKey) {
|
|
81
|
+
return @"F8";
|
|
82
|
+
} else if (code == NSF9FunctionKey) {
|
|
83
|
+
return @"F9";
|
|
84
|
+
} else if (code == NSF10FunctionKey) {
|
|
85
|
+
return @"F10";
|
|
86
|
+
} else if (code == NSF11FunctionKey) {
|
|
87
|
+
return @"F11";
|
|
88
|
+
} else if (code == NSF12FunctionKey) {
|
|
89
|
+
return @"F12";
|
|
66
90
|
}
|
|
67
91
|
|
|
68
92
|
return key;
|
|
@@ -173,7 +173,7 @@ public class FabricUIManager
|
|
|
173
173
|
private final CopyOnWriteArrayList<UIManagerListener> mListeners = new CopyOnWriteArrayList<>();
|
|
174
174
|
|
|
175
175
|
private boolean mMountNotificationScheduled = false;
|
|
176
|
-
private
|
|
176
|
+
private List<Integer> mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
|
177
177
|
|
|
178
178
|
@ThreadConfined(UI)
|
|
179
179
|
@NonNull
|
|
@@ -1250,12 +1250,15 @@ public class FabricUIManager
|
|
|
1250
1250
|
|
|
1251
1251
|
// Collect surface IDs for all the mount items
|
|
1252
1252
|
for (MountItem mountItem : mountItems) {
|
|
1253
|
-
if (mountItem != null
|
|
1254
|
-
|
|
1253
|
+
if (mountItem != null
|
|
1254
|
+
&& !mSurfaceIdsWithPendingMountNotification.contains(mountItem.getSurfaceId())) {
|
|
1255
|
+
mSurfaceIdsWithPendingMountNotification.add(mountItem.getSurfaceId());
|
|
1255
1256
|
}
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
1258
|
-
if (!mMountNotificationScheduled && !
|
|
1259
|
+
if (!mMountNotificationScheduled && !mSurfaceIdsWithPendingMountNotification.isEmpty()) {
|
|
1260
|
+
mMountNotificationScheduled = true;
|
|
1261
|
+
|
|
1259
1262
|
// Notify mount when the effects are visible and prevent mount hooks to
|
|
1260
1263
|
// delay paint.
|
|
1261
1264
|
UiThreadUtil.getUiThreadHandler()
|
|
@@ -1265,17 +1268,19 @@ public class FabricUIManager
|
|
|
1265
1268
|
public void run() {
|
|
1266
1269
|
mMountNotificationScheduled = false;
|
|
1267
1270
|
|
|
1271
|
+
// Create a copy in case mount hooks trigger more mutations
|
|
1272
|
+
final List<Integer> surfaceIdsToReportMount =
|
|
1273
|
+
mSurfaceIdsWithPendingMountNotification;
|
|
1274
|
+
mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
|
1275
|
+
|
|
1268
1276
|
final @Nullable FabricUIManagerBinding binding = mBinding;
|
|
1269
1277
|
if (binding == null || mDestroyed) {
|
|
1270
|
-
mMountedSurfaceIds.clear();
|
|
1271
1278
|
return;
|
|
1272
1279
|
}
|
|
1273
1280
|
|
|
1274
|
-
for (int surfaceId :
|
|
1281
|
+
for (int surfaceId : surfaceIdsToReportMount) {
|
|
1275
1282
|
binding.reportMount(surfaceId);
|
|
1276
1283
|
}
|
|
1277
|
-
|
|
1278
|
-
mMountedSurfaceIds.clear();
|
|
1279
1284
|
}
|
|
1280
1285
|
});
|
|
1281
1286
|
}
|
|
@@ -588,9 +588,6 @@ public class ReactViewGroup extends ViewGroup
|
|
|
588
588
|
UiThreadUtil.assertOnUiThread();
|
|
589
589
|
checkViewClippingTag(child, Boolean.TRUE);
|
|
590
590
|
if (!customDrawOrderDisabled()) {
|
|
591
|
-
if (indexOfChild(child) == -1) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
591
|
getDrawingOrderHelper().handleRemoveView(child);
|
|
595
592
|
setChildrenDrawingOrderEnabled(getDrawingOrderHelper().shouldEnableCustomDrawingOrder());
|
|
596
593
|
} else {
|
|
@@ -57,7 +57,7 @@ static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *va
|
|
|
57
57
|
|
|
58
58
|
static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value)
|
|
59
59
|
{
|
|
60
|
-
return jsi::String::createFromUtf8(runtime, [value UTF8String]
|
|
60
|
+
return jsi::String::createFromUtf8(runtime, [value UTF8String] ? [value UTF8String] : "");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value)
|
|
@@ -203,7 +203,11 @@ static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string
|
|
|
203
203
|
/**
|
|
204
204
|
* Creates JSError with current JS runtime and NSException stack trace.
|
|
205
205
|
*/
|
|
206
|
-
static jsi::JSError convertNSExceptionToJSError(
|
|
206
|
+
static jsi::JSError convertNSExceptionToJSError(
|
|
207
|
+
jsi::Runtime &runtime,
|
|
208
|
+
NSException *exception,
|
|
209
|
+
const std::string &moduleName,
|
|
210
|
+
const std::string &methodName)
|
|
207
211
|
{
|
|
208
212
|
std::string reason = [exception.reason UTF8String];
|
|
209
213
|
|
|
@@ -214,7 +218,8 @@ static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSExcepti
|
|
|
214
218
|
cause.setProperty(
|
|
215
219
|
runtime, "stackReturnAddresses", convertNSArrayToJSIArray(runtime, exception.callStackReturnAddresses));
|
|
216
220
|
|
|
217
|
-
|
|
221
|
+
std::string message = moduleName + "." + methodName + " raised an exception: " + reason;
|
|
222
|
+
jsi::Value error = createJSRuntimeError(runtime, message);
|
|
218
223
|
error.asObject(runtime).setProperty(runtime, "cause", std::move(cause));
|
|
219
224
|
return {runtime, std::move(error)};
|
|
220
225
|
}
|
|
@@ -346,28 +351,34 @@ id ObjCTurboModule::performMethodInvocation(
|
|
|
346
351
|
}
|
|
347
352
|
|
|
348
353
|
if (isSync) {
|
|
349
|
-
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName,
|
|
354
|
+
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
|
350
355
|
} else {
|
|
351
|
-
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName,
|
|
356
|
+
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
|
352
357
|
}
|
|
353
358
|
|
|
354
359
|
@try {
|
|
355
360
|
[inv invokeWithTarget:strongModule];
|
|
356
361
|
} @catch (NSException *exception) {
|
|
357
|
-
|
|
362
|
+
if (isSync) {
|
|
363
|
+
// We can only convert NSException to JSError in sync method calls.
|
|
364
|
+
// See https://github.com/reactwg/react-native-new-architecture/discussions/276#discussioncomment-12567155
|
|
365
|
+
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
|
366
|
+
} else {
|
|
367
|
+
@throw exception;
|
|
368
|
+
}
|
|
358
369
|
} @finally {
|
|
359
370
|
[retainedObjectsForInvocation removeAllObjects];
|
|
360
371
|
}
|
|
361
372
|
|
|
362
373
|
if (!isSync) {
|
|
363
|
-
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName,
|
|
374
|
+
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
|
364
375
|
return;
|
|
365
376
|
}
|
|
366
377
|
|
|
367
378
|
void *rawResult;
|
|
368
379
|
[inv getReturnValue:&rawResult];
|
|
369
380
|
result = (__bridge id)rawResult;
|
|
370
|
-
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName,
|
|
381
|
+
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
|
371
382
|
};
|
|
372
383
|
|
|
373
384
|
if (isSync) {
|
|
@@ -409,23 +420,23 @@ void ObjCTurboModule::performVoidMethodInvocation(
|
|
|
409
420
|
}
|
|
410
421
|
|
|
411
422
|
if (shouldVoidMethodsExecuteSync_) {
|
|
412
|
-
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName,
|
|
423
|
+
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
|
413
424
|
} else {
|
|
414
|
-
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName,
|
|
425
|
+
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
|
415
426
|
}
|
|
416
427
|
|
|
417
428
|
@try {
|
|
418
429
|
[inv invokeWithTarget:strongModule];
|
|
419
430
|
} @catch (NSException *exception) {
|
|
420
|
-
throw convertNSExceptionToJSError(runtime, exception);
|
|
431
|
+
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
|
421
432
|
} @finally {
|
|
422
433
|
[retainedObjectsForInvocation removeAllObjects];
|
|
423
434
|
}
|
|
424
435
|
|
|
425
436
|
if (shouldVoidMethodsExecuteSync_) {
|
|
426
|
-
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName,
|
|
437
|
+
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
|
427
438
|
} else {
|
|
428
|
-
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName,
|
|
439
|
+
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
|
429
440
|
}
|
|
430
441
|
|
|
431
442
|
return;
|
|
@@ -524,7 +524,11 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
524
524
|
name:errorData[@"name"]
|
|
525
525
|
componentStack:errorData[@"componentStack"]
|
|
526
526
|
exceptionId:error.id
|
|
527
|
-
|
|
527
|
+
#if TARGET_OS_OSX // [macOS Use boolValue for isFatal to ensure type safety
|
|
528
|
+
isFatal:[errorData[@"isFatal"] boolValue] // Explicitly convert to BOOL to avoid compiler errors on macOS
|
|
529
|
+
#else
|
|
530
|
+
isFatal:errorData[@"isFatal"]
|
|
531
|
+
#endif // macOS]
|
|
528
532
|
extraData:errorData[@"extraData"]]) {
|
|
529
533
|
JS::NativeExceptionsManager::ExceptionData jsErrorData{errorData};
|
|
530
534
|
id<NativeExceptionsManagerSpec> exceptionsManager = [_turboModuleManager moduleForName:"ExceptionsManager"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.78.
|
|
3
|
+
"version": "0.78.4",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -101,7 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@types/react": "^19.0.0",
|
|
104
|
-
"react": "^19.0.0"
|
|
104
|
+
"react": "^19.0.0",
|
|
105
|
+
"react-native": "0.78.2"
|
|
105
106
|
},
|
|
106
107
|
"peerDependenciesMeta": {
|
|
107
108
|
"@types/react": {
|
|
@@ -110,14 +111,13 @@
|
|
|
110
111
|
},
|
|
111
112
|
"dependencies": {
|
|
112
113
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
113
|
-
"@react-native-
|
|
114
|
-
"@react-native/assets-registry": "0.78.
|
|
115
|
-
"@react-native/codegen": "0.78.
|
|
116
|
-
"@react-native/community-cli-plugin": "0.78.
|
|
117
|
-
"@react-native/gradle-plugin": "0.78.
|
|
118
|
-
"@react-native/js-polyfills": "0.78.
|
|
119
|
-
"@react-native/normalize-colors": "0.78.
|
|
120
|
-
"@react-native/virtualized-lists": "0.78.1",
|
|
114
|
+
"@react-native-macos/virtualized-lists": "0.78.4",
|
|
115
|
+
"@react-native/assets-registry": "0.78.2",
|
|
116
|
+
"@react-native/codegen": "0.78.2",
|
|
117
|
+
"@react-native/community-cli-plugin": "0.78.2",
|
|
118
|
+
"@react-native/gradle-plugin": "0.78.2",
|
|
119
|
+
"@react-native/js-polyfills": "0.78.2",
|
|
120
|
+
"@react-native/normalize-colors": "0.78.2",
|
|
121
121
|
"abort-controller": "^3.0.0",
|
|
122
122
|
"anser": "^1.4.9",
|
|
123
123
|
"ansi-regex": "^5.0.0",
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
"invariant": "^2.2.4",
|
|
133
133
|
"jest-environment-node": "^29.6.3",
|
|
134
134
|
"memoize-one": "^5.0.0",
|
|
135
|
-
"metro-runtime": "^0.81.
|
|
136
|
-
"metro-source-map": "^0.81.
|
|
135
|
+
"metro-runtime": "^0.81.3",
|
|
136
|
+
"metro-source-map": "^0.81.3",
|
|
137
137
|
"nullthrows": "^1.1.1",
|
|
138
138
|
"pretty-format": "^29.7.0",
|
|
139
139
|
"promise": "^8.3.0",
|
|
@@ -195,16 +195,22 @@ class ReactNativePodsUtils
|
|
|
195
195
|
private
|
|
196
196
|
|
|
197
197
|
def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
|
|
198
|
+
# [macOS
|
|
199
|
+
# Since some RN projects might combine multiple platforms into the same Xcode project,
|
|
200
|
+
# we'll be much more forgiving with the pod name matching in react-native-macos.
|
|
201
|
+
# Could be upstreamed as part of https://github.com/microsoft/react-native-macos/issues/2526.
|
|
202
|
+
valid_suffixes = ["", "-iOS", "-macOS", "-visionOS"]
|
|
203
|
+
# macOS]
|
|
198
204
|
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
|
|
199
|
-
if pod_name.to_s == target_pod_name
|
|
205
|
+
if valid_suffixes.any? { |suffix| pod_name.to_s == "#{target_pod_name}#{suffix}" } # [macOS]
|
|
200
206
|
target_installation_result.native_target.build_configurations.each do |config|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
end
|
|
207
|
+
if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
|
|
208
|
+
config.build_settings[settings_name] ||= '$(inherited) '
|
|
209
|
+
config.build_settings[settings_name] << settings_value
|
|
205
210
|
end
|
|
206
211
|
end
|
|
207
212
|
end
|
|
213
|
+
end
|
|
208
214
|
end
|
|
209
215
|
|
|
210
216
|
def self.fix_library_search_path(config)
|
|
@@ -21,14 +21,13 @@ end
|
|
|
21
21
|
|
|
22
22
|
# package.json
|
|
23
23
|
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
|
|
24
|
-
# [macOS
|
|
25
|
-
rn_version = package['version']
|
|
26
|
-
version = findLastestVersionWithArtifact(rn_version) || rn_version
|
|
27
|
-
# macOS]
|
|
24
|
+
version = findMatchingHermesVersion(package) # [macOS] Use special logic instead of just package['version']
|
|
28
25
|
|
|
29
26
|
source_type = hermes_source_type(version, react_native_path)
|
|
30
27
|
source = podspec_source(source_type, version, react_native_path)
|
|
31
28
|
|
|
29
|
+
version = version || package['version'] # [macOS] If version is nil, fall back to package version so CocoaPods doesn't fail
|
|
30
|
+
|
|
32
31
|
Pod::Spec.new do |spec|
|
|
33
32
|
spec.name = "hermes-engine"
|
|
34
33
|
spec.version = version
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
require 'net/http'
|
|
7
7
|
require 'rexml/document'
|
|
8
8
|
require 'open3' # [macOS]
|
|
9
|
+
require 'json' # [macOS]
|
|
10
|
+
require 'tmpdir' # [macOS]
|
|
9
11
|
|
|
10
12
|
HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
|
|
11
13
|
ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
|
|
@@ -176,8 +178,18 @@ def podspec_source_build_from_github_tag(react_native_path)
|
|
|
176
178
|
end
|
|
177
179
|
|
|
178
180
|
def podspec_source_build_from_github_main()
|
|
179
|
-
hermes_log("Using the latest commit from main.")
|
|
180
|
-
return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} main | cut -f 1`.strip}
|
|
181
|
+
# hermes_log("Using the latest commit from main.")
|
|
182
|
+
# return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} main | cut -f 1`.strip}
|
|
183
|
+
|
|
184
|
+
# [macOS
|
|
185
|
+
# The logic for this is a bit different on macOS.
|
|
186
|
+
# Since react-native-macos lags slightly behind facebook/react-native, we can't always use
|
|
187
|
+
# the latest Hermes commit because Hermes and JSI don't always guarantee backwards compatibility.
|
|
188
|
+
# Instead, we take the commit hash of Hermes at the time of the merge base with facebook/react-native.
|
|
189
|
+
commit = hermes_commit_at_merge_base()
|
|
190
|
+
hermes_log("Using Hermes commit from the merge base with facebook/react-native: #{commit}")
|
|
191
|
+
return {:git => HERMES_GITHUB_URL, :commit => commit}
|
|
192
|
+
# macOS]
|
|
181
193
|
end
|
|
182
194
|
|
|
183
195
|
def podspec_source_download_prebuild_release_tarball(react_native_path, version)
|
|
@@ -200,6 +212,51 @@ def artifacts_dir()
|
|
|
200
212
|
return File.join(Pod::Config.instance.project_pods_root, "hermes-engine-artifacts")
|
|
201
213
|
end
|
|
202
214
|
|
|
215
|
+
# [macOS
|
|
216
|
+
def hermes_commit_at_merge_base()
|
|
217
|
+
# We don't need ls-remote because react-native-macos is a fork of facebook/react-native
|
|
218
|
+
fetch_result = `git fetch -q https://github.com/facebook/react-native.git`
|
|
219
|
+
if $?.exitstatus != 0
|
|
220
|
+
abort <<-EOS
|
|
221
|
+
[Hermes] Failed to fetch facebook/react-native into the local repository.
|
|
222
|
+
EOS
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
merge_base = `git merge-base FETCH_HEAD HEAD`.strip
|
|
226
|
+
if merge_base.empty?
|
|
227
|
+
abort <<-EOS
|
|
228
|
+
[Hermes] Unable to find the merge base between our HEAD and upstream's HEAD.
|
|
229
|
+
EOS
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
timestamp = `git show -s --format=%ci #{merge_base}`.strip
|
|
233
|
+
if timestamp.empty?
|
|
234
|
+
abort <<-EOS
|
|
235
|
+
[Hermes] Unable to extract the timestamp for the merge base (#{merge_base}).
|
|
236
|
+
EOS
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
commit = nil
|
|
240
|
+
Dir.mktmpdir do |tmpdir|
|
|
241
|
+
hermes_git_dir = File.join(tmpdir, "hermes.git")
|
|
242
|
+
# Unfortunately we can't use git rev-list on HERMES_GITHUB_URL directly since we're not in that repo.
|
|
243
|
+
# Instead, we create a shallow clone to avoid downloading the entire history.
|
|
244
|
+
`git clone -q --bare --shallow-since="#{timestamp}" #{HERMES_GITHUB_URL} "#{hermes_git_dir}"`
|
|
245
|
+
`git --git-dir="#{hermes_git_dir}" fetch -q --deepen=1`
|
|
246
|
+
|
|
247
|
+
# If all goes well, this will be the commit hash of Hermes at the time of the merge base
|
|
248
|
+
commit = `git --git-dir="#{hermes_git_dir}" rev-list -1 --before="#{timestamp}" HEAD`.strip
|
|
249
|
+
if commit.empty?
|
|
250
|
+
abort <<-EOS
|
|
251
|
+
[Hermes] Unable to find the Hermes commit hash at time #{timestamp}.
|
|
252
|
+
EOS
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
return commit
|
|
257
|
+
end
|
|
258
|
+
# macOS]
|
|
259
|
+
|
|
203
260
|
def hermestag_file(react_native_path)
|
|
204
261
|
return File.join(react_native_path, "sdks", ".hermesversion")
|
|
205
262
|
end
|
|
@@ -239,25 +296,20 @@ def resolve_url_redirects(url)
|
|
|
239
296
|
return (`curl -Ls -o /dev/null -w %{url_effective} \"#{url}\"`)
|
|
240
297
|
end
|
|
241
298
|
|
|
242
|
-
# [macOS
|
|
243
|
-
#
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
versions = metadata.elements.to_a('//metadata/versioning/versions/version')
|
|
250
|
-
|
|
251
|
-
# Extract version numbers and sort them
|
|
252
|
-
filtered_versions = versions.select { |version| version.text.match?(/^#{versionWithoutPatch}\.\d+$/) }
|
|
253
|
-
if filtered_versions.empty?
|
|
254
|
-
return
|
|
299
|
+
# [macOS
|
|
300
|
+
# Tries to find a suitable Hermes version for a given react-native-macos package.
|
|
301
|
+
# For stable branches, we prefer this to be specified as a peer dependency.
|
|
302
|
+
def findMatchingHermesVersion(package)
|
|
303
|
+
if package['version'] == "1000.0.0"
|
|
304
|
+
# The main branch builds from source, so skip this check
|
|
305
|
+
return nil
|
|
255
306
|
end
|
|
256
307
|
|
|
257
|
-
|
|
258
|
-
|
|
308
|
+
if package['peerDependencies']
|
|
309
|
+
return package['peerDependencies']['react-native']
|
|
310
|
+
end
|
|
259
311
|
|
|
260
|
-
|
|
312
|
+
hermes_log("No matching Hermes version found. Defaulting to main branch, which may be unreliable.")
|
|
261
313
|
end
|
|
262
314
|
# macOS]
|
|
263
315
|
|
package/types/index.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export * from '../Libraries/LayoutAnimation/LayoutAnimation';
|
|
|
117
117
|
export * from '../Libraries/Linking/Linking';
|
|
118
118
|
export * from '../Libraries/Lists/FlatList';
|
|
119
119
|
export * from '../Libraries/Lists/SectionList';
|
|
120
|
-
export * from '@react-native-
|
|
120
|
+
export * from '@react-native-macos/virtualized-lists'; // [macOS]
|
|
121
121
|
export * from '../Libraries/LogBox/LogBox';
|
|
122
122
|
export * from '../Libraries/Modal/Modal';
|
|
123
123
|
export * as Systrace from '../Libraries/Performance/Systrace';
|