diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java index 73d57e00181..c4caeaa79af 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java @@ -38,10 +38,14 @@ import javax.annotation.Nullable; *
Keep in mind that all JS remote method calls and script load calls are asynchronous and you * should not expect them to return results immediately. * - *
In order to write catalyst integration: 1) Make {@link ReactIntegrationTestCase} a base class - * of your test case 2) Use {@link ReactTestHelper#catalystInstanceBuilder()} instead of {@link - * com.facebook.react.bridge.CatalystInstanceImpl.Builder} to build catalyst instance for testing - * purposes + *
In order to write catalyst integration: + * + *
+---------------------------------------------+ | A | | | | +-----------+ +---------+ | | | B - * | | D | | | | +---+ | | | | | | | C | | | | | | | | | | +---------+ | | | +---+ | | | - * +-----------+ | | | | | | | +---------------------------------------------+ + *
+ * +---------------------------------------------+ + * | A | + * | | + * | +-----------+ +---------+ | + * | | B | | D | | + * | | +---+ | | | | + * | | | C | | | | | + * | | | | | +---------+ | + * | | +---+ | | + * | +-----------+ | + * | | + * | | + * | | + * +---------------------------------------------+ + ** *
View locations and dimensions: A - (0,0) to (500, 500) (500x500) B - (50,80) to (250, 380) * (200x300) C - (150,150) to (200, 300) (50x150) D - (400,100) to (450, 300) (50x200) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java index 7aae6556514..eeeb3dc5008 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java @@ -130,9 +130,13 @@ public class CatalystMultitouchHandlingTestCase extends ReactAppInstrumentationT * This method "replay" multi-touch gesture recorded with modified TouchesHelper class that * generated this piece of code (see https://phabricator.fb.com/P19756940). This is not intended * to be copied/reused and once we need to have more multitouch gestures in instrumentation tests - * we should either: - implement nice generator similar to {@link SingleTouchGestureGenerator} - - * implement gesture recorded that will record touch data using arbitrary format and then read - * this recorded touch sequence during tests instead of generating code like this + * we should either: + * + *
* +-----------------------------+
+ * | |
+ * | +---------------------+ |
+ * | | inner1 | |
+ * | +---------------------+ |
+ * | +-------------------------+ |
+ * | | outer (clip=true) | |
+ * | | +---------------------+ | |
+ * | | | inner2 | | |
+ * | | +---------------------+ | |
+ * | | | |
+ * | +-------------------------+ |
+ * | +---------------------+ |
+ * | | inner3 | |
+ * | +---------------------+ |
+ * | |
+ * +-----------------------------+
+ *
*
* We expect only outer and inner2 to be attached */ @@ -69,11 +84,29 @@ public class CatalystSubviewsClippingTestCase extends ReactAppInstrumentationTes } /** - * In this test view are layout in a following way: +-----------------------------+ | outer - * (clip=true) | | | | | | | | +-----------------------------+ | | complexInner (clip=true) | | | - * +----------+ | +---------+ | | | | inner1 | | | inner2 | | | | | | | | | | | | +----------+ | - * +---------+ | +--------------+--------------+ | | +----------+ +---------+ | | | inner3 | | - * inner4 | | | | | | | | | +----------+ +---------+ | | | +-----------------------------+ + * In this test view are layout in a following way: + * + *
+ * In this test view are layout in a following way: + * +-----------------------------+ + * | outer (clip=true) | + * | | + * | | + * | | + * | +-----------------------------+ + * | | complexInner (clip=true) | + * | | +----------+ | +---------+ | + * | | | inner1 | | | inner2 | | + * | | | | | | | | + * | | +----------+ | +---------+ | + * +--------------+--------------+ | + * | +----------+ +---------+ | + * | | inner3 | | inner4 | | + * | | | | | | + * | +----------+ +---------+ | + * | | + * +-----------------------------+ + ** *
We expect outer, complexInner & inner1 to be attached */ diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java index 60dc3de87c8..2aeec8ddddd 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java @@ -16,16 +16,31 @@ import com.facebook.react.testing.StringRecordingModule; * This test is to verify that touch events bubbles up to the right handler. We emulate couple of * different gestures on top of the application reflecting following layout: * - *
+---------------------------------------------------------------------------------------+ | | - * | +----------------------------------------------------------------------------------+ | | | - * +-------------+ +----------------+ | | | | | +---+ | | | | | | | | | A | | | | | | | | | +---+ | - * | C | | | | | | {B} | | | | | | | | | {D} | | | | | | +-------------+ +----------------+ | | | | - * | | | | | | | - * +----------------------------------------------------------------------------------+ | | | - * +----------------------------------------------------------------------------------+ | | | | | | - * | | | | | | | | | {E} | | | | | | | | | | | - * +----------------------------------------------------------------------------------+ | + *
* +---------------------------------------------------------------------------------------+
+ * | |
+ * | +----------------------------------------------------------------------------------+ |
+ * | | +-------------+ +----------------+ | |
+ * | | | +---+ | | | | |
+ * | | | | A | | | | | |
+ * | | | +---+ | | C | | |
+ * | | | {B} | | | | |
+ * | | | | {D} | | | |
+ * | | +-------------+ +----------------+ | |
+ * | | | |
+ * | | | |
+ * | +----------------------------------------------------------------------------------+ |
+ * |
+ * | +----------------------------------------------------------------------------------+ |
+ * | | | |
+ * | | | |
+ * | | | |
+ * | | {E} | |
+ * | | | |
+ * | | | |
+ * | +----------------------------------------------------------------------------------+ |
+ * +---------------------------------------------------------------------------------------+
+ *
*
* Then in each test case we either tap the center of a particular view (from A to E) or we start * a gesture in one view and end it with another. View with names in brackets (e.g. {D}) have touch diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java index 047455dadf2..2dc678fc3a3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java @@ -15,12 +15,17 @@ import javax.annotation.Nonnull; /** * Main interface for providing additional capabilities to the catalyst framework by couple of - * different means: 1) Registering new native modules 2) Registering new JS modules that may be - * accessed from native modules or from other parts of the native code (requiring JS modules from - * the package doesn't mean it will automatically be included as a part of the JS bundle, so there - * should be a corresponding piece of code on JS side that will require implementation of that JS - * module so that it gets bundled) 3) Registering custom native views (view managers) and custom - * event types 4) Registering natively packaged assets/resources (e.g. images) exposed to JS + * different means: + * + *
TODO(6788500, 6788507): Implement support for adding custom views, events and resources */ diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 962730b06b1..5870cf432cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -34,14 +34,19 @@ import javax.annotation.Nullable; * operations (such as interpolation, addition, etc) and connection are used to describe how change * of the value in one node can affect other nodes. * - *
Few examples of the nodes that can be created on the JS side: - Animated.Value is a simplest - * type of node with a numeric value which can be driven by an animation engine (spring, decay, etc) - * or by calling setValue on it directly from JS - Animated.add is a type of node that may have two - * or more input nodes. It outputs the sum of all the input node values - interpolate - is actually - * a method you can call on any node and it creates a new node that takes the parent node as an - * input and outputs its interpolated value (e.g. if you have value that can animate from 0 to 1 you - * can create interpolated node and set output range to be 0 to 100 and when the input node changes - * the output of interpolated node will multiply the values by 100) + *
Few examples of the nodes that can be created on the JS side: + * + *
You can mix and chain nodes however you like and this way create nodes graph with connections * between them. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java index 51ac27100f0..f17c45331ab 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java @@ -20,11 +20,16 @@ import javax.annotation.Nullable; * occurs. * *
Native methods can be exposed to JS with {@link ReactMethod} annotation. Those methods may - * only use limited number of types for their arguments: 1/ primitives (boolean, int, float, double - * 2/ {@link String} mapped from JS string 3/ {@link ReadableArray} mapped from JS Array 4/ {@link - * ReadableMap} mapped from JS Object 5/ {@link Callback} mapped from js function and can be used - * only as a last parameter or in the case when it express success & error callback pair as two last - * arguments respectively. + * only use limited number of types for their arguments: + * + *
All methods exposed as native to JS with {@link ReactMethod} annotation must return {@code * void}. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java index 6adb752a629..2f4d83b98fc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java @@ -17,9 +17,13 @@ import javax.annotation.Nullable; * app outside of this catalyst instance still in a good state to allow reloading and restarting * this catalyst instance? * - *
Examples where this class is appropriate to throw: - JS tries to update a view with a tag that - * hasn't been created yet - JS tries to show a static image that isn't in resources - JS tries to - * use an unsupported view class + *
Examples where this class is appropriate to throw: + * + *
Examples where this class **isn't** appropriate to throw: - Failed to write to localStorage * because disk is full - Assertions about internal state (e.g. that diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java index 32c4b015546..bdd9c156d63 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java @@ -12,14 +12,19 @@ package com.facebook.react.bridge; *
When multiple activities share a react instance, only the most recent one's lifecycle events * get forwarded to listeners. Consider the following scenarios: * - *
1. Navigating from Activity A to B will trigger two events: A#onHostPause and B#onHostResume. - * Any subsequent lifecycle events coming from Activity A, such as onHostDestroy, will be ignored. - * 2. Navigating back from Activity B to Activity A will trigger the same events: B#onHostPause and - * A#onHostResume. Any subsequent events coming from Activity B, such as onHostDestroy, are ignored. - * 3. Navigating back from Activity A to a non-React Activity or to the home screen will trigger two - * events: onHostPause and onHostDestroy. 4. Navigating from Activity A to a non-React Activity B - * will trigger one event: onHostPause. Later, if Activity A is destroyed (e.g. because of resource - * contention), onHostDestroy is triggered. + *
One can use 'debug_http_host' shared preferences key to provide a host name for the debug * server. If the setting is empty we support and detect two basic configuration that works well for - * android emulators connection to debug server running on emulator's host: - Android stock emulator - * with standard non-configurable local loopback alias: 10.0.2.2, - Genymotion emulator with default - * settings: 10.0.3.2 + * android emulators connection to debug server running on emulator's host: + * + *
There are two 'success' cases that will cause {@link #getDidJSHitFrameAndCleanup} to return * true for a given frame: * - *
1) UIManagerModule finished dispatching a batched UI update on the UI thread during the - * frame. This means that during the next hierarchy traversal, new UI will be drawn if needed - * (good). 2) The bridge ended the frame idle (meaning there were no JS nor native module calls - * still in flight) AND there was no UiManagerModule update enqueued that didn't also finish. NB: - * if there was one enqueued that actually finished, we'd have case 1), so effectively we just - * look for whether one was enqueued. + *
NB: This call can only be called once for a given frame time range because it cleans up * events it recorded for that frame. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java index 6b6517d651e..7ff0acb0874 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java @@ -33,9 +33,12 @@ public class I18nUtil { } /** - * Check if the device is currently running on an RTL locale. This only happens when the app: - is - * forcing RTL layout, regardless of the active language (for development purpose) - allows RTL - * layout when using RTL locale + * Check if the device is currently running on an RTL locale. This only happens when the app: + * + *
NB: All native view management methods listed above must be called from the UI thread.
diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java
index 488efd005fc..f7e0ea554ae 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java
@@ -193,8 +193,18 @@ public abstract class ViewManager Returned map should be of the form: { "onTwirl": { "phasedRegistrationNames": { "bubbled":
- * "onTwirl", "captured": "onTwirlCaptured" } } }
+ * Returned map should be of the form:
+ *
+ * Returned map should be of the form: { "onTwirl": { "registrationName": "onTwirl" } }
+ * Returned map should be of the form:
+ *
+ * Each annotated method should return {@code void} and take exactly two arguments: first being a
* view instance to be updated and second a value that should be set.
*
- * Allowed types of values are: - primitives (int, boolean, double, float) - {@link String} -
- * {@link Boolean} - {@link com.facebook.react.bridge.ReadableArray} - {@link
- * com.facebook.react.bridge.ReadableMap}
+ * Allowed types of values are:
+ *
+ * When property gets removed from the corresponding component in React, annotated setter will be
* called with {@code null} in case of non-primitive value type or with a default value in case when
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java
index f1ce43f3041..8fb8bb7bee5 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java
@@ -37,13 +37,17 @@ import javax.annotation.Nullable;
/**
* ReactModalHostView is a view that sits in the view hierarchy representing a Modal view.
*
- * It does a number of things: 1. It creates a Dialog. We use this Dialog to actually display the
- * Modal in the window. 2. It creates a DialogRootViewGroup. This view is the view that is displayed
- * by the Dialog. To display a view within a Dialog, that view must have its parent set to the
- * window the Dialog creates. Because of this, we can not use the ReactModalHostView since it sits
- * in the normal React view hierarchy. We do however want all of the layout magic to happen as if
- * the DialogRootViewGroup were part of the hierarchy. Therefore, we forward all view changes around
- * addition and removal of views to the DialogRootViewGroup.
+ * It does a number of things:
+ *
+ * Example, Android 4.4:
*
- * Example, Android 4.4:
*
- * Additional data provided by this event: - position - index of first page from the left that is
- * currently visible - offset - value from range [0,1) describing stage between page transitions.
- * Value x means that (1 - x) fraction of the page at "position" index is visible, and x fraction of
- * the next page is visible.
+ * Additional data provided by this event:
+ *
+ * Additional data provided by this event: - pageScrollState - {Idle,Dragging,Settling}
+ * Additional data provided by this event:
+ *
+ * Additional data provided by this event: - position - index of page that has been selected
+ * Additional data provided by this event:
+ *
+ *
+ * {
+ * "onTwirl": {
+ * "phasedRegistrationNames": {
+ * "bubbled": "onTwirl",
+ * "captured": "onTwirlCaptured"
+ * }
+ * }
+ * }
+ *
*/
public @Nullable Map
+ * {
+ * "onTwirl": {
+ * "registrationName": "onTwirl"
+ * }
+ * }
+ *
*/
public @Nullable Map
+ *
*
*
+ *
*/
public class ReactModalHostView extends ViewGroup implements LifecycleEventListener {
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java
index fb460ca5a41..f7470b55204 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java
@@ -351,18 +351,23 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
/**
* NB: If a font family is used that does not have a style in a certain Android version (ie.
* monospace bold pre Android 5.0), that style (ie. bold) will not be inherited by nested Text
- * nodes. To retain that style, you have to add it to those nodes explicitly. Example, Android
- * 4.4:
+ *
*/
protected @Nullable String mFontFamily = null;
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java
index 02a15abb3aa..f3478e14aaa 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java
@@ -72,18 +72,23 @@ public class TextAttributeProps {
/**
* NB: If a font family is used that does not have a style in a certain Android version (ie.
* monospace bold pre Android 5.0), that style (ie. bold) will not be inherited by nested Text
- * nodes. To retain that style, you have to add it to those nodes explicitly. Example, Android
- * 4.4:
+ *
*/
protected @Nullable String mFontFamily = null;
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/viewpager/PageScrollEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/viewpager/PageScrollEvent.java
index 869da50118f..d07eab665a1 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/viewpager/PageScrollEvent.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/viewpager/PageScrollEvent.java
@@ -15,10 +15,14 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
* Event emitted by {@link ReactViewPager} when user scrolls between pages (or when animating
* between pages).
*
- *
+ *
*/
/* package */ class PageScrollEvent extends Event
+ *
*/
class PageScrollStateChangedEvent extends Event
+ *
*/
/* package */ class PageSelectedEvent extends Event