react-native 0.74.0-rc.1 → 0.74.0-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/AppDelegate/RCTAppDelegate.h +5 -8
- package/Libraries/AppDelegate/RCTAppDelegate.mm +57 -131
- package/Libraries/AppDelegate/RCTRootViewFactory.h +123 -0
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +253 -0
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +4 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +3 -0
- package/React/Base/RCTConvert.h +3 -0
- package/React/Base/RCTConvert.mm +9 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTRedBox.mm +7 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +32 -0
- package/React/Views/RCTCursor.h +13 -0
- package/React/Views/RCTView.h +3 -0
- package/React/Views/RCTView.m +30 -0
- package/React/Views/RCTViewManager.m +2 -0
- package/ReactAndroid/api/ReactAndroid.api +9 -56
- package/ReactAndroid/build.gradle.kts +26 -0
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +6 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +9 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java +0 -11
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +11 -6
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManagerDelegate.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java +10 -0
- package/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +32 -0
- package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +1 -5
- package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.kt +10 -11
- package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +0 -2
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +0 -1
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h +0 -4
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h +1 -1
- package/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +1 -1
- package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +9 -0
- package/ReactCommon/react/renderer/components/view/BaseViewProps.h +2 -0
- package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +1 -1
- package/ReactCommon/react/renderer/components/view/conversions.h +22 -0
- package/ReactCommon/react/renderer/components/view/primitives.h +2 -0
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +6 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +16 -4
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +37 -6
- package/index.js +0 -5
- package/package.json +3 -3
- package/scripts/codegen/generate-artifacts-executor.js +1 -5
- package/sdks/hermes-engine/hermes-utils.rb +4 -3
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/package.json +3 -3
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.android.js +0 -69
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.d.ts +0 -24
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.js +0 -33
- package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroidNativeComponent.js +0 -13
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt +0 -20
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/interfaces/TurboModule.kt +0 -19
- package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/PopupMenuSelectionEvent.kt +0 -38
- package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuContainer.kt +0 -49
- package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuManager.kt +0 -54
- package/src/private/specs/components/PopupMenuAndroidNativeComponent.js +0 -47
|
@@ -7,6 +7,7 @@ require 'net/http'
|
|
|
7
7
|
require 'rexml/document'
|
|
8
8
|
|
|
9
9
|
HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
|
|
10
|
+
ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
|
|
10
11
|
|
|
11
12
|
module HermesEngineSourceType
|
|
12
13
|
LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
|
|
@@ -30,7 +31,7 @@ end
|
|
|
30
31
|
# - To use a specific tarball, install the dependencies with:
|
|
31
32
|
# `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
|
|
32
33
|
# - To force a build from source, install the dependencies with:
|
|
33
|
-
# `
|
|
34
|
+
# `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
|
|
34
35
|
# If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
|
|
35
36
|
# (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
|
|
36
37
|
#
|
|
@@ -85,11 +86,11 @@ def hermes_commit_envvar_defined()
|
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
def force_build_from_tag(react_native_path)
|
|
88
|
-
return ENV[
|
|
89
|
+
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
|
|
89
90
|
end
|
|
90
91
|
|
|
91
92
|
def force_build_from_main(react_native_path)
|
|
92
|
-
return ENV[
|
|
93
|
+
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
|
|
93
94
|
end
|
|
94
95
|
|
|
95
96
|
def release_artifact_exists(version)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/template/package.json
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"react-native": "0.74.0-rc.
|
|
14
|
+
"react-native": "0.74.0-rc.3"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@babel/core": "^7.20.0",
|
|
18
18
|
"@babel/preset-env": "^7.20.0",
|
|
19
19
|
"@babel/runtime": "^7.20.0",
|
|
20
|
-
"@react-native/babel-preset": "0.74.
|
|
20
|
+
"@react-native/babel-preset": "0.74.2",
|
|
21
21
|
"@react-native/eslint-config": "0.74.1",
|
|
22
|
-
"@react-native/metro-config": "0.74.
|
|
22
|
+
"@react-native/metro-config": "0.74.2",
|
|
23
23
|
"@react-native/typescript-config": "0.74.1",
|
|
24
24
|
"@types/react": "^18.2.6",
|
|
25
25
|
"@types/react-test-renderer": "^18.0.0",
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
|
-
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
|
|
13
|
-
import type {RefObject} from 'react';
|
|
14
|
-
|
|
15
|
-
import PopupMenuAndroidNativeComponent, {
|
|
16
|
-
Commands,
|
|
17
|
-
} from './PopupMenuAndroidNativeComponent';
|
|
18
|
-
import nullthrows from 'nullthrows';
|
|
19
|
-
import * as React from 'react';
|
|
20
|
-
import {useCallback, useImperativeHandle, useRef} from 'react';
|
|
21
|
-
|
|
22
|
-
type PopupMenuSelectionEvent = SyntheticEvent<
|
|
23
|
-
$ReadOnly<{
|
|
24
|
-
item: number,
|
|
25
|
-
}>,
|
|
26
|
-
>;
|
|
27
|
-
|
|
28
|
-
export type PopupMenuAndroidInstance = {
|
|
29
|
-
+show: () => void,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type Props = {
|
|
33
|
-
menuItems: $ReadOnlyArray<string>,
|
|
34
|
-
onSelectionChange: number => void,
|
|
35
|
-
children: React.Node,
|
|
36
|
-
instanceRef: RefObject<?PopupMenuAndroidInstance>,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default function PopupMenuAndroid({
|
|
40
|
-
menuItems,
|
|
41
|
-
onSelectionChange,
|
|
42
|
-
children,
|
|
43
|
-
instanceRef,
|
|
44
|
-
}: Props): React.Node {
|
|
45
|
-
const nativeRef = useRef<React.ElementRef<HostComponent<mixed>> | null>(null);
|
|
46
|
-
const _onSelectionChange = useCallback(
|
|
47
|
-
(event: PopupMenuSelectionEvent) => {
|
|
48
|
-
onSelectionChange(event.nativeEvent.item);
|
|
49
|
-
},
|
|
50
|
-
[onSelectionChange],
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
useImperativeHandle(instanceRef, ItemViewabilityInstance => {
|
|
54
|
-
return {
|
|
55
|
-
show() {
|
|
56
|
-
Commands.show(nullthrows(nativeRef.current));
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<PopupMenuAndroidNativeComponent
|
|
63
|
-
ref={nativeRef}
|
|
64
|
-
onSelectionChange={_onSelectionChange}
|
|
65
|
-
menuItems={menuItems}>
|
|
66
|
-
{children}
|
|
67
|
-
</PopupMenuAndroidNativeComponent>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type * as React from 'react';
|
|
11
|
-
import {HostComponent} from '../../../types/public/ReactNativeTypes';
|
|
12
|
-
|
|
13
|
-
type PopupMenuAndroidInstance = {
|
|
14
|
-
show: () => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type Props = {
|
|
18
|
-
menuItems: Array<string>;
|
|
19
|
-
onSelectionChange: (number) => void;
|
|
20
|
-
children: React.ReactNode | undefined;
|
|
21
|
-
instanceRef: React.ElementRef<HostComponent<PopupMenuAndroidInstance>>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
declare class PopupMenuAndroid extends React.Component<Props> {}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {RefObject} from 'react';
|
|
12
|
-
import type {Node} from 'react';
|
|
13
|
-
|
|
14
|
-
import * as React from 'react';
|
|
15
|
-
|
|
16
|
-
const UnimplementedView = require('../UnimplementedViews/UnimplementedView');
|
|
17
|
-
|
|
18
|
-
export type PopupMenuAndroidInstance = {
|
|
19
|
-
+show: () => void,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type Props = {
|
|
23
|
-
menuItems: $ReadOnlyArray<string>,
|
|
24
|
-
onSelectionChange: number => void,
|
|
25
|
-
children: Node,
|
|
26
|
-
instanceRef: RefObject<?PopupMenuAndroidInstance>,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function PopupMenuAndroid(props: Props): Node {
|
|
30
|
-
return <UnimplementedView />;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default PopupMenuAndroid;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from '../../../src/private/specs/components/PopupMenuAndroidNativeComponent';
|
|
12
|
-
import PopupMenuAndroidNativeComponent from '../../../src/private/specs/components/PopupMenuAndroidNativeComponent';
|
|
13
|
-
export default PopupMenuAndroidNativeComponent;
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
package com.facebook.react.defaults
|
|
9
|
-
|
|
10
|
-
import com.facebook.jni.annotations.DoNotStrip
|
|
11
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
12
|
-
import com.facebook.react.runtime.BindingsInstaller
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A utility class that provides users a default [BindingsInstaller] class that's used to initialize
|
|
16
|
-
* [ReactHostDelegate]
|
|
17
|
-
*/
|
|
18
|
-
@DoNotStrip
|
|
19
|
-
@UnstableReactNativeAPI
|
|
20
|
-
public class DefaultBindingsInstaller : BindingsInstaller(null) {}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
package com.facebook.react.internal.turbomodule.core.interfaces
|
|
9
|
-
/** All turbo modules should inherit from this interface */
|
|
10
|
-
public interface TurboModule {
|
|
11
|
-
/** Initialize the TurboModule. */
|
|
12
|
-
public fun initialize()
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Called during the turn down process of ReactHost. This method is called before React Native is
|
|
16
|
-
* stopped. Override this method to clean up resources used by the TurboModule.
|
|
17
|
-
*/
|
|
18
|
-
public fun invalidate()
|
|
19
|
-
}
|
package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/PopupMenuSelectionEvent.kt
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
@file:Suppress("DEPRECATION") // We want to use RCTEventEmitter for interop purposes
|
|
9
|
-
|
|
10
|
-
package com.facebook.react.views.popupmenu
|
|
11
|
-
|
|
12
|
-
import com.facebook.react.bridge.Arguments
|
|
13
|
-
import com.facebook.react.bridge.WritableMap
|
|
14
|
-
import com.facebook.react.uimanager.events.Event
|
|
15
|
-
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
16
|
-
|
|
17
|
-
public class PopupMenuSelectionEvent(surfaceId: Int, viewId: Int, private val item: Int) :
|
|
18
|
-
Event<PopupMenuSelectionEvent>(surfaceId, viewId) {
|
|
19
|
-
|
|
20
|
-
override fun getEventName(): String {
|
|
21
|
-
return EVENT_NAME
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
override fun getEventData(): WritableMap {
|
|
25
|
-
val eventData: WritableMap = Arguments.createMap()
|
|
26
|
-
eventData.putInt("target", viewTag)
|
|
27
|
-
eventData.putDouble("item", item.toDouble())
|
|
28
|
-
return eventData
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
32
|
-
rctEventEmitter.receiveEvent(viewTag, eventName, eventData)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public companion object {
|
|
36
|
-
public const val EVENT_NAME: String = "topSelectionChange"
|
|
37
|
-
}
|
|
38
|
-
}
|
package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuContainer.kt
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
package com.facebook.react.views.popupmenu
|
|
9
|
-
|
|
10
|
-
import android.content.Context
|
|
11
|
-
import android.os.Build
|
|
12
|
-
import android.view.Menu
|
|
13
|
-
import android.widget.FrameLayout
|
|
14
|
-
import android.widget.PopupMenu
|
|
15
|
-
import com.facebook.react.bridge.ReactContext
|
|
16
|
-
import com.facebook.react.bridge.ReadableArray
|
|
17
|
-
import com.facebook.react.uimanager.UIManagerHelper
|
|
18
|
-
|
|
19
|
-
public class ReactPopupMenuContainer(context: Context) : FrameLayout(context) {
|
|
20
|
-
private var menuItems: ReadableArray? = null
|
|
21
|
-
|
|
22
|
-
public fun setMenuItems(items: ReadableArray?) {
|
|
23
|
-
menuItems = items
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public fun showPopupMenu() {
|
|
27
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
|
28
|
-
val view = getChildAt(0)
|
|
29
|
-
val popupMenu = PopupMenu(context, view)
|
|
30
|
-
var menu = popupMenu.menu
|
|
31
|
-
val items = menuItems
|
|
32
|
-
if (items != null) {
|
|
33
|
-
for (i in 0 until items.size()) {
|
|
34
|
-
menu.add(Menu.NONE, Menu.NONE, i, items.getString(i))
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
popupMenu.setOnMenuItemClickListener { menuItem ->
|
|
38
|
-
val reactContext = context as ReactContext
|
|
39
|
-
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
|
40
|
-
if (eventDispatcher != null) {
|
|
41
|
-
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
|
42
|
-
eventDispatcher.dispatchEvent(PopupMenuSelectionEvent(surfaceId, id, menuItem.order))
|
|
43
|
-
}
|
|
44
|
-
true
|
|
45
|
-
}
|
|
46
|
-
popupMenu.show()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuManager.kt
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
package com.facebook.react.views.popupmenu
|
|
9
|
-
|
|
10
|
-
import com.facebook.react.bridge.ReadableArray
|
|
11
|
-
import com.facebook.react.module.annotations.ReactModule
|
|
12
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
|
-
import com.facebook.react.uimanager.ViewGroupManager
|
|
14
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
15
|
-
import com.facebook.react.viewmanagers.AndroidPopupMenuManagerInterface
|
|
16
|
-
|
|
17
|
-
@ReactModule(name = ReactPopupMenuManager.REACT_CLASS)
|
|
18
|
-
public class ReactPopupMenuManager :
|
|
19
|
-
ViewGroupManager<ReactPopupMenuContainer>(),
|
|
20
|
-
AndroidPopupMenuManagerInterface<ReactPopupMenuContainer> {
|
|
21
|
-
override fun createViewInstance(reactContext: ThemedReactContext): ReactPopupMenuContainer {
|
|
22
|
-
return ReactPopupMenuContainer(reactContext)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@ReactProp(name = "menuItems")
|
|
26
|
-
override fun setMenuItems(view: ReactPopupMenuContainer, menuItems: ReadableArray?) {
|
|
27
|
-
view.setMenuItems(menuItems)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override fun getName(): String {
|
|
31
|
-
return REACT_CLASS
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override fun receiveCommand(
|
|
35
|
-
view: ReactPopupMenuContainer,
|
|
36
|
-
commandId: String,
|
|
37
|
-
items: ReadableArray?
|
|
38
|
-
) {
|
|
39
|
-
when (commandId) {
|
|
40
|
-
"show" -> show(view)
|
|
41
|
-
else -> {
|
|
42
|
-
// no-op
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
override fun show(popupMenu: ReactPopupMenuContainer) {
|
|
48
|
-
popupMenu.showPopupMenu()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public companion object {
|
|
52
|
-
public const val REACT_CLASS: String = "AndroidPopupMenu"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
|
-
import type {
|
|
14
|
-
DirectEventHandler,
|
|
15
|
-
Int32,
|
|
16
|
-
} from '../../../../Libraries/Types/CodegenTypes';
|
|
17
|
-
|
|
18
|
-
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
19
|
-
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
20
|
-
import * as React from 'react';
|
|
21
|
-
|
|
22
|
-
type PopupMenuSelectionEvent = $ReadOnly<{
|
|
23
|
-
item: Int32,
|
|
24
|
-
}>;
|
|
25
|
-
|
|
26
|
-
type NativeProps = $ReadOnly<{
|
|
27
|
-
...ViewProps,
|
|
28
|
-
|
|
29
|
-
//Props
|
|
30
|
-
menuItems?: ?$ReadOnlyArray<string>,
|
|
31
|
-
|
|
32
|
-
onSelectionChange?: DirectEventHandler<PopupMenuSelectionEvent>,
|
|
33
|
-
}>;
|
|
34
|
-
|
|
35
|
-
type ComponentType = HostComponent<NativeProps>;
|
|
36
|
-
|
|
37
|
-
interface NativeCommands {
|
|
38
|
-
+show: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
42
|
-
supportedCommands: ['show'],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export default (codegenNativeComponent<NativeProps>(
|
|
46
|
-
'AndroidPopupMenu',
|
|
47
|
-
): HostComponent<NativeProps>);
|