Files
react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java
T
Joshua Gross ce226c1f28 Fix T54997838
Summary:
Fixes T54997838 by preventing any view mutations during `onMeasure` calls.

There might still be places where this is possible, but this is where I'm seeing all the crashes currently.

See comments in ReactRootView for why views were mutated during onMeasure.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18518591

fbshipit-source-id: 1406af8a6b0bfcc86f4cc5b451b3967f312dfd85
2019-11-14 21:23:32 -08:00

74 lines
2.7 KiB
Java

/*
* Copyright (c) Facebook, Inc. and its 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.bridge;
import android.view.View;
import androidx.annotation.Nullable;
public interface UIManager extends JSIModule, PerformanceCounter {
/** Registers a new root view. */
<T extends View> int addRootView(
final T rootView, WritableMap initialProps, @Nullable String initialUITemplate);
/**
* Updates the layout specs of the RootShadowNode based on the Measure specs received by
* parameters.
*/
void updateRootLayoutSpecs(int rootTag, int widthMeasureSpec, int heightMeasureSpec);
/**
* Dispatches the commandId received by parameter to the view associated with the reactTag. The
* command will be processed in the UIThread.
*
* <p>Receiving commands as ints is deprecated and will be removed in a future release.
*
* @param reactTag {@link int} that identifies the view that will receive this command
* @param commandId {@link int} command id
* @param commandArgs {@link ReadableArray} parameters associated with the command
*/
void dispatchCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs);
/**
* Dispatches the commandId received by parameter to the view associated with the reactTag. The
* command will be processed in the UIThread.
*
* @param reactTag {@link int} that identifies the view that will receive this command
* @param commandId {@link String} command id
* @param commandArgs {@link ReadableArray} parameters associated with the command
*/
void dispatchCommand(int reactTag, String commandId, @Nullable ReadableArray commandArgs);
/**
* Used by native animated module to bypass the process of updating the values through the shadow
* view hierarchy. This method will directly update native views, which means that updates for
* layout-related propertied won't be handled properly. Make sure you know what you're doing
* before calling this method :)
*
* @param tag {@link int} that identifies the view that will be updated
* @param props {@link ReadableMap} props that should be immediately updated in view
*/
void synchronouslyUpdateViewOnUIThread(int reactTag, ReadableMap props);
/**
* Dispatch an accessibility event to a view asynchronously.
*
* @param reactTag
* @param eventType
*/
void sendAccessibilityEvent(int reactTag, int eventType);
/**
* When mounting instructions are scheduled on the UI thread, should they be executed immediately?
* For Fabric. Should noop in pre-Fabric.
*
* @param flag
*/
void setAllowImmediateUIOperationExecution(boolean flag);
}