Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ exports[`execute test-app "ReactAppDependencyProvider.podspec" should match snap
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version = \\"0.81.0-rc0\\"
version = \\"0.81.0\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
Expand Down Expand Up @@ -399,7 +399,7 @@ exports[`execute test-app "ReactCodegen.podspec" should match snapshot 1`] = `
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version = \\"0.81.0-rc0\\"
version = \\"0.81.0\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
Expand Down Expand Up @@ -840,7 +840,7 @@ exports[`execute test-app-legacy "ReactAppDependencyProvider.podspec" should mat
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version = \\"0.81.0-rc0\\"
version = \\"0.81.0\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
Expand Down Expand Up @@ -878,7 +878,7 @@ exports[`execute test-app-legacy "ReactCodegen.podspec" should match snapshot 1`
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version = \\"0.81.0-rc0\\"
version = \\"0.81.0\\"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function parseiOSAnnotations(
) /*: {[string]: $FlowFixMe} */ {
const mLibraryMap = {} /*:: as {[string]: $FlowFixMe} */;
const cLibraryMap = {} /*:: as {[string]: $FlowFixMe} */;
const map = {};
const map = {} /*:: as {[string]: $FlowFixMe} */; // [macOS]

for (const library of libraries) {
const iosConfig = library?.config?.ios;
Expand Down Expand Up @@ -406,6 +406,40 @@ function parseiOSAnnotations(
}
}
}
// [macOS
// Allow react-native-macos to override react-native modules/components
const isAllowedOverride = (libraryNames /*: Set<string> */) => {
const names = Array.from(libraryNames);
return (
names.length === 2 &&
names.includes('react-native') &&
names.includes('react-native-macos')
);
};

// Merge entries with react-native-macos taking precedence over react-native
for (const [moduleName, libraryNames] of Object.entries(mLibraryMap)) {
if (isAllowedOverride(libraryNames)) {
// Remove the module from react-native, keep only react-native-macos
if (map['react-native']?.modules?.[moduleName]) {
delete map['react-native'].modules[moduleName];
}
// Update the library map to only contain react-native-macos
mLibraryMap[moduleName] = new Set(['react-native-macos']);
}
}

for (const [componentName, libraryNames] of Object.entries(cLibraryMap)) {
if (isAllowedOverride(libraryNames)) {
// Remove the component from react-native, keep only react-native-macos
if (map['react-native']?.components?.[componentName]) {
delete map['react-native'].components[componentName];
}
// Update the library map to only contain react-native-macos
cLibraryMap[componentName] = new Set(['react-native-macos']);
}
}
// macOS]

const moduleConflicts = Object.entries(mLibraryMap)
.filter(([_, libraryNames]) => libraryNames.size > 1)
Expand Down
Loading