Pass minTimeLeftInFrameForNonBatchedOperationMs from above
Reviewed By: AaaChiuuu Differential Revision: D5658066 fbshipit-source-id: f89a8bcfc180210f7361b03f718f65b1d59cbf85
This commit is contained in:
parent
a777517651
commit
992777b765
|
@ -8,12 +8,6 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
|
@ -40,7 +34,11 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
|
@ -87,11 +85,8 @@ public class CatalystNativeJSToJavaParametersTestCase extends ReactIntegrationTe
|
|||
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
|
||||
new ReactViewManager());
|
||||
final UIManagerModule mUIManager = new UIManagerModule(
|
||||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
final UIManagerModule mUIManager =
|
||||
new UIManagerModule(getContext(), viewManagers, new UIImplementationProvider(), false, 0);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.ObjectAlreadyConsumedException;
|
||||
|
@ -29,7 +26,8 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
|
@ -64,11 +62,8 @@ public class CatalystNativeJavaToJSArgumentsTestCase extends ReactIntegrationTes
|
|||
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
|
||||
new ReactViewManager());
|
||||
final UIManagerModule mUIManager = new UIManagerModule(
|
||||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
final UIManagerModule mUIManager =
|
||||
new UIManagerModule(getContext(), viewManagers, new UIImplementationProvider(), false, 0);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.react.bridge.BaseJavaModule;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
@ -18,9 +16,9 @@ import com.facebook.react.bridge.WritableArray;
|
|||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.bridge.WritableNativeArray;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.modules.appstate.AppStateModule;
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.testing.AssertModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
|
@ -28,7 +26,7 @@ import com.facebook.react.testing.ReactTestHelper;
|
|||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
|
@ -113,11 +111,9 @@ public class CatalystNativeJavaToJSReturnValuesTestCase extends ReactIntegration
|
|||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
final UIManagerModule mUIManager = new UIManagerModule(
|
||||
getContext(),
|
||||
new ArrayList<ViewManager>(),
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
final UIManagerModule mUIManager =
|
||||
new UIManagerModule(
|
||||
getContext(), new ArrayList<ViewManager>(), new UIImplementationProvider(), false, 0);
|
||||
|
||||
mAssertModule = new AssertModule();
|
||||
|
||||
|
|
|
@ -9,21 +9,20 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.modules.appstate.AppStateModule;
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
|
@ -31,9 +30,8 @@ import com.facebook.react.uimanager.ViewManager;
|
|||
import com.facebook.react.views.text.ReactRawTextManager;
|
||||
import com.facebook.react.views.text.ReactTextViewManager;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Test case for basic {@link UIManagerModule} functionality.
|
||||
|
@ -80,11 +78,8 @@ public class CatalystUIManagerTestCase extends ReactIntegrationTestCase {
|
|||
new ReactViewManager(),
|
||||
new ReactTextViewManager(),
|
||||
new ReactRawTextManager());
|
||||
uiManager = new UIManagerModule(
|
||||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
uiManager =
|
||||
new UIManagerModule(getContext(), viewManagers, new UIImplementationProvider(), false, 0);
|
||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -49,7 +49,8 @@ public class JSLocaleTest extends ReactIntegrationTestCase {
|
|||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
false,
|
||||
0);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
|
@ -19,7 +15,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
@ -27,14 +22,17 @@ import com.facebook.react.bridge.UiThreadUtil;
|
|||
import com.facebook.react.modules.appstate.AppStateModule;
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.views.progressbar.ReactProgressBarViewManager;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Test to verify that Progress bar renders as a view of the right size
|
||||
|
@ -70,11 +68,8 @@ public class ProgressBarTestCase extends ReactIntegrationTestCase {
|
|||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
|
||||
new ReactViewManager(),
|
||||
new ReactProgressBarViewManager());
|
||||
mUIManager = new UIManagerModule(
|
||||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
mUIManager =
|
||||
new UIManagerModule(getContext(), viewManagers, new UIImplementationProvider(), false, 0);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -8,13 +8,9 @@
|
|||
|
||||
package com.facebook.react.tests;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
@ -22,15 +18,17 @@ import com.facebook.react.bridge.UiThreadUtil;
|
|||
import com.facebook.react.modules.appstate.AppStateModule;
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.views.view.ReactViewGroup;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
import com.facebook.react.testing.FakeWebSocketModule;
|
||||
import com.facebook.react.testing.ReactIntegrationTestCase;
|
||||
import com.facebook.react.testing.ReactTestHelper;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ViewRenderingTestCase extends ReactIntegrationTestCase {
|
||||
|
||||
|
@ -51,11 +49,8 @@ public class ViewRenderingTestCase extends ReactIntegrationTestCase {
|
|||
super.setUp();
|
||||
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
|
||||
final UIManagerModule uiManager = new UIManagerModule(
|
||||
getContext(),
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
final UIManagerModule uiManager =
|
||||
new UIManagerModule(getContext(), viewManagers, new UIImplementationProvider(), false, 0);
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package com.facebook.react;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START;
|
||||
|
||||
import com.facebook.react.bridge.ModuleSpec;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
|
@ -36,11 +36,9 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Provider;
|
||||
/**
|
||||
* This module should be removed following the completion of an experiment into splitting this into
|
||||
* three modules to allow for more light-weight instantiations of the bridge without UIManager
|
||||
|
@ -74,16 +72,19 @@ import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_
|
|||
private final DefaultHardwareBackBtnHandler mHardwareBackBtnHandler;
|
||||
private final UIImplementationProvider mUIImplementationProvider;
|
||||
private final boolean mLazyViewManagersEnabled;
|
||||
private final int mMinTimeLeftInFrameForNonBatchedOperationMs;
|
||||
|
||||
CoreModulesPackage(
|
||||
ReactInstanceManager reactInstanceManager,
|
||||
DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
|
||||
UIImplementationProvider uiImplementationProvider,
|
||||
boolean lazyViewManagersEnabled) {
|
||||
boolean lazyViewManagersEnabled,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
mReactInstanceManager = reactInstanceManager;
|
||||
mHardwareBackBtnHandler = hardwareBackBtnHandler;
|
||||
mUIImplementationProvider = uiImplementationProvider;
|
||||
mLazyViewManagersEnabled = lazyViewManagersEnabled;
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,7 +193,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_
|
|||
reactContext,
|
||||
viewManagersList,
|
||||
mUIImplementationProvider,
|
||||
mLazyViewManagersEnabled);
|
||||
mLazyViewManagersEnabled,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.facebook.react.bridge.JSBundleLoader;
|
|||
import com.facebook.react.bridge.JSCJavaScriptExecutor;
|
||||
import com.facebook.react.bridge.JavaJSExecutor;
|
||||
import com.facebook.react.bridge.JavaScriptExecutor;
|
||||
import com.facebook.react.bridge.NativeArray;
|
||||
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
|
||||
import com.facebook.react.bridge.NativeModuleRegistry;
|
||||
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
|
||||
|
@ -55,7 +56,6 @@ import com.facebook.react.bridge.ReactContext;
|
|||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.NativeArray;
|
||||
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
|
@ -149,6 +149,7 @@ public class ReactInstanceManager {
|
|||
private final boolean mLazyViewManagersEnabled;
|
||||
private final boolean mUseSeparateUIBackgroundThread;
|
||||
private final int mMinNumShakes;
|
||||
private final int mMinTimeLeftInFrameForNonBatchedOperationMs;
|
||||
|
||||
private final ReactInstanceDevCommandsHandler mDevInterface =
|
||||
new ReactInstanceDevCommandsHandler() {
|
||||
|
@ -224,7 +225,8 @@ public class ReactInstanceManager {
|
|||
boolean useSeparateUIBackgroundThread,
|
||||
int minNumShakes,
|
||||
boolean splitPackagesEnabled,
|
||||
boolean useOnlyDefaultPackages) {
|
||||
boolean useOnlyDefaultPackages,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.ctor()");
|
||||
initializeSoLoaderIfNecessary(applicationContext);
|
||||
|
||||
|
@ -254,6 +256,7 @@ public class ReactInstanceManager {
|
|||
mJSCConfig = jscConfig;
|
||||
mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
|
||||
mLazyViewManagersEnabled = lazyViewManagersEnabled;
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
||||
mUseSeparateUIBackgroundThread = useSeparateUIBackgroundThread;
|
||||
mMinNumShakes = minNumShakes;
|
||||
|
||||
|
@ -263,7 +266,8 @@ public class ReactInstanceManager {
|
|||
this,
|
||||
mBackBtnHandler,
|
||||
mUIImplementationProvider,
|
||||
mLazyViewManagersEnabled);
|
||||
mLazyViewManagersEnabled,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs);
|
||||
mPackages.add(coreModulesPackage);
|
||||
} else {
|
||||
mPackages.add(new BridgeCorePackage(this, mBackBtnHandler));
|
||||
|
@ -275,7 +279,8 @@ public class ReactInstanceManager {
|
|||
new ReactNativeCorePackage(
|
||||
this,
|
||||
mUIImplementationProvider,
|
||||
mLazyViewManagersEnabled));
|
||||
mLazyViewManagersEnabled,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs));
|
||||
}
|
||||
}
|
||||
mPackages.addAll(packages);
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ReactInstanceManagerBuilder {
|
|||
private int mMinNumShakes = 1;
|
||||
private boolean mEnableSplitPackage;
|
||||
private boolean mUseOnlyDefaultPackages;
|
||||
private int mMinTimeLeftInFrameForNonBatchedOperationMs = -1;
|
||||
|
||||
/* package protected */ ReactInstanceManagerBuilder() {
|
||||
}
|
||||
|
@ -216,6 +217,12 @@ public class ReactInstanceManagerBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setMinTimeLeftInFrameForNonBatchedOperationMs(
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new {@link ReactInstanceManager}.
|
||||
* Before calling {@code build}, the following must be called:
|
||||
|
@ -248,9 +255,10 @@ public class ReactInstanceManagerBuilder {
|
|||
mApplication,
|
||||
mCurrentActivity,
|
||||
mDefaultHardwareBackBtnHandler,
|
||||
(mJSBundleLoader == null && mJSBundleAssetUrl != null) ?
|
||||
JSBundleLoader.createAssetLoader(mApplication, mJSBundleAssetUrl, false /*Asynchronous*/) :
|
||||
mJSBundleLoader,
|
||||
(mJSBundleLoader == null && mJSBundleAssetUrl != null)
|
||||
? JSBundleLoader.createAssetLoader(
|
||||
mApplication, mJSBundleAssetUrl, false /*Asynchronous*/)
|
||||
: mJSBundleLoader,
|
||||
mJSMainModulePath,
|
||||
mPackages,
|
||||
mUseDeveloperSupport,
|
||||
|
@ -266,6 +274,7 @@ public class ReactInstanceManagerBuilder {
|
|||
mUseSeparateUIBackgroundThread,
|
||||
mMinNumShakes,
|
||||
mEnableSplitPackage,
|
||||
mUseOnlyDefaultPackages);
|
||||
mUseOnlyDefaultPackages,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,8 @@
|
|||
|
||||
package com.facebook.react;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START;
|
||||
|
||||
import com.facebook.react.bridge.ModuleSpec;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
|
@ -24,9 +22,9 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Provider;
|
||||
|
||||
/**
|
||||
* Package defining core framework modules for initializing ReactNative (e.g. UIManager). It should be used for modules that
|
||||
|
@ -43,14 +41,17 @@ public class ReactNativeCorePackage extends LazyReactPackage {
|
|||
private final ReactInstanceManager mReactInstanceManager;
|
||||
private final UIImplementationProvider mUIImplementationProvider;
|
||||
private final boolean mLazyViewManagersEnabled;
|
||||
private final int mMinTimeLeftInFrameForNonBatchedOperationMs;
|
||||
|
||||
public ReactNativeCorePackage(
|
||||
ReactInstanceManager reactInstanceManager,
|
||||
UIImplementationProvider uiImplementationProvider,
|
||||
boolean lazyViewManagersEnabled) {
|
||||
boolean lazyViewManagersEnabled,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
mReactInstanceManager = reactInstanceManager;
|
||||
mUIImplementationProvider = uiImplementationProvider;
|
||||
mLazyViewManagersEnabled = lazyViewManagersEnabled;
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +87,8 @@ public class ReactNativeCorePackage extends LazyReactPackage {
|
|||
reactContext,
|
||||
viewManagersList,
|
||||
mUIImplementationProvider,
|
||||
mLazyViewManagersEnabled);
|
||||
mLazyViewManagersEnabled,
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
|
||||
|
|
|
@ -22,12 +22,11 @@ import com.facebook.react.uimanager.ViewManager;
|
|||
import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* FlatUIImplementation builds on top of UIImplementation and allows pre-creating everything
|
||||
|
@ -88,7 +87,8 @@ public class FlatUIImplementation extends UIImplementation {
|
|||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagers,
|
||||
EventDispatcher eventDispatcher,
|
||||
boolean memoryImprovementEnabled) {
|
||||
boolean memoryImprovementEnabled,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
|
||||
Map<String, ViewManager> viewManagerMap = buildViewManagerMap(viewManagers);
|
||||
|
||||
|
@ -107,9 +107,9 @@ public class FlatUIImplementation extends UIImplementation {
|
|||
ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagerMap);
|
||||
FlatNativeViewHierarchyManager nativeViewHierarchyManager = new FlatNativeViewHierarchyManager(
|
||||
viewManagerRegistry);
|
||||
FlatUIViewOperationQueue operationsQueue = new FlatUIViewOperationQueue(
|
||||
reactContext,
|
||||
nativeViewHierarchyManager);
|
||||
FlatUIViewOperationQueue operationsQueue =
|
||||
new FlatUIViewOperationQueue(
|
||||
reactContext, nativeViewHierarchyManager, minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
return new FlatUIImplementation(
|
||||
reactContext,
|
||||
imageViewManager,
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
|
||||
package com.facebook.react.flat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* UIImplementationProvider that creates instances of {@link FlatUIImplementation}.
|
||||
|
@ -35,11 +34,13 @@ public final class FlatUIImplementationProvider extends UIImplementationProvider
|
|||
public FlatUIImplementation createUIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagers,
|
||||
EventDispatcher eventDispatcher) {
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
return FlatUIImplementation.createInstance(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
eventDispatcher,
|
||||
mMemoryImprovementEnabled);
|
||||
mMemoryImprovementEnabled,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,9 @@
|
|||
|
||||
package com.facebook.react.flat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
|
@ -25,6 +20,8 @@ import com.facebook.react.uimanager.NoSuchNativeViewException;
|
|||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.TouchTargetHelper;
|
||||
import com.facebook.react.uimanager.UIViewOperationQueue;
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* FlatUIViewOperationQueue extends {@link UIViewOperationQueue} to add
|
||||
|
@ -399,8 +396,9 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
|
|||
|
||||
public FlatUIViewOperationQueue(
|
||||
ReactApplicationContext reactContext,
|
||||
FlatNativeViewHierarchyManager nativeViewHierarchyManager) {
|
||||
super(reactContext, nativeViewHierarchyManager);
|
||||
FlatNativeViewHierarchyManager nativeViewHierarchyManager,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
super(reactContext, nativeViewHierarchyManager, minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
|
||||
mNativeViewHierarchyManager = nativeViewHierarchyManager;
|
||||
}
|
||||
|
|
|
@ -50,18 +50,27 @@ public class UIImplementation {
|
|||
public UIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagers,
|
||||
EventDispatcher eventDispatcher) {
|
||||
this(reactContext, new ViewManagerRegistry(viewManagers), eventDispatcher);
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
new ViewManagerRegistry(viewManagers),
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
|
||||
private UIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerRegistry viewManagers,
|
||||
EventDispatcher eventDispatcher) {
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIViewOperationQueue(reactContext, new NativeViewHierarchyManager(viewManagers)),
|
||||
new UIViewOperationQueue(
|
||||
reactContext,
|
||||
new NativeViewHierarchyManager(viewManagers),
|
||||
minTimeLeftInFrameForNonBatchedOperationMs),
|
||||
eventDispatcher);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,9 @@
|
|||
*/
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides UIImplementation to use in {@link UIManagerModule}.
|
||||
|
@ -20,7 +19,9 @@ public class UIImplementationProvider {
|
|||
public UIImplementation createUIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagers,
|
||||
EventDispatcher eventDispatcher) {
|
||||
return new UIImplementation(reactContext, viewManagers, eventDispatcher);
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
return new UIImplementation(
|
||||
reactContext, viewManagers, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,13 +85,18 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
|||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagerList,
|
||||
UIImplementationProvider uiImplementationProvider,
|
||||
boolean lazyViewManagersEnabled) {
|
||||
boolean lazyViewManagersEnabled,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
super(reactContext);
|
||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
|
||||
mEventDispatcher = new EventDispatcher(reactContext);
|
||||
mModuleConstants = createConstants(viewManagerList, lazyViewManagersEnabled);
|
||||
mUIImplementation = uiImplementationProvider
|
||||
.createUIImplementation(reactContext, viewManagerList, mEventDispatcher);
|
||||
mUIImplementation =
|
||||
uiImplementationProvider.createUIImplementation(
|
||||
reactContext,
|
||||
viewManagerList,
|
||||
mEventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
|
||||
reactContext.addLifecycleEventListener(this);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ import javax.annotation.concurrent.GuardedBy;
|
|||
*/
|
||||
public class UIViewOperationQueue {
|
||||
|
||||
public static final int DEFAULT_MIN_TIME_LEFT_IN_FRAME_FOR_NONBATCHED_OPERATION_MS = 8;
|
||||
|
||||
private final int[] mMeasureBuffer = new int[4];
|
||||
|
||||
/**
|
||||
|
@ -554,10 +556,16 @@ public class UIViewOperationQueue {
|
|||
|
||||
public UIViewOperationQueue(
|
||||
ReactApplicationContext reactContext,
|
||||
NativeViewHierarchyManager nativeViewHierarchyManager) {
|
||||
NativeViewHierarchyManager nativeViewHierarchyManager,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
mNativeViewHierarchyManager = nativeViewHierarchyManager;
|
||||
mAnimationRegistry = nativeViewHierarchyManager.getAnimationRegistry();
|
||||
mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext);
|
||||
mDispatchUIFrameCallback =
|
||||
new DispatchUIFrameCallback(
|
||||
reactContext,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs == -1
|
||||
? DEFAULT_MIN_TIME_LEFT_IN_FRAME_FOR_NONBATCHED_OPERATION_MS
|
||||
: minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
mReactApplicationContext = reactContext;
|
||||
}
|
||||
|
||||
|
@ -936,11 +944,13 @@ public class UIViewOperationQueue {
|
|||
*/
|
||||
private class DispatchUIFrameCallback extends GuardedFrameCallback {
|
||||
|
||||
private static final int MIN_TIME_LEFT_IN_FRAME_TO_SCHEDULE_MORE_WORK_MS = 8;
|
||||
private static final int FRAME_TIME_MS = 16;
|
||||
private final int mMinTimeLeftInFrameForNonBatchedOperationMs;
|
||||
|
||||
private DispatchUIFrameCallback(ReactContext reactContext) {
|
||||
private DispatchUIFrameCallback(
|
||||
ReactContext reactContext, int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
super(reactContext);
|
||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -984,7 +994,7 @@ public class UIViewOperationQueue {
|
|||
private void dispatchPendingNonBatchedOperations(long frameTimeNanos) {
|
||||
while (true) {
|
||||
long timeLeftInFrame = FRAME_TIME_MS - ((System.nanoTime() - frameTimeNanos) / 1000000);
|
||||
if (timeLeftInFrame < MIN_TIME_LEFT_IN_FRAME_TO_SCHEDULE_MORE_WORK_MS) {
|
||||
if (timeLeftInFrame < mMinTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.fest.assertions.api.Assertions.fail;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -30,9 +30,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.fest.assertions.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* Verifies that prop constants are generated properly based on {@code ReactProp} annotation.
|
||||
*/
|
||||
|
@ -145,11 +142,8 @@ public class ReactPropConstantsTest {
|
|||
public void testNativePropsIncludeCorrectTypes() {
|
||||
List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ViewManagerUnderTest());
|
||||
ReactApplicationContext reactContext = new ReactApplicationContext(RuntimeEnvironment.application);
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
Map<String, String> constants =
|
||||
(Map) valueAtPath(uiManagerModule.getConstants(), "SomeView", "NativeProps");
|
||||
assertThat(constants).isEqualTo(
|
||||
|
|
|
@ -9,14 +9,18 @@
|
|||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.fest.assertions.data.MapEntry;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -27,11 +31,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "android.*"})
|
||||
public class UIManagerModuleConstantsTest {
|
||||
|
@ -61,18 +60,16 @@ public class UIManagerModuleConstantsTest {
|
|||
when(mUIImplementationProvider.createUIImplementation(
|
||||
any(ReactApplicationContext.class),
|
||||
any(List.class),
|
||||
any(EventDispatcher.class)))
|
||||
any(EventDispatcher.class),
|
||||
anyInt()))
|
||||
.thenReturn(mock(UIImplementation.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoCustomConstants() {
|
||||
List<ViewManager> viewManagers = Arrays.asList(mock(ViewManager.class));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants)
|
||||
.containsKey(CUSTOM_BUBBLING_EVENT_TYPES)
|
||||
|
@ -86,11 +83,8 @@ public class UIManagerModuleConstantsTest {
|
|||
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
|
||||
when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
|
||||
|
@ -103,11 +97,8 @@ public class UIManagerModuleConstantsTest {
|
|||
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
|
||||
when(mockViewManager.getExportedCustomDirectEventTypeConstants())
|
||||
.thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
|
||||
.contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
|
||||
|
@ -121,11 +112,8 @@ public class UIManagerModuleConstantsTest {
|
|||
when(mockViewManager.getName()).thenReturn("RedPandaPhotoOfTheDayView");
|
||||
when(mockViewManager.getExportedViewConstants())
|
||||
.thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
|
||||
assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
|
||||
|
@ -140,11 +128,8 @@ public class UIManagerModuleConstantsTest {
|
|||
when(mockViewManager.getName()).thenReturn("SomeView");
|
||||
when(mockViewManager.getNativeProps())
|
||||
.thenReturn(MapBuilder.of("fooProp", "number"));
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
|
||||
.isEqualTo("number");
|
||||
|
@ -175,11 +160,8 @@ public class UIManagerModuleConstantsTest {
|
|||
MapBuilder.of("keyToOverride", "innerValueY", "extraKey", "valueY"))));
|
||||
|
||||
List<ViewManager> viewManagers = Arrays.asList(managerX, managerY);
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
mUIImplementationProvider,
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, mUIImplementationProvider, false, 0);
|
||||
Map<String, Object> constants = uiManagerModule.getConstants();
|
||||
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES)).containsKey("onTwirl");
|
||||
|
||||
|
|
|
@ -9,15 +9,19 @@
|
|||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.animation.AnimationPropertyUpdater;
|
||||
|
@ -35,7 +39,9 @@ import com.facebook.react.views.text.ReactTextShadowNode;
|
|||
import com.facebook.react.views.text.ReactTextViewManager;
|
||||
import com.facebook.react.views.view.ReactViewGroup;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -49,15 +55,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Tests for {@link UIManagerModule}.
|
||||
*/
|
||||
|
@ -818,11 +815,8 @@ public class UIManagerModuleTest {
|
|||
new ReactViewManager(),
|
||||
new ReactTextViewManager(),
|
||||
new ReactRawTextManager());
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
mReactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(mReactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
package com.facebook.react.views.text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Color;
|
||||
|
@ -24,7 +25,6 @@ import android.text.style.AbsoluteSizeSpan;
|
|||
import android.text.style.StrikethroughSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.JavaOnlyArray;
|
||||
|
@ -38,7 +38,9 @@ import com.facebook.react.uimanager.UIManagerModule;
|
|||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -52,11 +54,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Tests for {@link UIManagerModule} specifically for React Text/RawText.
|
||||
*/
|
||||
|
@ -431,11 +428,8 @@ public class ReactTextTest {
|
|||
new ReactTextViewManager(),
|
||||
new ReactRawTextManager(),
|
||||
});
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
package com.facebook.react.views.textinput;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.JavaOnlyArray;
|
||||
|
@ -27,7 +27,9 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
|||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
@ -41,11 +43,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Tests for TextInput.
|
||||
*/
|
||||
|
@ -182,11 +179,8 @@ public class TextInputTest {
|
|||
new ViewManager[] {
|
||||
new ReactTextInputManager(),
|
||||
});
|
||||
UIManagerModule uiManagerModule = new UIManagerModule(
|
||||
reactContext,
|
||||
viewManagers,
|
||||
new UIImplementationProvider(),
|
||||
false);
|
||||
UIManagerModule uiManagerModule =
|
||||
new UIManagerModule(reactContext, viewManagers, new UIImplementationProvider(), false, 0);
|
||||
uiManagerModule.onHostResume();
|
||||
return uiManagerModule;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue