mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 06:45:02 +08:00
Add a way to dismiss PopupMenu elements
Summary: In native Android apps, like the YouTube app, context menus are closed when the device orientation changes. In React Native apps instead, when having a [PopupMenu](https://developer.android.com/reference/android/widget/PopupMenu.html) open and rotating the device, the PopupMenu is not dismissed and appears in a wrong position on the screen. This PR exposes a `dismissPopupMenu` method to allow the application to dismiss any open PopupMenu: ```(javascript) UIManager.dismissPopupMenu() ``` Closes https://github.com/facebook/react-native/pull/15636 Differential Revision: D6837663 Pulled By: hramos fbshipit-source-id: 7b0f4f04341129ad45c703a50897e17d93651974
This commit is contained in:
committed by
Facebook Github Bot
parent
6426735e82
commit
353c070be9
@@ -600,6 +600,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
mUIImplementation.showPopupMenu(reactTag, items, error, success);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void dismissPopupMenu() {
|
||||
mUIImplementation.dismissPopupMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* LayoutAnimation API on Android is currently experimental. Therefore, it needs to be enabled
|
||||
* explicitly in order to avoid regression in existing application written for iOS using this API.
|
||||
|
||||
Reference in New Issue
Block a user