Add GuardedRunnable in more places

Summary:
Depends on D4537287

Use new GuardedRunnable abstraction

Reviewed By: achen1

Differential Revision: D4537370

fbshipit-source-id: ad56eaa23c21624008d8ed48837a2d1020cfd2d9
This commit is contained in:
Andy Street
2017-02-09 11:29:02 -08:00
committed by Facebook Github Bot
parent 08db896321
commit a99f6f51a9
3 changed files with 16 additions and 11 deletions

View File

@@ -27,6 +27,7 @@ import android.widget.FrameLayout;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.R;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.annotations.VisibleForTesting;
@@ -303,10 +304,11 @@ public class ReactModalHostView extends ViewGroup implements LifecycleEventListe
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (getChildCount() > 0) {
((ReactContext) getContext()).runOnNativeModulesQueueThread(
new Runnable() {
ReactContext reactContext = (ReactContext) getContext();
reactContext.runOnNativeModulesQueueThread(
new GuardedRunnable(reactContext) {
@Override
public void run() {
public void runGuarded() {
((ReactContext) getContext()).getNativeModule(UIManagerModule.class)
.updateNodeSize(getChildAt(0).getId(), w, h);
}