react-native-macos 0.77.3 → 0.77.5

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.
@@ -103,7 +103,11 @@ function focusTextInput(textField: ?HostInstance) {
103
103
 
104
104
  if (textField != null) {
105
105
  const fieldCanBeFocused =
106
- currentlyFocusedInputRef !== textField &&
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
 
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 77,
19
- patch: 3,
19
+ patch: 5,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {RenderItemProps} from '@react-native-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
13
+ import {typeof FillRateHelper as FillRateHelperType} from '@react-native-macos/virtualized-lists'; // [macOS]
14
14
 
15
15
  const FillRateHelper: FillRateHelperType =
16
- require('@react-native-mac/virtualized-lists').FillRateHelper; // [macOS]
16
+ require('@react-native-macos/virtualized-lists').FillRateHelper; // [macOS]
17
17
 
18
- export type {FillRateInfo} from '@react-native-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
18
+ } from '@react-native-macos/virtualized-lists'; // [macOS]
19
19
 
20
20
  import Platform from '../Utilities/Platform';
21
- import {VirtualizedSectionList} from '@react-native-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
17
+ } from '@react-native-macos/virtualized-lists'; // [macOS]
18
18
 
19
- import {typeof ViewabilityHelper as ViewabilityHelperType} from '@react-native-mac/virtualized-lists'; // [macOS]
19
+ import {typeof ViewabilityHelper as ViewabilityHelperType} from '@react-native-macos/virtualized-lists'; // [macOS]
20
20
 
21
21
  const ViewabilityHelper: ViewabilityHelperType =
22
- require('@react-native-mac/virtualized-lists').ViewabilityHelper; // [macOS]
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-mac/virtualized-lists'; // [macOS]
13
+ import {typeof keyExtractor as KeyExtractorType} from '@react-native-macos/virtualized-lists'; // [macOS]
14
14
 
15
15
  const keyExtractor: KeyExtractorType =
16
- require('@react-native-mac/virtualized-lists').keyExtractor; // [macOS]
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-mac/virtualized-lists'; // [macOS]
13
+ import {typeof VirtualizedList as VirtualizedListType} from '@react-native-macos/virtualized-lists'; // [macOS]
14
14
 
15
15
  const VirtualizedList: VirtualizedListType =
16
- require('@react-native-mac/virtualized-lists').VirtualizedList; // [macOS]
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-mac/virtualized-lists'; // [macOS]
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-mac/virtualized-lists'; // [macOS]
13
+ import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterType} from '@react-native-macos/virtualized-lists'; // [macOS]
14
14
 
15
15
  const VirtualizedListContextResetter: VirtualizedListContextResetterType =
16
- require('@react-native-mac/virtualized-lists').VirtualizedListContextResetter; // [macOS]
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-mac/virtualized-lists'; // [macOS]
13
+ import {typeof VirtualizedSectionList as VirtualizedSectionListType} from '@react-native-macos/virtualized-lists'; // [macOS]
14
14
 
15
15
  const VirtualizedSectionList: VirtualizedSectionListType =
16
- require('@react-native-mac/virtualized-lists').VirtualizedSectionList; // [macOS]
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-mac/virtualized-lists'; // [macOS]
21
+ } from '@react-native-macos/virtualized-lists'; // [macOS]
22
22
  module.exports = VirtualizedSectionList;
@@ -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-mac/virtualized-lists'; // [macOS]
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');
@@ -16,6 +16,7 @@ import {TextStyle} from '../StyleSheet/StyleSheetTypes';
16
16
  import {
17
17
  GestureResponderEvent,
18
18
  LayoutChangeEvent,
19
+ MouseEvent, // [macOS]
19
20
  NativeSyntheticEvent,
20
21
  TextLayoutEventData,
21
22
  } from '../Types/CoreEventTypes';
@@ -153,7 +153,7 @@
153
153
 
154
154
  - (NSArray<NSAttributedStringKey> *)validAttributesForMarkedText
