mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f217bce77a | ||
|
|
e2087457f8 | ||
|
|
fc5e33b582 | ||
|
|
6dfe59e1df | ||
|
|
db65cb70de | ||
|
|
a0e11904d6 | ||
|
|
120a417320 | ||
|
|
5a79ece192 | ||
|
|
f000116197 | ||
|
|
5cf4d0899f | ||
|
|
68650badd2 | ||
|
|
5ec8e60581 | ||
|
|
918f02dcc3 | ||
|
|
5fe782a800 | ||
|
|
abfb9cbd40 | ||
|
|
3bf5cb3d0e | ||
|
|
ead669ade3 | ||
|
|
625f69f284 | ||
|
|
06034554e4 | ||
|
|
298ec6ca5d | ||
|
|
c1200718a0 | ||
|
|
a3933e6878 | ||
|
|
9f8179afa7 | ||
|
|
e6bff3f1fe | ||
|
|
feeef97554 | ||
|
|
9005d93e32 | ||
|
|
74c03b67e3 | ||
|
|
34201d8387 | ||
|
|
2edda6d967 |
@@ -17,7 +17,7 @@ runs:
|
||||
env:
|
||||
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
|
||||
run: |
|
||||
node ./scripts/diff-api-snapshot \
|
||||
node ./scripts/js-api/diff-api-snapshot \
|
||||
${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \
|
||||
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
|
||||
> $SCRATCH_DIR/output.json
|
||||
|
||||
@@ -32,7 +32,7 @@ if (process.env.FBSOURCE_ENV === '1') {
|
||||
require('@fb-tools/babel-register');
|
||||
} else {
|
||||
// Register Babel to allow local packages to be loaded from source
|
||||
require('../scripts/babel-register').registerForMonorepo();
|
||||
require('../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
const transformer = require('@react-native/metro-babel-transformer');
|
||||
|
||||
+4
-1
@@ -8,14 +8,16 @@
|
||||
"android": "yarn --cwd packages/rn-tester android",
|
||||
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
|
||||
"build": "node ./scripts/build/build.js",
|
||||
"build-types": "node ./scripts/build-types",
|
||||
"build-types": "node ./scripts/js-api/build-types",
|
||||
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
|
||||
"clean": "node ./scripts/build/clean.js",
|
||||
"cxx-api-build": "node ./scripts/cxx-api/public-api.js",
|
||||
"flow-check": "flow check",
|
||||
"flow": "flow",
|
||||
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
|
||||
"format": "npm run prettier && npm run clang-format",
|
||||
"featureflags": "yarn --cwd packages/react-native featureflags",
|
||||
"js-api-diff": "node ./scripts/js-api/diff-api-snapshot",
|
||||
"lint-ci": "./.github/workflow-scripts/analyze_code.sh && yarn shellcheck",
|
||||
"lint-markdown": "markdownlint-cli2 2>&1",
|
||||
"lint": "eslint --max-warnings 0 .",
|
||||
@@ -82,6 +84,7 @@
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.29.1",
|
||||
"hermes-transform": "0.29.1",
|
||||
"ini": "^5.0.0",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-config": "^29.7.0",
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) {
|
||||
require('../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = require('./index.flow');
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
|
||||
require('../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = require('./index.flow');
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './version.flow';
|
||||
*/
|
||||
|
||||
if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
|
||||
require('../../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = require('./version.flow');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@generated SignedSource<<8c4db6a5e1ba269169ac93cc53f95538>>
|
||||
Git revision: 51a91a2ad62e7f585912ed314a350a72de84d6ed
|
||||
@generated SignedSource<<1ce3fb7dd23581737fedaf58528fe575>>
|
||||
Git revision: 844f225009e6445d088ed0e431d1fc430325ed95
|
||||
Built with --nohooks: false
|
||||
Is local checkout: false
|
||||
Remote URL: https://github.com/facebook/react-native-devtools-frontend
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (!Boolean(process.env.BUILD_EXCLUDE_BABEL_REGISTER)) {
|
||||
require('../../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = require('./index.flow');
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) {
|
||||
require('../../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
export * from './index.flow';
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) {
|
||||
require('../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
export * from './index.flow';
|
||||
|
||||
+1
@@ -148,6 +148,7 @@ abstract class GeneratePackageListTask : DefaultTask() {
|
||||
|
||||
{{ packageImports }}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PackageList {
|
||||
private Application application;
|
||||
private ReactNativeHost reactNativeHost;
|
||||
|
||||
+3
-1
@@ -233,6 +233,7 @@ class GeneratePackageListTaskTest {
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PackageList {
|
||||
private Application application;
|
||||
private ReactNativeHost reactNativeHost;
|
||||
@@ -311,7 +312,8 @@ class GeneratePackageListTaskTest {
|
||||
import com.facebook.react.aPackage;
|
||||
// @react-native/another-package
|
||||
import com.facebook.react.anotherPackage;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PackageList {
|
||||
private Application application;
|
||||
private ReactNativeHost reactNativeHost;
|
||||
|
||||
@@ -13,7 +13,7 @@ export type * from './index.flow';
|
||||
*/
|
||||
|
||||
if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) {
|
||||
require('../../../scripts/babel-register').registerForMonorepo();
|
||||
require('../../../scripts/shared/babelRegister').registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = require('./index.flow');
|
||||
|
||||
@@ -65,7 +65,7 @@ const Links: Array<{
|
||||
},
|
||||
{
|
||||
title: 'Community',
|
||||
description: 'Expore & get help',
|
||||
description: 'Explore & get help',
|
||||
url: 'https://reactnative.dev/community/overview',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -65,15 +65,15 @@ const TestTemplate = ({
|
||||
propValue: string,
|
||||
}) => `
|
||||
TEST(${componentName}_${testName}, etc) {
|
||||
auto propParser = RawPropsParser();
|
||||
RawPropsParser propParser{};
|
||||
propParser.prepare<${componentName}>();
|
||||
auto const &sourceProps = ${componentName}();
|
||||
auto const &rawProps = RawProps(folly::dynamic::object("${propName}", ${propValue}));
|
||||
${componentName} sourceProps{};
|
||||
RawProps rawProps(folly::dynamic::object("${propName}", ${propValue}));
|
||||
|
||||
ContextContainer contextContainer{};
|
||||
PropsParserContext parserContext{-1, contextContainer};
|
||||
|
||||
rawProps.parse(propParser, parserContext);
|
||||
rawProps.parse(propParser);
|
||||
${componentName}(parserContext, sourceProps, rawProps);
|
||||
}
|
||||
`;
|
||||
|
||||
+240
-240
File diff suppressed because it is too large
Load Diff
+2
@@ -12,7 +12,9 @@ import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
public class OSSLibraryExamplePackage : ReactPackage {
|
||||
@Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
||||
listOf(NativeSampleModule(reactContext))
|
||||
|
||||
|
||||
@@ -84,4 +84,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -55,4 +55,5 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -53,4 +53,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple")
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -50,4 +50,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-featureflags")
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -52,4 +52,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -49,4 +49,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -19,6 +19,8 @@ function processAspectRatio(aspectRatio?: number | string): ?number {
|
||||
if (typeof aspectRatio !== 'string') {
|
||||
if (__DEV__) {
|
||||
invariant(
|
||||
/* $FlowFixMe[constant-condition] Error discovered during Constant
|
||||
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
|
||||
!aspectRatio,
|
||||
'aspectRatio must either be a number, a ratio string or `auto`. You passed: %s',
|
||||
aspectRatio,
|
||||
|
||||
@@ -49,4 +49,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple")
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -83,10 +83,6 @@ Pod::Spec.new do |s|
|
||||
ss.exclude_files = exclude_files
|
||||
ss.private_header_files = "React/Cxx*/*.h"
|
||||
|
||||
# Include prebuilt if we're not building from source
|
||||
if !ReactNativeCoreUtils.build_rncore_from_source()
|
||||
ss.dependency "React-Core-prebuilt", version
|
||||
end
|
||||
end
|
||||
|
||||
s.subspec "DevSupport" do |ss|
|
||||
@@ -137,4 +133,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -63,4 +63,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple")
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -61,6 +61,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
s.subspec "components" do |ss|
|
||||
ss.source_files = podspec_sources("FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{m,mm,cpp,h}", "FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/**/*.{h}")
|
||||
|
||||
@@ -97,6 +97,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
s.test_spec 'Tests' do |test_spec|
|
||||
test_spec.source_files = podspec_sources("Tests/**/*.{mm}", "")
|
||||
|
||||
@@ -68,4 +68,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -353,7 +353,7 @@ public abstract class com/facebook/react/ReactNativeHost {
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/ReactPackage {
|
||||
public abstract fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
|
||||
public fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
|
||||
public abstract fun createViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
|
||||
public fun getModule (Ljava/lang/String;Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/NativeModule;
|
||||
}
|
||||
@@ -1561,28 +1561,26 @@ public abstract interface class com/facebook/react/bridge/queue/MessageQueueThre
|
||||
public abstract fun assertIsOnThread ()V
|
||||
public abstract fun assertIsOnThread (Ljava/lang/String;)V
|
||||
public abstract fun callOnQueue (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;
|
||||
public abstract fun getPerfStats ()Lcom/facebook/react/bridge/queue/MessageQueueThreadPerfStats;
|
||||
public fun getPerfStats ()Lcom/facebook/react/bridge/queue/MessageQueueThreadPerfStats;
|
||||
public abstract fun isIdle ()Z
|
||||
public abstract fun isOnThread ()Z
|
||||
public abstract fun quitSynchronous ()V
|
||||
public abstract fun resetPerfStats ()V
|
||||
public fun resetPerfStats ()V
|
||||
public abstract fun runOnQueue (Ljava/lang/Runnable;)Z
|
||||
}
|
||||
|
||||
public final class com/facebook/react/bridge/queue/MessageQueueThreadImpl : com/facebook/react/bridge/queue/MessageQueueThread {
|
||||
public static final field Companion Lcom/facebook/react/bridge/queue/MessageQueueThreadImpl$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Landroid/os/Looper;Lcom/facebook/react/bridge/queue/QueueThreadExceptionHandler;Lcom/facebook/react/bridge/queue/MessageQueueThreadPerfStats;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Landroid/os/Looper;Lcom/facebook/react/bridge/queue/QueueThreadExceptionHandler;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun assertIsOnThread ()V
|
||||
public fun assertIsOnThread (Ljava/lang/String;)V
|
||||
public fun callOnQueue (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future;
|
||||
public static final fun create (Lcom/facebook/react/bridge/queue/MessageQueueThreadSpec;Lcom/facebook/react/bridge/queue/QueueThreadExceptionHandler;)Lcom/facebook/react/bridge/queue/MessageQueueThreadImpl;
|
||||
public final fun getLooper ()Landroid/os/Looper;
|
||||
public final fun getName ()Ljava/lang/String;
|
||||
public fun getPerfStats ()Lcom/facebook/react/bridge/queue/MessageQueueThreadPerfStats;
|
||||
public fun isIdle ()Z
|
||||
public fun isOnThread ()Z
|
||||
public fun quitSynchronous ()V
|
||||
public fun resetPerfStats ()V
|
||||
public fun runOnQueue (Ljava/lang/Runnable;)Z
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import javax.inject.Provider
|
||||
/** Abstract class that supports lazy loading of NativeModules by default. */
|
||||
public abstract class BaseReactPackage : ReactPackage {
|
||||
|
||||
@Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
||||
throw UnsupportedOperationException(
|
||||
"createNativeModules method is not supported. Use getModule() method instead.")
|
||||
|
||||
+1
@@ -112,6 +112,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
|
||||
* simply have a different mechanism for storing a `ReactNativeHost`, e.g. as a static field
|
||||
* somewhere.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
protected val reactNativeHost: ReactNativeHost
|
||||
get() = (application as ReactApplication).reactNativeHost
|
||||
|
||||
|
||||
+2
@@ -92,6 +92,8 @@ public abstract class LazyReactPackage : ReactPackage {
|
||||
* @param reactContext react application context that can be used to create modules
|
||||
* @return A [List]<[NativeModule]> to register
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
||||
buildList {
|
||||
for (holder in getNativeModules(reactContext)) {
|
||||
|
||||
+36
-27
@@ -18,20 +18,22 @@ import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.interfaces.fabric.ReactSurface;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Delegate class for {@link ReactActivity}. You can subclass this to provide custom implementations
|
||||
* for e.g. {@link #getReactNativeHost()}, if your Application class doesn't implement {@link
|
||||
* ReactApplication}.
|
||||
*/
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class ReactActivityDelegate {
|
||||
|
||||
private final @Nullable Activity mActivity;
|
||||
@@ -86,8 +88,11 @@ public class ReactActivityDelegate {
|
||||
* ReactApplication#getReactNativeHost()}. Override this method if your application class does not
|
||||
* implement {@code ReactApplication} or you simply have a different mechanism for storing a
|
||||
* {@code ReactNativeHost}, e.g. as a static field somewhere.
|
||||
*
|
||||
* @deprecated "Do not access {@link ReactNativeHost} directly. This class is going away in the
|
||||
* New Architecture. You should access {@link ReactHost} instead."
|
||||
*/
|
||||
@DeprecatedInNewArchitecture(message = "Use getReactHost()")
|
||||
@Deprecated
|
||||
protected ReactNativeHost getReactNativeHost() {
|
||||
return ((ReactApplication) getPlainActivity().getApplication()).getReactNativeHost();
|
||||
}
|
||||
@@ -107,16 +112,21 @@ public class ReactActivityDelegate {
|
||||
return mReactDelegate;
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(message = "Use getReactHost()")
|
||||
/**
|
||||
* @deprecated @deprecated "Do not access {@link ReactInstanceManager} directly. This class is
|
||||
* going away in the New Architecture. You should access {@link ReactHost} instead."
|
||||
* @noinspection deprecation
|
||||
*/
|
||||
public ReactInstanceManager getReactInstanceManager() {
|
||||
return mReactDelegate.getReactInstanceManager();
|
||||
return Objects.requireNonNull(mReactDelegate).getReactInstanceManager();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMainComponentName() {
|
||||
return mMainComponentName;
|
||||
}
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
Systrace.traceSection(
|
||||
Systrace.TRACE_TAG_REACT,
|
||||
"ReactActivityDelegate.onCreate::init",
|
||||
@@ -147,6 +157,7 @@ public class ReactActivityDelegate {
|
||||
launchOptions,
|
||||
isFabricEnabled()) {
|
||||
@Override
|
||||
@Nullable
|
||||
protected ReactRootView createRootView() {
|
||||
ReactRootView rootView = ReactActivityDelegate.this.createRootView();
|
||||
if (rootView == null) {
|
||||
@@ -162,31 +173,29 @@ public class ReactActivityDelegate {
|
||||
});
|
||||
}
|
||||
|
||||
protected void loadApp(String appKey) {
|
||||
mReactDelegate.loadApp(appKey);
|
||||
protected void loadApp(@Nullable String appKey) {
|
||||
Objects.requireNonNull(mReactDelegate).loadApp(Objects.requireNonNull(appKey));
|
||||
getPlainActivity().setContentView(mReactDelegate.getReactRootView());
|
||||
}
|
||||
|
||||
public void setReactSurface(ReactSurface reactSurface) {
|
||||
mReactDelegate.setReactSurface(reactSurface);
|
||||
Objects.requireNonNull(mReactDelegate).setReactSurface(reactSurface);
|
||||
}
|
||||
|
||||
public void setReactRootView(ReactRootView reactRootView) {
|
||||
mReactDelegate.setReactRootView(reactRootView);
|
||||
Objects.requireNonNull(mReactDelegate).setReactRootView(reactRootView);
|
||||
}
|
||||
|
||||
public void onUserLeaveHint() {
|
||||
if (mReactDelegate != null) {
|
||||
mReactDelegate.onUserLeaveHint();
|
||||
}
|
||||
Objects.requireNonNull(mReactDelegate).onUserLeaveHint();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
mReactDelegate.onHostPause();
|
||||
Objects.requireNonNull(mReactDelegate).onHostPause();
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
mReactDelegate.onHostResume();
|
||||
Objects.requireNonNull(mReactDelegate).onHostResume();
|
||||
|
||||
if (mPermissionsCallback != null) {
|
||||
mPermissionsCallback.invoke();
|
||||
@@ -195,43 +204,43 @@ public class ReactActivityDelegate {
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
mReactDelegate.onHostDestroy();
|
||||
Objects.requireNonNull(mReactDelegate).onHostDestroy();
|
||||
}
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
mReactDelegate.onActivityResult(requestCode, resultCode, data, true);
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
Objects.requireNonNull(mReactDelegate).onActivityResult(requestCode, resultCode, data, true);
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return mReactDelegate.onKeyDown(keyCode, event);
|
||||
return Objects.requireNonNull(mReactDelegate).onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return mReactDelegate.shouldShowDevMenuOrReload(keyCode, event);
|
||||
return Objects.requireNonNull(mReactDelegate).shouldShowDevMenuOrReload(keyCode, event);
|
||||
}
|
||||
|
||||
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
||||
return mReactDelegate.onKeyLongPress(keyCode);
|
||||
return Objects.requireNonNull(mReactDelegate).onKeyLongPress(keyCode);
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
return mReactDelegate.onBackPressed();
|
||||
return Objects.requireNonNull(mReactDelegate).onBackPressed();
|
||||
}
|
||||
|
||||
public boolean onNewIntent(Intent intent) {
|
||||
return mReactDelegate.onNewIntent(intent);
|
||||
public boolean onNewIntent(@Nullable Intent intent) {
|
||||
return Objects.requireNonNull(mReactDelegate).onNewIntent(Objects.requireNonNull(intent));
|
||||
}
|
||||
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
mReactDelegate.onWindowFocusChanged(hasFocus);
|
||||
Objects.requireNonNull(mReactDelegate).onWindowFocusChanged(hasFocus);
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
mReactDelegate.onConfigurationChanged(newConfig);
|
||||
Objects.requireNonNull(mReactDelegate).onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
public void requestPermissions(
|
||||
String[] permissions, int requestCode, PermissionListener listener) {
|
||||
String[] permissions, int requestCode, @Nullable PermissionListener listener) {
|
||||
mPermissionListener = listener;
|
||||
getPlainActivity().requestPermissions(permissions, requestCode);
|
||||
}
|
||||
@@ -267,7 +276,7 @@ public class ReactActivityDelegate {
|
||||
* context will no longer be valid.
|
||||
*/
|
||||
public @Nullable ReactContext getCurrentReactContext() {
|
||||
return mReactDelegate.getCurrentReactContext();
|
||||
return Objects.requireNonNull(mReactDelegate).getCurrentReactContext();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
@@ -10,6 +10,10 @@ package com.facebook.react
|
||||
/** Interface that represents an instance of a React Native application */
|
||||
public interface ReactApplication {
|
||||
/** Get the default [ReactNativeHost] for this app. */
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
|
||||
ReplaceWith("reactHost"))
|
||||
public val reactNativeHost: ReactNativeHost
|
||||
|
||||
/**
|
||||
|
||||
+7
-2
@@ -14,7 +14,6 @@ import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
||||
import com.facebook.react.devsupport.DoubleTapReloadRecognizer
|
||||
import com.facebook.react.devsupport.ReleaseDevSupportManager
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
@@ -26,12 +25,17 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
||||
* A delegate for handling React Application support. This delegate is unaware whether it is used in
|
||||
* an [Activity] or a [android.app.Fragment].
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
public open class ReactDelegate {
|
||||
private val activity: Activity
|
||||
private var internalReactRootView: ReactRootView? = null
|
||||
private val mainComponentName: String?
|
||||
private var launchOptions: Bundle?
|
||||
private var doubleTapReloadRecognizer: DoubleTapReloadRecognizer?
|
||||
|
||||
@Deprecated(
|
||||
"You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
|
||||
ReplaceWith("reactHost"))
|
||||
private var reactNativeHost: ReactNativeHost? = null
|
||||
public var reactHost: ReactHost? = null
|
||||
private set
|
||||
@@ -380,7 +384,8 @@ public open class ReactDelegate {
|
||||
return false
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(message = "Use reactHost")
|
||||
@Deprecated(
|
||||
"Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead.")
|
||||
public fun getReactInstanceManager(): ReactInstanceManager {
|
||||
val nonNullReactNativeHost =
|
||||
checkNotNull(reactNativeHost) {
|
||||
|
||||
@@ -58,6 +58,10 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
|
||||
* method if your application class does not implement `ReactApplication` or you simply have a
|
||||
* different mechanism for storing a `ReactNativeHost`, e.g. as a static field somewhere.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated(
|
||||
"You should not use ReactNativeHost directly in the New Architecture. Use ReactHost instead.",
|
||||
ReplaceWith("reactHost"))
|
||||
protected open val reactNativeHost: ReactNativeHost?
|
||||
get() = (activity?.application as ReactApplication?)?.reactNativeHost
|
||||
|
||||
|
||||
+5
-5
@@ -10,6 +10,7 @@ package com.facebook.react;
|
||||
import android.app.Application;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.JSExceptionHandler;
|
||||
import com.facebook.react.bridge.JavaScriptExecutorFactory;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
@@ -18,7 +19,6 @@ import com.facebook.react.bridge.UIManagerProvider;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.common.SurfaceDelegate;
|
||||
import com.facebook.react.common.SurfaceDelegateFactory;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
@@ -32,12 +32,12 @@ import java.util.List;
|
||||
/**
|
||||
* Simple class that holds an instance of {@link ReactInstanceManager}. This can be used in your
|
||||
* {@link Application class} (see {@link ReactApplication}), or as a static field.
|
||||
*
|
||||
* @deprecated This class will be replaced by com.facebook.react.ReactHost in the New Architecture.
|
||||
*/
|
||||
@DeprecatedInNewArchitecture(
|
||||
message =
|
||||
"This class will be replaced by com.facebook.react.ReactHost in the new architecture of"
|
||||
+ " React Native.")
|
||||
@Deprecated
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public abstract class ReactNativeHost {
|
||||
|
||||
static {
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.facebook.react
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.UIManager
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
||||
import com.facebook.react.common.annotations.StableReactNativeAPI
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
|
||||
@@ -34,8 +33,9 @@ public interface ReactPackage {
|
||||
* @return list of native modules to register with the newly created catalyst instance This method
|
||||
* is deprecated in the new Architecture of React Native.
|
||||
*/
|
||||
@DeprecatedInNewArchitecture(message = "Migrate to BaseReactPackage and implement getModule")
|
||||
public fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule>
|
||||
@Deprecated(message = "Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
public fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
||||
emptyList()
|
||||
|
||||
/** @return a list of view managers that should be registered with [UIManager] */
|
||||
public fun createViewManagers(
|
||||
|
||||
+1
@@ -28,6 +28,7 @@ internal object ReactPackageHelper {
|
||||
FLog.d(
|
||||
ReactConstants.TAG,
|
||||
"${reactPackage.javaClass.simpleName} is not a LazyReactPackage, falling back to old version.")
|
||||
@Suppress("DEPRECATION")
|
||||
val nativeModules = reactPackage.createNativeModules(reactApplicationContext)
|
||||
return Iterable {
|
||||
object : Iterator<ModuleHolder> {
|
||||
|
||||
+2
@@ -83,6 +83,7 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
|
||||
|
||||
if (shouldSupportLegacyPackages()) {
|
||||
// TODO(T145105887): Output warnings that ReactPackage was used
|
||||
@Suppress("DEPRECATION")
|
||||
val nativeModules = reactPackage.createNativeModules(reactApplicationContext)
|
||||
|
||||
val moduleMap: MutableMap<String, NativeModule> = mutableMapOf()
|
||||
@@ -94,6 +95,7 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
|
||||
|
||||
val moduleName = reactModule?.name ?: module.name
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
val moduleInfo: ReactModuleInfo =
|
||||
if (reactModule != null)
|
||||
ReactModuleInfo(
|
||||
|
||||
-2
@@ -16,7 +16,6 @@ import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.common.annotations.StableReactNativeAPI;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import java.util.Map;
|
||||
@@ -72,7 +71,6 @@ public abstract class BaseJavaModule implements NativeModule {
|
||||
/**
|
||||
* @return a map of constants this module exports to JS. Supports JSON types.
|
||||
*/
|
||||
@DeprecatedInNewArchitecture()
|
||||
public @Nullable Map<String, Object> getConstants() {
|
||||
return null;
|
||||
}
|
||||
|
||||
+18
-9
@@ -14,11 +14,11 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.queue.ReactQueueConfiguration;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.common.annotations.FrameworkAPI;
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
@@ -27,16 +27,21 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This is the bridge-specific concrete subclass of ReactContext. ReactContext has many methods that
|
||||
* delegate to the react instance. This subclass implements those methods, by delegating to the
|
||||
* CatalystInstance. If you need to create a ReactContext within an "bridge context", please create
|
||||
* BridgeReactContext.
|
||||
*
|
||||
* @deprecated This class is deprecated in the New Architecture and will be replaced by {@link
|
||||
* com.facebook.react.runtime.BridgelessReactContext}
|
||||
*/
|
||||
@DeprecatedInNewArchitecture
|
||||
@VisibleForTesting
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Deprecated
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class BridgeReactContext extends ReactApplicationContext {
|
||||
static {
|
||||
LegacyArchitectureLogger.assertLegacyArchitecture(
|
||||
@@ -119,6 +124,7 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
if (mCatalystInstance == null) {
|
||||
raiseCatalystInstanceMissingException();
|
||||
}
|
||||
Assertions.assertNotNull(mCatalystInstance);
|
||||
return mCatalystInstance.hasNativeModule(nativeModuleInterface);
|
||||
}
|
||||
|
||||
@@ -127,6 +133,7 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
if (mCatalystInstance == null) {
|
||||
raiseCatalystInstanceMissingException();
|
||||
}
|
||||
Assertions.assertNotNull(mCatalystInstance);
|
||||
return mCatalystInstance.getNativeModules();
|
||||
}
|
||||
|
||||
@@ -139,6 +146,7 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
if (mCatalystInstance == null) {
|
||||
raiseCatalystInstanceMissingException();
|
||||
}
|
||||
Assertions.assertNotNull(mCatalystInstance);
|
||||
return mCatalystInstance.getNativeModule(nativeModuleInterface);
|
||||
}
|
||||
|
||||
@@ -147,6 +155,7 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
if (mCatalystInstance == null) {
|
||||
raiseCatalystInstanceMissingException();
|
||||
}
|
||||
Assertions.assertNotNull(mCatalystInstance);
|
||||
return mCatalystInstance.getNativeModule(moduleName);
|
||||
}
|
||||
|
||||
@@ -210,8 +219,7 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
@Override
|
||||
public void handleException(Exception e) {
|
||||
boolean catalystInstanceVariableExists = mCatalystInstance != null;
|
||||
boolean isCatalystInstanceAlive =
|
||||
catalystInstanceVariableExists && !mCatalystInstance.isDestroyed();
|
||||
boolean isCatalystInstanceAlive = mCatalystInstance != null && !mCatalystInstance.isDestroyed();
|
||||
boolean hasExceptionHandler = getJSExceptionHandler() != null;
|
||||
|
||||
if (isCatalystInstanceAlive && hasExceptionHandler) {
|
||||
@@ -268,18 +276,19 @@ public class BridgeReactContext extends ReactApplicationContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture(
|
||||
message =
|
||||
"This method will be deprecated later as part of Stable APIs with bridge removal and not"
|
||||
+ " encouraged usage.")
|
||||
/**
|
||||
* Get the UIManager for Fabric from the CatalystInstance.
|
||||
*
|
||||
* @return The UIManager when CatalystInstance is active.
|
||||
* @deprecated Do not use this method. Instead use {@link
|
||||
* com.facebook.react.uimanager.UIManagerHelper} method {@code getUIManager} to get the
|
||||
* UIManager instance from the current ReactContext.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public @Nullable UIManager getFabricUIManager() {
|
||||
return mCatalystInstance.getFabricUIManager();
|
||||
//noinspection deprecation
|
||||
return Objects.requireNonNull(mCatalystInstance).getFabricUIManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ protected constructor(
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
"The method canOverrideExistingModule is not used in the New Architecture and will be removed in a future release.")
|
||||
override fun canOverrideExistingModule(): Boolean = false
|
||||
|
||||
override fun invalidate() {
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class ModuleHolder {
|
||||
|
||||
public constructor(nativeModule: NativeModule) {
|
||||
name = nativeModule.name
|
||||
@Suppress("DEPRECATION")
|
||||
reactModuleInfo =
|
||||
ReactModuleInfo(
|
||||
nativeModule.name,
|
||||
|
||||
+4
-2
@@ -9,7 +9,6 @@ package com.facebook.react.bridge;
|
||||
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
|
||||
import com.facebook.react.common.annotations.StableReactNativeAPI;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -50,8 +49,11 @@ public interface NativeModule {
|
||||
* of a different package (such as the core one). Trying to override without returning true from
|
||||
* this method is considered an error and will throw an exception during initialization. By
|
||||
* default all modules return false.
|
||||
*
|
||||
* @deprecated The method canOverrideExistingModule is not used in the New Architecture and will
|
||||
* be removed in a future release.
|
||||
*/
|
||||
@DeprecatedInNewArchitecture()
|
||||
@Deprecated
|
||||
default boolean canOverrideExistingModule() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-8
@@ -108,14 +108,8 @@ public abstract class ReactContext extends ContextWrapper {
|
||||
mInteropModuleRegistry = new InteropModuleRegistry();
|
||||
}
|
||||
|
||||
public void resetPerfStats() {
|
||||
if (mNativeModulesMessageQueueThread != null) {
|
||||
mNativeModulesMessageQueueThread.resetPerfStats();
|
||||
}
|
||||
if (mJSMessageQueueThread != null) {
|
||||
mJSMessageQueueThread.resetPerfStats();
|
||||
}
|
||||
}
|
||||
@Deprecated(since = "MessageQueueThread perf stats are no longer collected")
|
||||
public void resetPerfStats() {}
|
||||
|
||||
public void setJSExceptionHandler(@Nullable JSExceptionHandler jSExceptionHandler) {
|
||||
mJSExceptionHandler = jSExceptionHandler;
|
||||
|
||||
+5
-2
@@ -55,13 +55,16 @@ public interface MessageQueueThread {
|
||||
* Returns the perf counters taken when the framework was started. This method is intended to be
|
||||
* used for instrumentation purposes.
|
||||
*/
|
||||
public fun getPerfStats(): MessageQueueThreadPerfStats?
|
||||
@Deprecated("MessageQueueThread perf stats are no longer collected")
|
||||
@Suppress("DEPRECATION")
|
||||
public fun getPerfStats(): MessageQueueThreadPerfStats? = null
|
||||
|
||||
/**
|
||||
* Resets the perf counters. This is useful if the RN threads are being re-used. This method is
|
||||
* intended to be used for instrumentation purposes.
|
||||
*/
|
||||
public fun resetPerfStats()
|
||||
@Deprecated("MessageQueueThread perf stats are no longer collected")
|
||||
public fun resetPerfStats(): Unit = Unit
|
||||
|
||||
/**
|
||||
* Resets the perf counters. This is useful if the RN threads are being re-used. This method is
|
||||
|
||||
+5
-30
@@ -9,8 +9,6 @@ package com.facebook.react.bridge.queue
|
||||
|
||||
import android.os.Looper
|
||||
import android.os.Process
|
||||
import android.os.SystemClock
|
||||
import android.util.Pair
|
||||
import com.facebook.common.logging.FLog
|
||||
import com.facebook.proguard.annotations.DoNotStripAny
|
||||
import com.facebook.react.bridge.AssertionException
|
||||
@@ -29,7 +27,6 @@ private constructor(
|
||||
public val name: String,
|
||||
public val looper: Looper,
|
||||
exceptionHandler: QueueThreadExceptionHandler,
|
||||
private val stats: MessageQueueThreadPerfStats? = null
|
||||
) : MessageQueueThread {
|
||||
private val handler = MessageQueueThreadHandler(looper, exceptionHandler)
|
||||
private val assertionErrorMessage = "Expected to be called from the '$name' thread!"
|
||||
@@ -105,27 +102,9 @@ private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPerfStats(): MessageQueueThreadPerfStats? = stats
|
||||
|
||||
override fun resetPerfStats() {
|
||||
assignToPerfStats(stats, -1, -1)
|
||||
runOnQueue {
|
||||
val wallTime = SystemClock.uptimeMillis()
|
||||
val cpuTime = SystemClock.currentThreadTimeMillis()
|
||||
assignToPerfStats(stats, wallTime, cpuTime)
|
||||
}
|
||||
}
|
||||
|
||||
public override fun isIdle(): Boolean = looper.queue.isIdle
|
||||
|
||||
public companion object {
|
||||
private fun assignToPerfStats(stats: MessageQueueThreadPerfStats?, wall: Long, cpu: Long) {
|
||||
stats?.let { s ->
|
||||
s.wallTime = wall
|
||||
s.cpuTime = cpu
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Throws(RuntimeException::class)
|
||||
public fun create(
|
||||
@@ -160,27 +139,23 @@ private constructor(
|
||||
stackSize: Long,
|
||||
exceptionHandler: QueueThreadExceptionHandler
|
||||
): MessageQueueThreadImpl {
|
||||
val dataFuture = SimpleSettableFuture<Pair<Looper?, MessageQueueThreadPerfStats>>()
|
||||
val looperFuture = SimpleSettableFuture<Looper?>()
|
||||
val bgThread =
|
||||
Thread(
|
||||
null,
|
||||
{
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY)
|
||||
Looper.prepare()
|
||||
val stats = MessageQueueThreadPerfStats()
|
||||
val wallTime = SystemClock.uptimeMillis()
|
||||
val cpuTime = SystemClock.currentThreadTimeMillis()
|
||||
assignToPerfStats(stats, wallTime, cpuTime)
|
||||
dataFuture.set(Pair(Looper.myLooper(), stats))
|
||||
looperFuture.set(Looper.myLooper())
|
||||
Looper.loop()
|
||||
},
|
||||
"mqt_$name",
|
||||
stackSize)
|
||||
bgThread.start()
|
||||
|
||||
val pair = dataFuture.getOrThrow()
|
||||
val looper = pair?.first ?: throw RuntimeException("Looper not found for thread")
|
||||
return MessageQueueThreadImpl(name, looper, exceptionHandler, pair.second)
|
||||
val looper =
|
||||
looperFuture.getOrThrow() ?: throw RuntimeException("Looper not found for thread")
|
||||
return MessageQueueThreadImpl(name, looper, exceptionHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.bridge.queue
|
||||
|
||||
/** This class holds perf counters' values at the beginning of an RN startup. */
|
||||
@Deprecated("MessageQueueThread perf stats are no longer collected")
|
||||
public class MessageQueueThreadPerfStats {
|
||||
@JvmField public var wallTime: Long = 0
|
||||
@JvmField public var cpuTime: Long = 0
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ private constructor(
|
||||
public const val DEFAULT_STACK_SIZE_BYTES: Long = 0
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("Use newBackgroundThreadSpec")
|
||||
public fun newUIBackgroundTreadSpec(name: String): MessageQueueThreadSpec =
|
||||
MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name)
|
||||
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* 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.annotations
|
||||
|
||||
/**
|
||||
* Annotates a method or class that will be deprecated once the NewArchitecture is fully released in
|
||||
* OSS.
|
||||
*/
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
internal annotation class DeprecatedInNewArchitecture(val message: String = "")
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.defaults
|
||||
|
||||
import android.content.Context
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.defaults
|
||||
|
||||
import android.app.Application
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class BlobProvider : ContentProvider() {
|
||||
var blobModule: BlobModule? = null
|
||||
val context = context?.applicationContext
|
||||
if (context is ReactApplication) {
|
||||
val host = (context as ReactApplication).reactNativeHost
|
||||
@Suppress("DEPRECATION") val host = (context as ReactApplication).reactNativeHost
|
||||
val reactContext =
|
||||
host.reactInstanceManager.currentReactContext
|
||||
?: throw RuntimeException("No ReactContext associated with BlobProvider")
|
||||
|
||||
+8
-11
@@ -829,13 +829,6 @@ public class ReactHostImpl(
|
||||
null
|
||||
},
|
||||
executor)
|
||||
.continueWith({ task: Task<Void> ->
|
||||
// TODO: validate whether errors during startup go through here?
|
||||
if (task.isFaulted()) {
|
||||
handleHostException(checkNotNull(task.getError()))
|
||||
}
|
||||
null
|
||||
})
|
||||
|
||||
private fun getOrCreateReactContext(): BridgelessReactContext {
|
||||
val method = "getOrCreateReactContext()"
|
||||
@@ -952,9 +945,14 @@ public class ReactHostImpl(
|
||||
},
|
||||
bgExecutor)
|
||||
|
||||
val lifecycleUpdateTask = { task: Task<CreationResult> ->
|
||||
val lifecycleUpdateTask = task@{ task: Task<CreationResult> ->
|
||||
if (task.isFaulted()) {
|
||||
// handleHostException may throw, so move it outside of the task scheduler
|
||||
uiExecutor.execute { handleHostException(checkNotNull(task.getError())) }
|
||||
return@task
|
||||
}
|
||||
|
||||
val result = checkNotNull(task.getResult())
|
||||
val reactInstance = result.instance
|
||||
val reactContext = result.context
|
||||
val isReloading = result.isReloading
|
||||
val isManagerResumed = reactLifecycleStateManager.lifecycleState == LifecycleState.RESUMED
|
||||
@@ -991,10 +989,9 @@ public class ReactHostImpl(
|
||||
for (listener in reactInstanceEventListeners) {
|
||||
listener.onReactContextInitialized(reactContext)
|
||||
}
|
||||
reactInstance
|
||||
}
|
||||
|
||||
creationTask.onSuccess(lifecycleUpdateTask, uiExecutor)
|
||||
creationTask.continueWith(lifecycleUpdateTask, uiExecutor)
|
||||
creationTask.onSuccess({ task -> checkNotNull(task.getResult()).instance })
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ package com.facebook.react.uimanager
|
||||
import android.view.View
|
||||
import com.facebook.common.logging.FLog
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
||||
import com.facebook.react.uimanager.ViewManagersPropertyCache.PropSetter
|
||||
import java.util.HashMap
|
||||
|
||||
@@ -70,8 +69,8 @@ public object ViewManagerPropertyUpdater {
|
||||
}
|
||||
}
|
||||
|
||||
@DeprecatedInNewArchitecture
|
||||
@JvmStatic
|
||||
@Deprecated("Use ViewManager#updateProperties to update a view's properties")
|
||||
public fun <T : ReactShadowNode<T>> updateProps(node: T, props: ReactStylesDiffMap) {
|
||||
val setter = findNodeSetter(node.javaClass)
|
||||
val iterator = props.backingMap.entryIterator
|
||||
|
||||
-2
@@ -8,12 +8,10 @@
|
||||
package com.facebook.react.uimanager.common
|
||||
|
||||
import androidx.annotation.IntDef
|
||||
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
||||
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Suppress("DEPRECATION")
|
||||
@IntDef(UIManagerType.DEFAULT, UIManagerType.LEGACY, UIManagerType.FABRIC)
|
||||
@DeprecatedInNewArchitecture
|
||||
public annotation class UIManagerType {
|
||||
public companion object {
|
||||
@Deprecated(
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual
|
||||
|
||||
internal enum class VirtualViewMode(val value: Int) {
|
||||
Visible(0),
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual
|
||||
|
||||
import android.graphics.Rect
|
||||
import androidx.annotation.VisibleForTesting
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual
|
||||
|
||||
/**
|
||||
* Represents the the render state of children in the most recent commit.
|
||||
+3
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
@@ -24,6 +24,8 @@ import com.facebook.react.views.scroll.ReactScrollView
|
||||
import com.facebook.react.views.scroll.ReactScrollViewHelper
|
||||
import com.facebook.react.views.scroll.ScrollEventType
|
||||
import com.facebook.react.views.view.ReactViewGroup
|
||||
import com.facebook.react.views.virtual.VirtualViewMode
|
||||
import com.facebook.react.views.virtual.VirtualViewRenderState
|
||||
import com.facebook.systrace.Systrace
|
||||
|
||||
internal class ReactVirtualView(context: Context) :
|
||||
+4
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual.view
|
||||
|
||||
import android.graphics.Rect
|
||||
import androidx.annotation.VisibleForTesting
|
||||
@@ -19,6 +19,9 @@ import com.facebook.react.uimanager.annotations.ReactProp
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.viewmanagers.VirtualViewManagerDelegate
|
||||
import com.facebook.react.viewmanagers.VirtualViewManagerInterface
|
||||
import com.facebook.react.views.virtual.VirtualViewMode
|
||||
import com.facebook.react.views.virtual.VirtualViewModeChangeEvent
|
||||
import com.facebook.react.views.virtual.VirtualViewRenderState
|
||||
|
||||
@ReactModule(name = ReactVirtualViewManager.REACT_CLASS)
|
||||
internal class ReactVirtualViewManager :
|
||||
+3
-22
@@ -18,11 +18,9 @@ import android.view.WindowManager
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
import com.facebook.react.bridge.CatalystInstance
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactTestHelper
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.common.SystemClock
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
@@ -30,14 +28,12 @@ import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter
|
||||
import com.facebook.react.uimanager.events.TouchEvent
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import java.util.Date
|
||||
import org.assertj.core.api.Assertions.*
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.mockito.kotlin.KArgumentCaptor
|
||||
import org.mockito.kotlin.any
|
||||
import org.mockito.kotlin.argumentCaptor
|
||||
@@ -52,16 +48,15 @@ import org.mockito.kotlin.whenever
|
||||
import org.robolectric.Robolectric
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class RootViewTest {
|
||||
|
||||
private lateinit var reactContext: BridgeReactContext
|
||||
private lateinit var catalystInstanceMock: CatalystInstance
|
||||
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private lateinit var systemClock: MockedStatic<SystemClock>
|
||||
|
||||
private lateinit var downEventCaptor: KArgumentCaptor<TouchEvent>
|
||||
private lateinit var downActionTouchesArgCaptor: KArgumentCaptor<WritableArray>
|
||||
|
||||
@@ -72,14 +67,6 @@ class RootViewTest {
|
||||
fun setUp() {
|
||||
ReactNativeFeatureFlagsForTests.setUp()
|
||||
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
|
||||
val ts = SystemClock.uptimeMillis()
|
||||
systemClock = mockStatic(SystemClock::class.java)
|
||||
systemClock.`when`<Long> { SystemClock.uptimeMillis() }.thenReturn(ts)
|
||||
|
||||
catalystInstanceMock = ReactTestHelper.createMockCatalystInstance()
|
||||
reactContext = spy(BridgeReactContext(RuntimeEnvironment.getApplication()))
|
||||
reactContext.initializeWithInstance(catalystInstanceMock)
|
||||
@@ -96,12 +83,6 @@ class RootViewTest {
|
||||
upActionTouchesArgCaptor = argumentCaptor()
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
systemClock.close()
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testTouchEmitter() {
|
||||
val instanceManager: ReactInstanceManager = mock()
|
||||
|
||||
+3
-16
@@ -10,23 +10,20 @@
|
||||
package com.facebook.react.animated
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.Callback
|
||||
import com.facebook.react.bridge.CatalystInstance
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.events.Event
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import kotlin.collections.Map
|
||||
import kotlin.math.abs
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -34,8 +31,6 @@ import org.mockito.ArgumentCaptor
|
||||
import org.mockito.ArgumentMatchers.any
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.mockito.ArgumentMatchers.eq
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.mockito.kotlin.atMost
|
||||
import org.mockito.kotlin.mock
|
||||
import org.mockito.kotlin.reset
|
||||
@@ -44,8 +39,10 @@ import org.mockito.kotlin.verify
|
||||
import org.mockito.kotlin.verifyNoMoreInteractions
|
||||
import org.mockito.kotlin.whenever
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
/** Tests the animated nodes graph traversal algorithm from {@link NativeAnimatedNodesManager}. */
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class NativeAnimatedNodeTraversalTest {
|
||||
|
||||
@@ -55,7 +52,6 @@ class NativeAnimatedNodeTraversalTest {
|
||||
private lateinit var uiManagerMock: UIManagerModule
|
||||
private lateinit var eventDispatcherMock: EventDispatcher
|
||||
private lateinit var nativeAnimatedNodesManager: NativeAnimatedNodesManager
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
|
||||
private fun nextFrameTime(): Long {
|
||||
frameTimeNanos += FRAME_LEN_NANOS
|
||||
@@ -64,10 +60,6 @@ class NativeAnimatedNodeTraversalTest {
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
|
||||
frameTimeNanos = INITIAL_FRAME_TIME_NANOS
|
||||
|
||||
reactApplicationContextMock = mock<ReactApplicationContext>()
|
||||
@@ -113,11 +105,6 @@ class NativeAnimatedNodeTraversalTest {
|
||||
nativeAnimatedNodesManager = NativeAnimatedNodesManager(reactApplicationContextMock)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a simple animated nodes graph and attaches the props node to a given {@param viewTag}
|
||||
* Parameter {@param opacity} is used as a initial value for the "opacity" attribute.
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.fabric
|
||||
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.fabric
|
||||
|
||||
import com.facebook.react.ReactRootView
|
||||
|
||||
+2
-10
@@ -11,12 +11,10 @@ import android.util.DisplayMetrics
|
||||
import android.view.MotionEvent
|
||||
import android.view.MotionEvent.PointerCoords
|
||||
import android.view.MotionEvent.PointerProperties
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactTestHelper
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests
|
||||
import com.facebook.react.modules.core.ReactChoreographer
|
||||
@@ -26,6 +24,7 @@ import com.facebook.react.uimanager.events.FabricEventDispatcher
|
||||
import com.facebook.react.uimanager.events.TouchEvent
|
||||
import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper
|
||||
import com.facebook.react.uimanager.events.TouchEventType
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import com.facebook.testutils.shadows.ShadowSoLoader
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
@@ -34,8 +33,6 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentCaptor
|
||||
import org.mockito.ArgumentMatchers.*
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.mockito.kotlin.mock
|
||||
import org.mockito.kotlin.times
|
||||
import org.mockito.kotlin.verify
|
||||
@@ -43,7 +40,7 @@ import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(shadows = [ShadowSoLoader::class])
|
||||
@Config(shadows = [ShadowSoLoader::class, ShadowArguments::class])
|
||||
class TouchEventDispatchTest {
|
||||
private val touchEventCoalescingKeyHelper = TouchEventCoalescingKeyHelper()
|
||||
|
||||
@@ -460,16 +457,12 @@ class TouchEventDispatchTest {
|
||||
|
||||
private lateinit var eventDispatcher: EventDispatcher
|
||||
private lateinit var eventEmitter: FabricEventEmitter
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private var reactChoreographerOriginal: ReactChoreographer? = null
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
ReactNativeFeatureFlagsForTests.setUp()
|
||||
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
val metrics = DisplayMetrics()
|
||||
metrics.xdpi = 1f
|
||||
metrics.ydpi = 1f
|
||||
@@ -488,7 +481,6 @@ class TouchEventDispatchTest {
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
ReactChoreographer.overrideInstanceForTest(reactChoreographerOriginal)
|
||||
}
|
||||
|
||||
|
||||
+6
-16
@@ -9,49 +9,39 @@ package com.facebook.react.modules.appstate
|
||||
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.Callback
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentCaptor
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.mockito.kotlin.any
|
||||
import org.mockito.kotlin.mock
|
||||
import org.mockito.kotlin.never
|
||||
import org.mockito.kotlin.times
|
||||
import org.mockito.kotlin.verify
|
||||
import org.mockito.kotlin.whenever
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class AppStateModuleTest {
|
||||
private lateinit var appStateModule: AppStateModule
|
||||
private lateinit var reactContext: ReactApplicationContext
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
reactContext = mock()
|
||||
appStateModule = AppStateModule(reactContext)
|
||||
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray>(Arguments::createArray).thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap>(Arguments::createMap).thenAnswer { JavaOnlyMap() }
|
||||
|
||||
// we check whether we have an active react instance before emitting an event,
|
||||
// therefore for the tests we need this returning `true`.
|
||||
whenever(reactContext.hasActiveReactInstance()).thenReturn(true)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetCurrentAppState() {
|
||||
val successCallbackMock: Callback = mock()
|
||||
|
||||
-9
@@ -8,11 +8,9 @@
|
||||
package com.facebook.react.modules.blob
|
||||
|
||||
import android.net.Uri
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactTestHelper
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import java.nio.ByteBuffer
|
||||
import java.util.UUID
|
||||
import kotlin.random.Random
|
||||
@@ -21,8 +19,6 @@ import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@@ -32,13 +28,9 @@ class BlobModuleTest {
|
||||
private lateinit var bytes: ByteArray
|
||||
private lateinit var blobId: String
|
||||
private lateinit var blobModule: BlobModule
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
|
||||
@Before
|
||||
fun prepareModules() {
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
|
||||
bytes = ByteArray(120)
|
||||
Random.Default.nextBytes(bytes)
|
||||
|
||||
@@ -49,7 +41,6 @@ class BlobModuleTest {
|
||||
@After
|
||||
fun cleanUp() {
|
||||
blobModule.remove(blobId)
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.modules.clipboard
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.modules.deviceinfo
|
||||
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
|
||||
+3
-8
@@ -10,13 +10,12 @@
|
||||
|
||||
package com.facebook.react.modules.network
|
||||
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.common.network.OkHttpCallUtil
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import java.io.InputStream
|
||||
import java.nio.charset.StandardCharsets
|
||||
import okhttp3.Call
|
||||
@@ -46,15 +45,16 @@ import org.mockito.kotlin.verify
|
||||
import org.mockito.kotlin.whenever
|
||||
import org.mockito.kotlin.withSettings
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
/** Tests [NetworkingModule] */
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class NetworkingModuleTest {
|
||||
|
||||
private lateinit var networkingModule: NetworkingModule
|
||||
private lateinit var httpClient: OkHttpClient
|
||||
private lateinit var context: ReactApplicationContext
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private lateinit var okHttpCallUtil: MockedStatic<OkHttpCallUtil>
|
||||
private lateinit var requestBodyUtil: MockedStatic<RequestBodyUtil>
|
||||
private lateinit var requestArgumentCaptor: KArgumentCaptor<Request>
|
||||
@@ -74,10 +74,6 @@ class NetworkingModuleTest {
|
||||
|
||||
networkingModule = NetworkingModule(context, "", httpClient, null)
|
||||
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
|
||||
okHttpCallUtil = mockStatic(OkHttpCallUtil::class.java)
|
||||
requestArgumentCaptor = argumentCaptor()
|
||||
}
|
||||
@@ -92,7 +88,6 @@ class NetworkingModuleTest {
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
okHttpCallUtil.close()
|
||||
}
|
||||
|
||||
|
||||
+6
-15
@@ -8,40 +8,31 @@
|
||||
package com.facebook.react.modules.network
|
||||
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import java.net.SocketTimeoutException
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentCaptor
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.mockito.kotlin.any
|
||||
import org.mockito.kotlin.mock
|
||||
import org.mockito.kotlin.never
|
||||
import org.mockito.kotlin.verify
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class ResponseUtilTest {
|
||||
private lateinit var reactContext: ReactApplicationContext
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
reactContext = mock()
|
||||
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray>(Arguments::createArray).thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap>(Arguments::createMap).thenAnswer { JavaOnlyMap() }
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+3
-7
@@ -14,12 +14,10 @@ package com.facebook.react.modules.timing
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.view.Choreographer.FrameCallback
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
import com.facebook.react.bridge.CatalystInstance
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.common.SystemClock
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
import com.facebook.react.jstasks.HeadlessJsTaskConfig
|
||||
@@ -29,6 +27,7 @@ import com.facebook.react.modules.core.JSTimers
|
||||
import com.facebook.react.modules.core.ReactChoreographer
|
||||
import com.facebook.react.modules.core.ReactChoreographer.CallbackType
|
||||
import com.facebook.react.modules.core.TimingModule
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
@@ -49,6 +48,7 @@ import org.mockito.kotlin.whenever
|
||||
import org.mockito.stubbing.Answer
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
object MockCompat {
|
||||
// Same as Mockito's 'eq()', but works for non-nullable types
|
||||
@@ -63,6 +63,7 @@ object MockCompat {
|
||||
@Suppress("UNCHECKED_CAST") fun <T> uninitialized(): T = null as T
|
||||
}
|
||||
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class TimingModuleTest {
|
||||
companion object {
|
||||
@@ -75,7 +76,6 @@ class TimingModuleTest {
|
||||
private lateinit var postFrameCallbackHandler: PostFrameCallbackHandler
|
||||
private lateinit var idlePostFrameCallbackHandler: PostFrameCallbackHandler
|
||||
private lateinit var jsTimersMock: JSTimers
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private lateinit var systemClock: MockedStatic<SystemClock>
|
||||
private lateinit var reactChoreographerMock: ReactChoreographer
|
||||
|
||||
@@ -84,9 +84,6 @@ class TimingModuleTest {
|
||||
|
||||
@Before
|
||||
fun prepareModules() {
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
|
||||
systemClock = mockStatic(SystemClock::class.java)
|
||||
systemClock
|
||||
.`when`<Long> { SystemClock.uptimeMillis() }
|
||||
@@ -147,7 +144,6 @@ class TimingModuleTest {
|
||||
@After
|
||||
fun tearDown() {
|
||||
systemClock.close()
|
||||
arguments.close()
|
||||
ReactChoreographer.overrideInstanceForTest(reactChoreographerOriginal)
|
||||
}
|
||||
|
||||
|
||||
+5
-14
@@ -5,37 +5,35 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.view.View.OnFocusChangeListener
|
||||
import com.facebook.react.R
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests
|
||||
import com.facebook.react.views.view.ReactViewGroup
|
||||
import com.facebook.react.views.view.ReactViewManager
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import java.util.Locale
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.kotlin.mock
|
||||
import org.mockito.kotlin.times
|
||||
import org.mockito.kotlin.verify
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class BaseViewManagerTest {
|
||||
private lateinit var viewManager: BaseViewManager<ReactViewGroup, *>
|
||||
private lateinit var view: ReactViewGroup
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private lateinit var themedReactContext: ThemedReactContext
|
||||
|
||||
@Before
|
||||
@@ -45,13 +43,6 @@ class BaseViewManagerTest {
|
||||
val context = BridgeReactContext(RuntimeEnvironment.getApplication())
|
||||
themedReactContext = ThemedReactContext(context, context, null, -1)
|
||||
view = ReactViewGroup(themedReactContext)
|
||||
arguments = Mockito.mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createMap() }.thenAnswer { JavaOnlyArray() }
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
arguments.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
-13
@@ -7,32 +7,19 @@
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.SystemClock
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.MockedStatic
|
||||
import org.mockito.Mockito.mockStatic
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class OnLayoutEventTest {
|
||||
private lateinit var systemClock: MockedStatic<SystemClock>
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
ReactNativeFeatureFlagsForTests.setUp()
|
||||
val ts = SystemClock.uptimeMillis()
|
||||
systemClock = mockStatic(SystemClock::class.java)
|
||||
systemClock.`when`<Long> { SystemClock.uptimeMillis() }.thenReturn(ts)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
systemClock.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.view.View
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.view.View
|
||||
|
||||
+3
-8
@@ -19,11 +19,8 @@ import com.facebook.drawee.drawable.ScalingUtils
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.BridgeReactContext
|
||||
import com.facebook.react.bridge.CatalystInstance
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.JavaOnlyMap
|
||||
import com.facebook.react.bridge.ReactTestHelper.createMockCatalystInstance
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.common.ReactConstants
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
@@ -32,6 +29,7 @@ import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.util.RNLog
|
||||
import com.facebook.react.views.imagehelper.ImageSource
|
||||
import com.facebook.soloader.SoLoader
|
||||
import com.facebook.testutils.shadows.ShadowArguments
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
@@ -47,26 +45,24 @@ import org.mockito.kotlin.reset
|
||||
import org.mockito.kotlin.verify
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
/**
|
||||
* Verify that [com.facebook.drawee.drawable.ScalingUtils] properties are being applied correctly by
|
||||
* [ReactImageManager].
|
||||
*/
|
||||
@Config(shadows = [ShadowArguments::class])
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class ReactImagePropertyTest {
|
||||
|
||||
private lateinit var context: BridgeReactContext
|
||||
private lateinit var catalystInstanceMock: CatalystInstance
|
||||
private lateinit var themeContext: ThemedReactContext
|
||||
private lateinit var arguments: MockedStatic<Arguments>
|
||||
private lateinit var rnLog: MockedStatic<RNLog>
|
||||
private lateinit var flogMock: MockedStatic<FLog>
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
arguments = mockStatic(Arguments::class.java)
|
||||
arguments.`when`<WritableArray> { Arguments.createArray() }.thenAnswer { JavaOnlyArray() }
|
||||
arguments.`when`<WritableMap> { Arguments.createMap() }.thenAnswer { JavaOnlyMap() }
|
||||
|
||||
rnLog = mockStatic(RNLog::class.java)
|
||||
rnLog.`when`<Boolean> { RNLog.w(any(), anyString()) }.thenAnswer {}
|
||||
@@ -87,7 +83,6 @@ class ReactImagePropertyTest {
|
||||
@After
|
||||
fun teardown() {
|
||||
DisplayMetricsHolder.setWindowDisplayMetrics(null)
|
||||
arguments.close()
|
||||
rnLog.close()
|
||||
flogMock.close()
|
||||
}
|
||||
|
||||
+3
-1
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.views.virtualview
|
||||
package com.facebook.react.views.virtual.view
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
@@ -19,6 +19,8 @@ import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
import com.facebook.react.uimanager.events.Event
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.views.scroll.ReactScrollView
|
||||
import com.facebook.react.views.virtual.VirtualViewMode
|
||||
import com.facebook.react.views.virtual.VirtualViewModeChangeEvent
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
+9
-12
@@ -18,18 +18,15 @@ import org.robolectric.annotation.Implements
|
||||
import org.robolectric.shadow.api.Shadow
|
||||
|
||||
@Implements(Arguments::class)
|
||||
class ShadowArguments {
|
||||
object ShadowArguments {
|
||||
@JvmStatic @Implementation fun createArray(): WritableArray = JavaOnlyArray()
|
||||
|
||||
companion object {
|
||||
@JvmStatic @Implementation fun createArray(): WritableArray = JavaOnlyArray()
|
||||
@JvmStatic @Implementation fun createMap(): WritableMap = JavaOnlyMap()
|
||||
|
||||
@JvmStatic @Implementation fun createMap(): WritableMap = JavaOnlyMap()
|
||||
|
||||
@JvmStatic
|
||||
@Implementation
|
||||
fun fromJavaArgs(args: Array<Any?>): WritableNativeArray =
|
||||
WritableNativeArray().apply {
|
||||
(Shadow.extract(this) as ShadowNativeArray).backingArray = JavaOnlyArray.of(*args)
|
||||
}
|
||||
}
|
||||
@JvmStatic
|
||||
@Implementation
|
||||
fun fromJavaArgs(args: Array<Any?>): WritableNativeArray =
|
||||
WritableNativeArray().apply {
|
||||
(Shadow.extract(this) as ShadowNativeArray).backingArray = JavaOnlyArray.of(*args)
|
||||
}
|
||||
}
|
||||
|
||||
-16
@@ -9,8 +9,6 @@ package com.facebook.testutils.shadows
|
||||
|
||||
import com.facebook.react.bridge.JavaOnlyArray
|
||||
import com.facebook.react.bridge.NativeArray
|
||||
import com.facebook.react.bridge.ReadableNativeArray
|
||||
import com.facebook.react.bridge.WritableNativeArray
|
||||
import org.robolectric.annotation.Implements
|
||||
import org.robolectric.shadow.api.Shadow
|
||||
|
||||
@@ -19,20 +17,6 @@ import org.robolectric.shadow.api.Shadow
|
||||
open class ShadowNativeArray {
|
||||
var backingArray: JavaOnlyArray = JavaOnlyArray()
|
||||
|
||||
@Deprecated(
|
||||
"Use ShadowReadableNativeArray",
|
||||
ReplaceWith(
|
||||
"ShadowReadableNativeArray", "com.facebook.testutils.shadows.ShadowReadableNativeArray"))
|
||||
@Implements(ReadableNativeArray::class)
|
||||
class Readable : ShadowNativeArray()
|
||||
|
||||
@Deprecated(
|
||||
"Use ShadowWritableNativeArray",
|
||||
ReplaceWith(
|
||||
"ShadowWritableNativeArray", "com.facebook.testutils.shadows.ShadowWritableNativeArray"))
|
||||
@Implements(WritableNativeArray::class)
|
||||
class Writable : ShadowNativeArray()
|
||||
|
||||
companion object {
|
||||
fun getContents(array: NativeArray): List<Any?> =
|
||||
(Shadow.extract(array) as ShadowNativeArray).backingArray.toArrayList()
|
||||
|
||||
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
"DEFINES_MODULE" => "YES" }
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if ENV['USE_FRAMEWORKS'] && ReactNativeCoreUtils.build_rncore_from_source()
|
||||
s.header_mappings_dir = './'
|
||||
s.module_name = 'React_Fabric'
|
||||
end
|
||||
@@ -56,6 +56,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
s.subspec "animations" do |ss|
|
||||
ss.source_files = podspec_sources("react/renderer/animations/**/*.{m,mm,cpp,h}", "react/renderer/animations/**/*.{h}")
|
||||
|
||||
@@ -79,6 +79,7 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
s.subspec "components" do |ss|
|
||||
|
||||
|
||||
@@ -78,4 +78,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
depend_on_js_engine(s)
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -39,5 +39,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
add_dependency(s, "React-debug")
|
||||
add_rn_third_party_dependencies(s)
|
||||
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -32,11 +32,12 @@ Pod::Spec.new do |s|
|
||||
"DEFINES_MODULE" => "YES",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
"GCC_WARN_PEDANTIC" => "YES" }
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if ENV['USE_FRAMEWORKS'] && ReactNativeCoreUtils.build_rncore_from_source()
|
||||
s.header_mappings_dir = './'
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
|
||||
# Note: Update this only when ready to minimize breaking changes.
|
||||
|
||||
@@ -52,4 +52,5 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -48,4 +48,5 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
|
||||
"USE_HEADERMAP" => "YES",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard()
|
||||
}
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if ENV['USE_FRAMEWORKS'] && ReactNativeCoreUtils.build_rncore_from_source()
|
||||
s.header_mappings_dir = '../'
|
||||
s.module_name = 'React_jserrorhandler'
|
||||
end
|
||||
@@ -49,5 +49,6 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
|
||||
end
|
||||
|
||||
@@ -46,4 +46,5 @@ Pod::Spec.new do |s|
|
||||
s.exclude_files = files_to_exclude
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -41,4 +41,5 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
@@ -60,4 +60,5 @@ Pod::Spec.new do |s|
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
+2
-1
@@ -41,10 +41,11 @@ Pod::Spec.new do |s|
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
"DEFINES_MODULE" => "YES"}
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if ENV['USE_FRAMEWORKS'] && ReactNativeCoreUtils.build_rncore_from_source()
|
||||
s.module_name = module_name
|
||||
s.header_mappings_dir = "../.."
|
||||
end
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
+2
-1
@@ -41,7 +41,7 @@ Pod::Spec.new do |s|
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
||||
"DEFINES_MODULE" => "YES"}
|
||||
|
||||
if ENV['USE_FRAMEWORKS']
|
||||
if ENV['USE_FRAMEWORKS'] && ReactNativeCoreUtils.build_rncore_from_source()
|
||||
s.module_name = module_name
|
||||
s.header_mappings_dir = "../.."
|
||||
end
|
||||
@@ -52,4 +52,5 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-timing"
|
||||
|
||||
add_rn_third_party_dependencies(s)
|
||||
add_rncore_dependency(s)
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user