mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 02:24:23 +00:00
Adding @CountEnum to simple enums in xplat/js
Summary: Using The Count to transform enums to ints in production builds: https://our.intern.facebook.com/intern/wiki/Android-java-transforms/the-count/ Reviewed By: achen1 Differential Revision: D9614432 fbshipit-source-id: 1b1a197ad8f4962712d6006ab07b3beb3eaf2432
This commit is contained in:
parent
01d5eff425
commit
06bf7b1f00
@ -13,6 +13,8 @@ import java.io.Writer;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Simple Json generator that does no validation.
|
||||
*/
|
||||
@ -207,6 +209,7 @@ public class JsonWriter implements Closeable {
|
||||
mScopes.push(scope);
|
||||
}
|
||||
|
||||
@CountEnum
|
||||
private enum Scope {
|
||||
EMPTY_OBJECT,
|
||||
OBJECT,
|
||||
|
@ -5,6 +5,9 @@
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
@CountEnum
|
||||
public enum MemoryPressure {
|
||||
UI_HIDDEN,
|
||||
MODERATE,
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.react.bridge.queue;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Spec for creating a MessageQueueThread.
|
||||
*/
|
||||
@ -18,6 +20,7 @@ public class MessageQueueThreadSpec {
|
||||
// The Thread constructor interprets zero the same as not specifying a stack size
|
||||
public static final long DEFAULT_STACK_SIZE_BYTES = 0;
|
||||
|
||||
@CountEnum
|
||||
protected static enum ThreadType {
|
||||
MAIN_UI,
|
||||
NEW_BACKGROUND,
|
||||
|
@ -19,6 +19,7 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
":build_config",
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.react.common;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Lifecycle state for an Activity. The state right after pause and right before resume are the
|
||||
* basically the same so this enum is in terms of the forward lifecycle progression (onResume, etc).
|
||||
@ -18,6 +20,7 @@ package com.facebook.react.common;
|
||||
* STARTED,
|
||||
* RESUMED
|
||||
*/
|
||||
@CountEnum
|
||||
public enum LifecycleState {
|
||||
BEFORE_CREATE,
|
||||
BEFORE_RESUME,
|
||||
|
@ -7,6 +7,7 @@ rn_android_library(
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
|
@ -13,6 +13,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* A simple wrapper around Choreographer that allows us to control the order certain callbacks
|
||||
@ -21,6 +22,7 @@ import com.facebook.react.common.ReactConstants;
|
||||
*/
|
||||
public class ReactChoreographer {
|
||||
|
||||
@CountEnum
|
||||
public enum CallbackType {
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ rn_android_library(
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
|
@ -7,9 +7,12 @@
|
||||
|
||||
package com.facebook.react.modules.datepicker;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Date picker modes
|
||||
*/
|
||||
@CountEnum
|
||||
public enum DatePickerMode {
|
||||
CALENDAR,
|
||||
SPINNER,
|
||||
|
@ -10,6 +10,7 @@ rn_android_library(
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
package com.facebook.react.modules.timepicker;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
@CountEnum
|
||||
public enum TimePickerMode {
|
||||
CLOCK,
|
||||
SPINNER,
|
||||
|
@ -18,6 +18,7 @@ rn_java_library(
|
||||
source = "7",
|
||||
target = "7",
|
||||
deps = [
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/javapoet:javapoet"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
|
@ -53,6 +53,8 @@ import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Elements;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* This annotation processor crawls subclasses of ReactShadowNode and ViewManager and finds their
|
||||
* exported properties with the @ReactProp or @ReactGroupProp annotation. It generates a class
|
||||
@ -549,6 +551,7 @@ public class ReactPropertyProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
@CountEnum
|
||||
private enum SettableType {
|
||||
VIEW_MANAGER,
|
||||
SHADOW_NODE
|
||||
|
@ -23,6 +23,7 @@ rn_android_library(
|
||||
YOGA_TARGET,
|
||||
":DisplayMetrics",
|
||||
react_native_dep("java/com/facebook/systrace:systrace"),
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_target("java/com/facebook/debug/tags:tags"),
|
||||
|
@ -7,10 +7,13 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Possible values for pointer events that a view and its descendants should receive. See
|
||||
* https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info.
|
||||
*/
|
||||
@CountEnum
|
||||
public enum PointerEvents {
|
||||
|
||||
/**
|
||||
|
@ -7,9 +7,12 @@
|
||||
|
||||
package com.facebook.react.uimanager.events;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Touch event types that JS module RCTEventEmitter can understand
|
||||
*/
|
||||
@CountEnum
|
||||
public enum TouchEventType {
|
||||
START("topTouchStart"),
|
||||
END("topTouchEnd"),
|
||||
|
@ -5,10 +5,13 @@
|
||||
|
||||
package com.facebook.react.uimanager.layoutanimation;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Enum representing the different view properties that can be used when animating layout for
|
||||
* view creation.
|
||||
*/
|
||||
@CountEnum
|
||||
/* package */ enum AnimatedPropertyType {
|
||||
OPACITY("opacity"),
|
||||
SCALE_X("scaleX"),
|
||||
|
@ -5,9 +5,12 @@
|
||||
|
||||
package com.facebook.react.uimanager.layoutanimation;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Enum representing the different animation type that can be specified in layout animation config.
|
||||
*/
|
||||
@CountEnum
|
||||
/* package */ enum LayoutAnimationType {
|
||||
CREATE("create"),
|
||||
UPDATE("update"),
|
||||
|
@ -35,6 +35,7 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
YOGA_TARGET,
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("libraries/fresco/fresco-react-native:fbcore"),
|
||||
react_native_dep("libraries/fresco/fresco-react-native:fresco-drawee"),
|
||||
react_native_dep("libraries/fresco/fresco-react-native:fresco-react-native"),
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
package com.facebook.react.views.image;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
@CountEnum
|
||||
public enum ImageResizeMethod {
|
||||
AUTO,
|
||||
RESIZE,
|
||||
|
@ -11,6 +11,7 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
YOGA_TARGET,
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
|
@ -7,9 +7,12 @@
|
||||
|
||||
package com.facebook.react.views.scroll;
|
||||
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
|
||||
/**
|
||||
* Scroll event types that JS module RCTEventEmitter can understand
|
||||
*/
|
||||
@CountEnum
|
||||
public enum ScrollEventType {
|
||||
BEGIN_DRAG("topScrollBeginDrag"),
|
||||
END_DRAG("topScrollEndDrag"),
|
||||
|
@ -8,6 +8,7 @@ rn_android_library(
|
||||
],
|
||||
deps = [
|
||||
YOGA_TARGET,
|
||||
react_native_dep("java/com/facebook/thecount:thecount"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
|
@ -27,11 +27,13 @@ import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.uimanager.FloatUtil;
|
||||
import com.facebook.react.uimanager.Spacing;
|
||||
import com.facebook.thecount.api.CountEnum;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* A subclass of {@link Drawable} used for background of {@link ReactViewGroup}. It supports drawing
|
||||
* background color and borders (including rounded borders) by providing a react friendly API
|
||||
@ -111,6 +113,7 @@ public class ReactViewBackgroundDrawable extends Drawable {
|
||||
private final Context mContext;
|
||||
private int mLayoutDirection;
|
||||
|
||||
@CountEnum
|
||||
public enum BorderRadiusLocation {
|
||||
TOP_LEFT,
|
||||
TOP_RIGHT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user