mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations:annotationsAndroid (#43937)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43937 Changelog: [Internal] Reviewed By: cortinico Differential Revision: D55724728 fbshipit-source-id: 8536aa8eb1c8876fa1208932f5c706ef239d4212
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b23960ad99
commit
a3a5a60052
-53
@@ -1,53 +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.module.annotations;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation for use on {@link com.facebook.react.bridge.BaseJavaModule}s to describe properties
|
||||
* for that module.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface ReactModule {
|
||||
/** Name used to {@code require()} this module from JavaScript. */
|
||||
String name();
|
||||
|
||||
/**
|
||||
* True if you intend to override some other native module that was registered e.g. as part 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.
|
||||
*/
|
||||
boolean canOverrideExistingModule() default false;
|
||||
|
||||
/** Whether this module needs to be loaded immediately. */
|
||||
boolean needsEagerInit() default false;
|
||||
|
||||
/**
|
||||
* Whether this module has constants to add, defaults to true as that is safer for when a correct
|
||||
* annotation is not included
|
||||
*
|
||||
* @deprecated This property is unused and it's planning to be removed in a future version of
|
||||
* React Native. Please refrain from using it.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasConstants() default true;
|
||||
|
||||
/**
|
||||
* Indicates if a module is a C++ module or a Java Module
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isCxxModule() default false;
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.module.annotations
|
||||
|
||||
/**
|
||||
* Annotation for use on [com.facebook.react.bridge.BaseJavaModule]s to describe properties for that
|
||||
* module.
|
||||
*/
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
public annotation class ReactModule(
|
||||
/** Name used to `require()` this module from JavaScript. */
|
||||
public val name: String,
|
||||
/**
|
||||
* True if you intend to override some other native module that was registered e.g. as part 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.
|
||||
*/
|
||||
public val canOverrideExistingModule: Boolean = false,
|
||||
/** Whether this module needs to be loaded immediately. */
|
||||
public val needsEagerInit: Boolean = false,
|
||||
/**
|
||||
* Whether this module has constants to add, defaults to true as that is safer for when a
|
||||
* correct annotation is not included
|
||||
*/
|
||||
@get:Deprecated(
|
||||
"""This property is unused and it's planning to be removed in a future version of
|
||||
React Native. Please refrain from using it.""")
|
||||
public val hasConstants: Boolean = true,
|
||||
/**
|
||||
* Indicates if a module is a C++ module or a Java Module
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public val isCxxModule: Boolean = false
|
||||
)
|
||||
-31
@@ -1,31 +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.module.annotations;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotates a function that returns a list of ModuleSpecs from which we get a list of NativeModules
|
||||
* to create ReactModuleInfos from.
|
||||
*/
|
||||
@Retention(SOURCE)
|
||||
@Target(TYPE)
|
||||
public @interface ReactModuleList {
|
||||
|
||||
/**
|
||||
* The Native modules in this list should be annotated with {@link ReactModule}.
|
||||
*
|
||||
* @return List of Native modules in the package.
|
||||
*/
|
||||
Class<? extends NativeModule>[] nativeModules();
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.module.annotations
|
||||
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
* Annotates a function that returns a list of ModuleSpecs from which we get a list of NativeModules
|
||||
* to create ReactModuleInfos from.
|
||||
*/
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
public annotation class ReactModuleList(
|
||||
/**
|
||||
* The Native modules in this list should be annotated with [ReactModule].
|
||||
*
|
||||
* @return List of Native modules in the package.
|
||||
*/
|
||||
public val nativeModules: Array<KClass<out NativeModule>>
|
||||
)
|
||||
Reference in New Issue
Block a user