not-react-native-macos 0.87.1-rc.1 → 0.87.1-rc.3
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/Alert/RCTAlertManager.macos.js +21 -0
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js +23 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js +23 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.macos.js +23 -0
- package/Libraries/Image/Image.macos.js +23 -0
- package/Libraries/NativeComponent/BaseViewConfig.macos.js +23 -0
- package/Libraries/Network/RCTNetworking.macos.js +23 -0
- package/Libraries/Settings/Settings.macos.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +21 -0
- package/Libraries/Utilities/BackHandler.macos.js +23 -0
- package/Libraries/Utilities/Platform.macos.js +90 -0
- package/React/Base/RCTRootView.h +1 -1
- package/React/Base/RCTTextView.h +31 -0
- package/React/Base/RCTUIKit.h +121 -0
- package/React/Base/RCTUIKit.m +29 -0
- package/React/Base/Surface/RCTSurfaceView.h +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTFPSGraph.h +1 -1
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/CoreModules/RCTRedBox2Controller.mm +4 -4
- package/React/CoreModules/RCTRedBoxController.mm +2 -2
- package/React/CoreModules/React-CoreModules.podspec +0 -6
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +2 -2
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +1 -1
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +2 -2
- package/React/Fabric/Mounting/RCTComponentViewDescriptor.h +1 -1
- package/React/Fabric/Mounting/RCTComponentViewRegistry.h +1 -1
- package/React/Modules/RCTRedBoxExtraDataViewController.m +1 -1
- package/React/Views/RCTDebuggingOverlay.m +2 -2
- package/React/Views/RCTView.h +1 -1
- package/React/Views/RCTWrapperViewController.m +1 -1
- package/React-Core.podspec +0 -2
- package/macos/UIKitCompat/RCTPlatformViewCompat.h +9 -4
- package/macos/UIKitCompat/React-UIKitCompat.podspec +10 -2
- package/macos/UIKitCompat/UIKit/UIApplicationDelegate.h +13 -0
- package/macos/UIKitCompat/UIKit/UIControls.m +1 -1
- package/macos/UIKitCompat/UIKit/UIEvent.h +12 -0
- package/macos/UIKitCompat/UIKit/UIEvent.m +4 -1
- package/macos/UIKitCompat/UIKit/UIPlatformGaps.h +1 -1
- package/macos/UIKitCompat/UIKit/UIPlatformGaps.m +15 -1
- package/macos/UIKitCompat/UIKit/UITouch.h +24 -0
- package/macos/UIKitCompat/UIKit/UIView.h +18 -5
- package/macos/UIKitCompat/UIKit/UIView.m +24 -6
- package/macos/UIKitCompat/UIKit/UIViewController.h +24 -0
- package/macos/UIKitCompat/UIKit/UIWindow.h +24 -0
- package/macos/UIKitCompat/macos-excludes.txt +12 -33
- package/macos/metro-config.js +47 -25
- package/package.json +1 -1
- package/scripts/cocoapods/autolinking.rb +11 -2
- package/scripts/cocoapods/codegen.rb +3 -1
- package/scripts/cocoapods/codegen_utils.rb +7 -2
- package/scripts/codegen/generate-artifacts-executor/generateRCTThirdPartyComponents.js +3 -1
- package/scripts/codegen/generate-artifacts-executor/index.js +52 -4
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +22 -1
- package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.macos.js +17 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `RCTAlertManager` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
export * from './RCTAlertManager.ios';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `legacySendAccessibilityEvent` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import legacySendAccessibilityEvent from './legacySendAccessibilityEvent.ios';
|
|
22
|
+
|
|
23
|
+
export default legacySendAccessibilityEvent;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `DrawerLayoutAndroid` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import DrawerLayoutAndroid from './DrawerLayoutAndroid.ios';
|
|
22
|
+
|
|
23
|
+
export default DrawerLayoutAndroid;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `ToastAndroid` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import ToastAndroid from './ToastAndroid.ios';
|
|
22
|
+
|
|
23
|
+
export default ToastAndroid;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `Image` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import Image from './Image.ios';
|
|
22
|
+
|
|
23
|
+
export default Image;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `BaseViewConfig` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import BaseViewConfig from './BaseViewConfig.ios';
|
|
22
|
+
|
|
23
|
+
export default BaseViewConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `RCTNetworking` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import RCTNetworking from './RCTNetworking.ios';
|
|
22
|
+
|
|
23
|
+
export default RCTNetworking;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `Settings` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
import Platform from '../Utilities/Platform';
|
|
18
|
+
|
|
19
|
+
let Settings: {
|
|
20
|
+
get(key: string): any,
|
|
21
|
+
set(settings: Object): void,
|
|
22
|
+
watchKeys(keys: string | Array<string>, callback: () => void): number,
|
|
23
|
+
clearWatch(watchId: number): void,
|
|
24
|
+
...
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (Platform.OS === 'ios') {
|
|
28
|
+
Settings = require('./Settings.ios').default;
|
|
29
|
+
} else {
|
|
30
|
+
Settings = require('./SettingsFallback').default;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Settings;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `PlatformColorValueTypes` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
export * from './PlatformColorValueTypes.ios';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] macOS resolves as `.macos` -> `.native` -> shared, so without this
|
|
12
|
+
// file `BackHandler` re-exports itself: the shared file is a
|
|
13
|
+
// stub that expects a platform-suffixed sibling to answer. Point it at the iOS
|
|
14
|
+
// implementation, which is what this fork uses on macOS wherever upstream has
|
|
15
|
+
// no platform-neutral one. macOS]
|
|
16
|
+
|
|
17
|
+
// NOTE: This file supports backwards compatibility of subpath (deep) imports
|
|
18
|
+
// from 'react-native' with platform-specific extensions. It can be deleted
|
|
19
|
+
// once we remove the "./*" mapping from package.json "exports".
|
|
20
|
+
|
|
21
|
+
import BackHandler from './BackHandler.ios';
|
|
22
|
+
|
|
23
|
+
export default BackHandler;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// [macOS] The macOS implementation of Platform.
|
|
12
|
+
//
|
|
13
|
+
// `PlatformTypes.js` upstream already declares `'macos'` in `PlatformOSType`
|
|
14
|
+
// and a `MacOSPlatform` shape; only the module was missing, so `Platform.OS`
|
|
15
|
+
// came out as `'ios'` and every `Platform.select({macos: ...})` in the
|
|
16
|
+
// ecosystem silently took the iOS branch.
|
|
17
|
+
//
|
|
18
|
+
// The native constants come from the same `PlatformConstants` turbo module iOS
|
|
19
|
+
// uses -- the fork builds it for macOS and `RCTConstants.m` reports
|
|
20
|
+
// `RCTPlatformName` as `"macos"`. There is no interface idiom on macOS, so
|
|
21
|
+
// `isTV` and `isVision` are constants rather than reads. macOS]
|
|
22
|
+
|
|
23
|
+
import type {PlatformSelectSpec, PlatformType} from './PlatformTypes';
|
|
24
|
+
|
|
25
|
+
import NativePlatformConstantsIOS from './NativePlatformConstantsIOS';
|
|
26
|
+
|
|
27
|
+
const Platform: PlatformType = {
|
|
28
|
+
__constants: null,
|
|
29
|
+
OS: 'macos',
|
|
30
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
31
|
+
get Version(): string {
|
|
32
|
+
// $FlowFixMe[object-this-reference]
|
|
33
|
+
return this.constants.osVersion;
|
|
34
|
+
},
|
|
35
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
36
|
+
get constants(): {
|
|
37
|
+
isTesting: boolean,
|
|
38
|
+
osVersion: string,
|
|
39
|
+
reactNativeVersion: {
|
|
40
|
+
major: number,
|
|
41
|
+
minor: number,
|
|
42
|
+
patch: number,
|
|
43
|
+
prerelease: ?number,
|
|
44
|
+
},
|
|
45
|
+
systemName: string,
|
|
46
|
+
} {
|
|
47
|
+
// $FlowFixMe[object-this-reference]
|
|
48
|
+
if (this.__constants == null) {
|
|
49
|
+
// $FlowFixMe[object-this-reference]
|
|
50
|
+
this.__constants = NativePlatformConstantsIOS.getConstants();
|
|
51
|
+
}
|
|
52
|
+
// $FlowFixMe[object-this-reference]
|
|
53
|
+
return this.__constants;
|
|
54
|
+
},
|
|
55
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
56
|
+
get isTV(): boolean {
|
|
57
|
+
return false;
|
|
58
|
+
},
|
|
59
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
60
|
+
get isVision(): boolean {
|
|
61
|
+
return false;
|
|
62
|
+
},
|
|
63
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
64
|
+
get isTesting(): boolean {
|
|
65
|
+
if (__DEV__) {
|
|
66
|
+
// $FlowFixMe[object-this-reference]
|
|
67
|
+
return this.constants.isTesting;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
},
|
|
71
|
+
// $FlowFixMe[unsafe-getters-setters]
|
|
72
|
+
get isDisableAnimations(): boolean {
|
|
73
|
+
// $FlowFixMe[object-this-reference]
|
|
74
|
+
return this.constants.isDisableAnimations ?? this.isTesting;
|
|
75
|
+
},
|
|
76
|
+
// `macos` first, then `ios`, then `native`, then `default`. The iOS step
|
|
77
|
+
// matters: almost every `Platform.select` in the ecosystem predates macOS and
|
|
78
|
+
// only offers an `ios` branch, which is the right one to take here.
|
|
79
|
+
select: <T>(spec: PlatformSelectSpec<T>): T =>
|
|
80
|
+
// $FlowFixMe[incompatible-type]
|
|
81
|
+
'macos' in spec
|
|
82
|
+
? spec.macos
|
|
83
|
+
: 'ios' in spec
|
|
84
|
+
? spec.ios
|
|
85
|
+
: 'native' in spec
|
|
86
|
+
? spec.native
|
|
87
|
+
: spec.default,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default Platform;
|
package/React/Base/RCTRootView.h
CHANGED
|
@@ -49,7 +49,7 @@ extern
|
|
|
49
49
|
*/
|
|
50
50
|
#pragma clang diagnostic push
|
|
51
51
|
#pragma clang diagnostic warning "-Wdeprecated"
|
|
52
|
-
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTRootView :
|
|
52
|
+
__deprecated_msg("This API will be removed along with the legacy architecture.") @interface RCTRootView : RCTUIView // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* - Designated initializer -
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// [macOS] Compatibility header for third-party code written against
|
|
9
|
+
// microsoft/react-native-macos, which still carries the legacy Paper text view.
|
|
10
|
+
//
|
|
11
|
+
// Upstream React Native removed RCTTextView when Fabric replaced the old text
|
|
12
|
+
// implementation, but published macOS modules still import it. react-native-svg
|
|
13
|
+
// is the case in hand: RNSVGTopAlignedLabel.h imports this header and then
|
|
14
|
+
// derives from NSTextView, using nothing the header declares.
|
|
15
|
+
//
|
|
16
|
+
// So this provides the include, not the class. A module that genuinely needs
|
|
17
|
+
// the legacy view will now fail on the unknown type, which says what is wrong
|
|
18
|
+
// far better than a missing file does.
|
|
19
|
+
//
|
|
20
|
+
// See React/Base/RCTUIKit.h for the rest of the react-native-macos
|
|
21
|
+
// compatibility surface. macOS]
|
|
22
|
+
|
|
23
|
+
#pragma once
|
|
24
|
+
|
|
25
|
+
#import <TargetConditionals.h>
|
|
26
|
+
|
|
27
|
+
#if TARGET_OS_OSX
|
|
28
|
+
#import <AppKit/AppKit.h>
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#import <React/RCTUIKit.h>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// [macOS] Compatibility header for third-party code written against
|
|
9
|
+
// microsoft/react-native-macos.
|
|
10
|
+
//
|
|
11
|
+
// That fork routes every platform type through <React/RCTUIKit.h>: RCTUIColor,
|
|
12
|
+
// RCTUIImage, RCTUIView and friends. This fork does not need those names --
|
|
13
|
+
// it serves a real UIKit header set, so upstream and iOS-shaped code compiles
|
|
14
|
+
// with the names it already uses. But published packages do import this header
|
|
15
|
+
// by name, and a macOS React Native that cannot build react-native-webview or
|
|
16
|
+
// expo-modules-core is not much use, so the names are provided here.
|
|
17
|
+
//
|
|
18
|
+
// This is the only file in the fork that exists purely for other people's code.
|
|
19
|
+
// macOS]
|
|
20
|
+
|
|
21
|
+
#pragma once
|
|
22
|
+
|
|
23
|
+
#import <TargetConditionals.h>
|
|
24
|
+
|
|
25
|
+
// react-native-macos's RCTUIKit.h pulls these in transitively, and third-party
|
|
26
|
+
// code relies on that: react-native-svg's RNSVGUIKit.h imports only RCTUIKit.h
|
|
27
|
+
// and then calls RCTAssert.
|
|
28
|
+
#import <React/RCTAssert.h>
|
|
29
|
+
#import <React/RCTDefines.h>
|
|
30
|
+
|
|
31
|
+
#if TARGET_OS_OSX
|
|
32
|
+
|
|
33
|
+
#import <AppKit/AppKit.h>
|
|
34
|
+
#import <UIKit/UIKit.h> // The AppKit-backed shim: UIView, UIColor, UIImage, ...
|
|
35
|
+
|
|
36
|
+
// Colour and image are plain aliases in both forks, so these agree exactly.
|
|
37
|
+
@compatibility_alias RCTUIColor NSColor;
|
|
38
|
+
@compatibility_alias RCTPlatformColor NSColor;
|
|
39
|
+
@compatibility_alias RCTUIImage NSImage;
|
|
40
|
+
@compatibility_alias RCTPlatformImage NSImage;
|
|
41
|
+
|
|
42
|
+
// RCTUIView and RCTPlatformView are declared by the UIKit shim imported above,
|
|
43
|
+
// with the same split react-native-macos uses: RCTPlatformView is NSView, and
|
|
44
|
+
// RCTUIView is the concrete subclass carrying the UIKit method surface. See
|
|
45
|
+
// MACOS-FORK.md section 4.5.
|
|
46
|
+
|
|
47
|
+
// The rest of the RCTUI* / RCTPlatform* vocabulary. Each one already exists in
|
|
48
|
+
// the shim under its UIKit name, so these are pure renames -- which is the
|
|
49
|
+
// whole point: react-native-macos had to invent the names because it has no
|
|
50
|
+
// UIKit to borrow them from.
|
|
51
|
+
@compatibility_alias RCTUIScrollView UIScrollView;
|
|
52
|
+
@compatibility_alias RCTUISlider UISlider;
|
|
53
|
+
@compatibility_alias RCTUILabel UILabel;
|
|
54
|
+
@compatibility_alias RCTUISwitch UISwitch;
|
|
55
|
+
@compatibility_alias RCTUIActivityIndicatorView UIActivityIndicatorView;
|
|
56
|
+
@compatibility_alias RCTUITouch UITouch;
|
|
57
|
+
@compatibility_alias RCTUIImageView UIImageView;
|
|
58
|
+
@compatibility_alias RCTUIPanGestureRecognizer UIPanGestureRecognizer;
|
|
59
|
+
@compatibility_alias RCTUIGraphicsImageRenderer UIGraphicsImageRenderer;
|
|
60
|
+
@compatibility_alias RCTUIGraphicsImageRendererFormat UIGraphicsImageRendererFormat;
|
|
61
|
+
@compatibility_alias RCTUIGraphicsImageRendererContext UIGraphicsImageRendererContext;
|
|
62
|
+
@compatibility_alias RCTUIApplication UIApplication;
|
|
63
|
+
@compatibility_alias RCTPlatformWindow UIWindow;
|
|
64
|
+
@compatibility_alias RCTPlatformViewController UIViewController;
|
|
65
|
+
@compatibility_alias RCTPlatformSwitch UISwitch;
|
|
66
|
+
|
|
67
|
+
// Protocols and non-class names cannot use @compatibility_alias.
|
|
68
|
+
#define RCTUIScrollViewDelegate UIScrollViewDelegate
|
|
69
|
+
typedef UIAccessibilityTraits RCTUIAccessibilityTraits;
|
|
70
|
+
typedef void (^RCTUIGraphicsImageDrawingActions)(UIGraphicsImageRendererContext *rendererContext);
|
|
71
|
+
|
|
72
|
+
#import <React/RCTConvert.h>
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* react-native-macos spells RCTConvert's colour and image entry points with
|
|
76
|
+
* AppKit names, and third-party code calls them that way -- react-native-svg
|
|
77
|
+
* does `[RCTConvert RNSVGColor:json]`, where RNSVGColor expands to NSColor.
|
|
78
|
+
*
|
|
79
|
+
* This fork keeps the UIKit names, because upstream React Native calls those
|
|
80
|
+
* and `UIColor` is already an alias for `NSColor`. A `@compatibility_alias`
|
|
81
|
+
* renames a type, not a selector, so `+UIColor:` does not answer to `NSColor:`
|
|
82
|
+
* and the two spellings have to be bridged explicitly.
|
|
83
|
+
*/
|
|
84
|
+
@interface RCTConvert (RCTUIKitCompat)
|
|
85
|
+
|
|
86
|
+
+ (nullable NSColor *)NSColor:(nullable id)json;
|
|
87
|
+
+ (nullable NSImage *)NSImage:(nullable id)json;
|
|
88
|
+
|
|
89
|
+
@end
|
|
90
|
+
|
|
91
|
+
#else
|
|
92
|
+
|
|
93
|
+
#import <UIKit/UIKit.h>
|
|
94
|
+
|
|
95
|
+
@compatibility_alias RCTUIColor UIColor;
|
|
96
|
+
@compatibility_alias RCTPlatformColor UIColor;
|
|
97
|
+
@compatibility_alias RCTUIImage UIImage;
|
|
98
|
+
@compatibility_alias RCTPlatformImage UIImage;
|
|
99
|
+
// RCTUIView and RCTPlatformView come from the force-included prelude here.
|
|
100
|
+
|
|
101
|
+
@compatibility_alias RCTUIScrollView UIScrollView;
|
|
102
|
+
@compatibility_alias RCTUISlider UISlider;
|
|
103
|
+
@compatibility_alias RCTUILabel UILabel;
|
|
104
|
+
@compatibility_alias RCTUISwitch UISwitch;
|
|
105
|
+
@compatibility_alias RCTUIActivityIndicatorView UIActivityIndicatorView;
|
|
106
|
+
@compatibility_alias RCTUITouch UITouch;
|
|
107
|
+
@compatibility_alias RCTUIImageView UIImageView;
|
|
108
|
+
@compatibility_alias RCTUIPanGestureRecognizer UIPanGestureRecognizer;
|
|
109
|
+
@compatibility_alias RCTUIGraphicsImageRenderer UIGraphicsImageRenderer;
|
|
110
|
+
@compatibility_alias RCTUIGraphicsImageRendererFormat UIGraphicsImageRendererFormat;
|
|
111
|
+
@compatibility_alias RCTUIApplication UIApplication;
|
|
112
|
+
@compatibility_alias RCTPlatformWindow UIWindow;
|
|
113
|
+
@compatibility_alias RCTPlatformViewController UIViewController;
|
|
114
|
+
@compatibility_alias RCTPlatformSwitch UISwitch;
|
|
115
|
+
|
|
116
|
+
#define RCTUIScrollViewDelegate UIScrollViewDelegate
|
|
117
|
+
typedef UIAccessibilityTraits RCTUIAccessibilityTraits;
|
|
118
|
+
typedef UIGraphicsImageRendererContext RCTUIGraphicsImageRendererContext;
|
|
119
|
+
typedef UIGraphicsImageDrawingActions RCTUIGraphicsImageDrawingActions;
|
|
120
|
+
|
|
121
|
+
#endif // TARGET_OS_OSX
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// [macOS] Implementation of the react-native-macos compatibility surface
|
|
9
|
+
// declared in RCTUIKit.h. See that header for why it exists. macOS]
|
|
10
|
+
|
|
11
|
+
#import <React/RCTUIKit.h>
|
|
12
|
+
|
|
13
|
+
#if TARGET_OS_OSX
|
|
14
|
+
|
|
15
|
+
@implementation RCTConvert (RCTUIKitCompat)
|
|
16
|
+
|
|
17
|
+
+ (NSColor *)NSColor:(id)json
|
|
18
|
+
{
|
|
19
|
+
return [RCTConvert UIColor:json];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
+ (NSImage *)NSImage:(id)json
|
|
23
|
+
{
|
|
24
|
+
return [RCTConvert UIImage:json];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@end
|
|
28
|
+
|
|
29
|
+
#endif // TARGET_OS_OSX
|
|
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
/**
|
|
15
15
|
* UIView instance which represents the Surface
|
|
16
16
|
*/
|
|
17
|
-
@interface RCTSurfaceView :
|
|
17
|
+
@interface RCTSurfaceView : RCTUIView // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
18
18
|
|
|
19
19
|
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface NS_DESIGNATED_INITIALIZER;
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
22
22
|
* This class can be used as easy-to-use general purpose integration point
|
|
23
23
|
* of ReactNative-powered experiences in UIKit based apps.
|
|
24
24
|
*/
|
|
25
|
-
@interface RCTSurfaceHostingView :
|
|
25
|
+
@interface RCTSurfaceHostingView : RCTUIView <RCTSurfaceDelegate> // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Designated initializer.
|
|
@@ -145,7 +145,7 @@ RCT_EXPORT_MODULE()
|
|
|
145
145
|
self->_label.text = message;
|
|
146
146
|
|
|
147
147
|
if (self->_container == nullptr) {
|
|
148
|
-
self->_container = [[
|
|
148
|
+
self->_container = [[RCTUIView alloc] init]; // [macOS] needs a flipped, layer-backed view
|
|
149
149
|
self->_container.translatesAutoresizingMaskIntoConstraints = NO;
|
|
150
150
|
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
|
151
151
|
[self->_container addGestureRecognizer:tapGesture];
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#if RCT_DEV
|
|
13
13
|
|
|
14
|
-
@interface RCTFPSGraph :
|
|
14
|
+
@interface RCTFPSGraph : RCTUIView // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
15
15
|
|
|
16
16
|
@property (nonatomic, assign, readonly) NSUInteger FPS;
|
|
17
17
|
@property (nonatomic, assign, readonly) NSUInteger maxFPS;
|
|
@@ -172,7 +172,7 @@ RCT_EXPORT_MODULE()
|
|
|
172
172
|
UIEdgeInsets safeInsets = RCTKeyWindow().safeAreaInsets;
|
|
173
173
|
|
|
174
174
|
_container =
|
|
175
|
-
[[
|
|
175
|
+
[[RCTUIView alloc] initWithFrame:CGRectMake(safeInsets.left, safeInsets.top, 180, RCTPerfMonitorBarHeight)]; // [macOS] needs a flipped, layer-backed view
|
|
176
176
|
_container.layer.borderWidth = 2;
|
|
177
177
|
_container.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
|
178
178
|
[_container addGestureRecognizer:self.gestureRecognizer];
|
|
@@ -118,7 +118,7 @@ static const NSTimeInterval kAutoRetryInterval = 20.0;
|
|
|
118
118
|
|
|
119
119
|
- (UIView *)createHeaderBar
|
|
120
120
|
{
|
|
121
|
-
UIView *headerContainer = [[
|
|
121
|
+
UIView *headerContainer = [[RCTUIView alloc] init]; // [macOS] needs a flipped, layer-backed view
|
|
122
122
|
headerContainer.translatesAutoresizingMaskIntoConstraints = NO;
|
|
123
123
|
headerContainer.backgroundColor = RCTRedBox2ErrorColor();
|
|
124
124
|
|
|
@@ -561,7 +561,7 @@ static const NSTimeInterval kAutoRetryInterval = 20.0;
|
|
|
561
561
|
cell.detailTextLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightLight];
|
|
562
562
|
cell.detailTextLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
|
563
563
|
cell.backgroundColor = [UIColor clearColor];
|
|
564
|
-
cell.selectedBackgroundView = [
|
|
564
|
+
cell.selectedBackgroundView = [RCTUIView new]; // [macOS] needs a flipped, layer-backed view
|
|
565
565
|
cell.selectedBackgroundView.backgroundColor = RCTRedBox2BackgroundColor();
|
|
566
566
|
cell.selectedBackgroundView.layer.cornerRadius = 5;
|
|
567
567
|
}
|
|
@@ -598,7 +598,7 @@ static const NSTimeInterval kAutoRetryInterval = 20.0;
|
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
// Code frame container with rounded corners
|
|
601
|
-
UIView *container = [[
|
|
601
|
+
UIView *container = [[RCTUIView alloc] init]; // [macOS] needs a flipped, layer-backed view
|
|
602
602
|
container.translatesAutoresizingMaskIntoConstraints = NO;
|
|
603
603
|
container.backgroundColor = RCTRedBox2BackgroundColor();
|
|
604
604
|
container.layer.cornerRadius = 3;
|
|
@@ -689,7 +689,7 @@ static const NSTimeInterval kAutoRetryInterval = 20.0;
|
|
|
689
689
|
|
|
690
690
|
- (UIView *)sectionHeaderViewWithTitle:(NSString *)title
|
|
691
691
|
{
|
|
692
|
-
UIView *headerView = [[
|
|
692
|
+
UIView *headerView = [[RCTUIView alloc] initWithFrame:CGRectMake(0, 0, 0, 38)]; // [macOS] needs a flipped, layer-backed view
|
|
693
693
|
headerView.backgroundColor = [UIColor clearColor];
|
|
694
694
|
|
|
695
695
|
UILabel *label = [[UILabel alloc] init];
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
[buttonStackView addArrangedSubview:button];
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
UIView *topBorder = [[
|
|
163
|
+
UIView *topBorder = [[RCTUIView alloc] init]; // [macOS] needs a flipped, layer-backed view
|
|
164
164
|
topBorder.translatesAutoresizingMaskIntoConstraints = NO;
|
|
165
165
|
topBorder.backgroundColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0];
|
|
166
166
|
[topBorder.heightAnchor constraintEqualToConstant:1].active = YES;
|
|
@@ -364,7 +364,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
364
364
|
cell.detailTextLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:11];
|
|
365
365
|
cell.detailTextLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
|
366
366
|
cell.backgroundColor = [UIColor clearColor];
|
|
367
|
-
cell.selectedBackgroundView = [
|
|
367
|
+
cell.selectedBackgroundView = [RCTUIView new]; // [macOS] needs a flipped, layer-backed view
|
|
368
368
|
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
|
|
369
369
|
}
|
|
370
370
|
|
|
@@ -34,12 +34,6 @@ Pod::Spec.new do |s|
|
|
|
34
34
|
|
|
35
35
|
s.source_files = podspec_sources("**/*.{c,m,mm,cpp}", "**/*.h")
|
|
36
36
|
|
|
37
|
-
# [macOS] The macOS build does not ship these; see
|
|
38
|
-
|
|
39
|
-
# macos/UIKitCompat/macos-excludes.txt, which this reads.
|
|
40
|
-
|
|
41
|
-
s.osx.exclude_files = macos_excluded_files.map { |p| p.sub('React/CoreModules/', '') }
|
|
42
|
-
|
|
43
37
|
s.ios.exclude_files = "PlatformStubs/**/*"
|
|
44
38
|
exclude_files = ["RCTStatusBarManager.mm"]
|
|
45
39
|
s.macos.exclude_files = exclude_files
|