155
155
  {
156
- return ((NSTextView *)self.currentEditor).validAttributesForMarkedText;
156
+ return ((NSTextView *)self.currentEditor).validAttributesForMarkedText ?: @[];
157
157
  }
158
158
 
159
159
  #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-mac/virtualized-lists'); // [macOS]
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
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(77),
26
- RCTVersionPatch: @(3),
26
+ RCTVersionPatch: @(5),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -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;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.77.3
1
+ VERSION_NAME=0.77.5
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 77,
20
- "patch", 3,
20
+ "patch", 5,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 77;
20
- int32_t Patch = 3;
20
+ int32_t Patch = 5;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.77.3",
3
+ "version": "0.77.5",
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": "^18.2.6",
104
- "react": "^18.2.0"
104
+ "react": "^18.2.0",
105
+ "react-native": "0.77.2"
105
106
  },
106
107
  "peerDependenciesMeta": {
107
108
  "@types/react": {
@@ -110,7 +111,7 @@
110
111
  },
111
112
  "dependencies": {
112
113
  "@jest/create-cache-key-function": "^29.6.3",
113
- "@react-native-mac/virtualized-lists": "0.77.2",
114
+ "@react-native-macos/virtualized-lists": "0.77.5",
114
115
  "@react-native/assets-registry": "0.77.2",
115
116
  "@react-native/codegen": "0.77.2",
116
117
  "@react-native/community-cli-plugin": "0.77.2",
@@ -194,16 +194,22 @@ class ReactNativePodsUtils
194
194
  private
195
195
 
196
196
  def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
197
+ # [macOS
198
+ # Since some RN projects might combine multiple platforms into the same Xcode project,
199
+ # we'll be much more forgiving with the pod name matching in react-native-macos.
200
+ # Could be upstreamed as part of https://github.com/microsoft/react-native-macos/issues/2526.
201
+ valid_suffixes = ["", "-iOS", "-macOS", "-visionOS"]
202
+ # macOS]
197
203
  installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
198
- if pod_name.to_s == target_pod_name
204
+ if valid_suffixes.any? { |suffix| pod_name.to_s == "#{target_pod_name}#{suffix}" } # [macOS]
199
205
  target_installation_result.native_target.build_configurations.each do |config|
200
- if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
201
- config.build_settings[settings_name] ||= '$(inherited) '
202
- config.build_settings[settings_name] << settings_value
203
- end
206
+ if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
207
+ config.build_settings[settings_name] ||= '$(inherited) '
208
+ config.build_settings[settings_name] << settings_value
204
209
  end
205
210
  end
206
211
  end
212
+ end
207
213
  end
208
214
 
209
215
  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 react-native-macos does not publish macos specific hermes artifacts
243
- # so we attempt to find the latest patch version of the iOS artifacts and use that
244
- def findLastestVersionWithArtifact(version)
245
- versionWithoutPatch = version.match(/^(\d+\.\d+)/)
246
- xml_data, = Open3.capture3("curl -s https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/maven-metadata.xml")
247
-
248
- metadata = REXML::Document.new(xml_data)
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
- version_numbers = filtered_versions.map { |version| version.text }
258
- sorted_versions = version_numbers.sort_by { |v| Gem::Version.new(v) }
308
+ if package['peerDependencies']
309
+ return package['peerDependencies']['react-native']
310
+ end
259
311
 
260
- return sorted_versions.last
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
@@ -116,7 +116,7 @@ export * from '../Libraries/LayoutAnimation/LayoutAnimation';
116
116
  export * from '../Libraries/Linking/Linking';
117
117
  export * from '../Libraries/Lists/FlatList';
118
118
  export * from '../Libraries/Lists/SectionList';
119
- export * from '@react-native-mac/virtualized-lists'; // [macOS]
119
+ export * from '@react-native-macos/virtualized-lists'; // [macOS]
120
120
  export * from '../Libraries/LogBox/LogBox';
121
121
  export * from '../Libraries/Modal/Modal';
122
122
  export * as Systrace from '../Libraries/Performance/Systrace';