mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This diff adds `RedBoxSurfaceDelegate` to replace existing logic in `DevSupportManagerBase` to abstract how we show/hide the RedBox surface. The delegate will wrap a RedBoxDialog instance, which is used to show/hide the dialog for default behavior (when there is no surface delegate for redbox got provided). I also updated the interface for delegate to accomodate new use cases: - Add `isShowing` for the `SurfaceDelegate` - Add a list of getters for `DevSupportManager` for data access in the delegate - (Update 2/7) Separate Dialog from `RedBoxDialog`, and re-named it to `RedBoxContentView`. This is to make it clear that the delegate is responsible to provide actual surface implementation (Dialog). The content view is meant to be shared. Changelog: [Android][Internal] Reviewed By: javache Differential Revision: D33987835 fbshipit-source-id: 57c20648e7f2ec8238963feca27ccd5518e7931d
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
package com.facebook.react.common;
|
|
|
|
/**
|
|
* Interface for handling a surface in React Native. In mobile platform a surface can be any
|
|
* container that holds some {@link View}. For example, a Dialog can be a surface to wrap content
|
|
* view object as needed. In VR platform, a surface is provided by Shell panel app sdk, which
|
|
* requires custom logic to show/hide. NativeModules requires a surface will delegate interactions
|
|
* with the surface to a SurfaceDelegate.
|
|
*/
|
|
public interface SurfaceDelegate {
|
|
/**
|
|
* Create the React content view that uses the appKey as the React application name
|
|
*
|
|
* @param appKey
|
|
*/
|
|
void createContentView(String appKey);
|
|
|
|
/**
|
|
* Check if the content view is created and ready to be shown
|
|
*
|
|
* @return true if the content view is ready to be shown
|
|
*/
|
|
boolean isContentViewReady();
|
|
|
|
/** Destroy the React content view to avoid memory leak */
|
|
void destroyContentView();
|
|
|
|
/** Show the surface containing the React content view */
|
|
void show();
|
|
|
|
/** Hide the surface containing the React content view */
|
|
void hide();
|
|
|
|
/** Check if the surface is currently showing */
|
|
boolean isShowing();
|
|
}
|