Commit Graph

2114 Commits

Author SHA1 Message Date
Aaron Chiu 12f123d3e4 add JS->Java Bridge traffic
Reviewed By: achen1

Differential Revision: D5740501

fbshipit-source-id: 3a88cd95d3a58aac24968e577f4eb3096d47d4ec
2017-09-19 12:03:15 -07:00
Dmitry Zakharov 4fc9e20fce Untangle NativeAnimatedNodesManager from UIManager internals.
Reviewed By: AaaChiuuu

Differential Revision: D5861523

fbshipit-source-id: 39eb79b91d4d5e2295d03369f1be585ae7836c75
2017-09-19 10:00:52 -07:00
David Vacca 5180995666 Fix setBackground for Android sdk version 15 and below
Reviewed By: achen1

Differential Revision: D5854430

fbshipit-source-id: 1276f3d7e94b757f9a9dd412a2ef8b72e8427ffb
2017-09-19 09:39:45 -07:00
Kang Zhang 87a1dc4b76 rename catalyst animations
Reviewed By: achen1

Differential Revision: D5855613

fbshipit-source-id: 2eac7ba6a9d95f6cd3a58a1df4ec0b170f34d6ed
2017-09-19 07:33:42 -07:00
Tomas Reimers 9e373529f3 Backed out D5792012.
Reviewed By: AaaChiuuu

Differential Revision: D5855139

fbshipit-source-id: 3837769a4da90d9752de75669c6395fabcd3b18b
2017-09-18 21:37:54 -07:00
Max Sherman e764361f93 Add getter for JS Executor Factory
Reviewed By: mhorowitz

Differential Revision: D5857012

fbshipit-source-id: 8c9fc0095c512325968234f48d6728b63d61913d
2017-09-18 21:18:24 -07:00
Michał Gregorczyk d6c519bc96 Base class for all object private data passed to JSC
Reviewed By: amnn

Differential Revision: D5761937

fbshipit-source-id: de88cf8b959fc855c3c0786f817bb6032491c819
2017-09-18 18:45:27 -07:00
Ori Harel 795370789b re #15915 HeadlessJsTaskService is expected to run on UI thread
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Headless tasks are required to run in the main thread, however due to the nature of the React context creation flow, the handler may be returned outside of the main thread, causing the HeadlessJsTaskContext to throw an exception.

Swipe out the app. send push notification from a server that starts a HeadlessJsTaskService
Closes https://github.com/facebook/react-native/pull/15940

Differential Revision: D5852448

Pulled By: foghina

fbshipit-source-id: 54c58a1eb7434dd5de5c39c28f6e068ed15ead9d
2017-09-18 05:30:50 -07:00
Valentin Shergin 7efd4fabfd Text to Spannable conversion is now using PRIORITY flag to enforce the order of spans
Summary:
When we convert nested <Text> components to Spannable object we must enforce the order of spans somehow,
otherwise we will have Spannable object with unpredictable order of spans, which will produce unpredictalbe text layout.
We can do it only using `Spannable.SPAN_PRIORITY` feature because Spannable objects do not maintain the order of spans internally.

We also have to fix this to implement autoexpandable <TextInput>.

Reviewed By: achen1

Differential Revision: D5811172

fbshipit-source-id: 5bc68b869e58aba27d6986581af9fe3343d116a7
2017-09-17 22:00:16 -07:00
Brian Vaughn d1372faeb5 Re-added global event-type Map to UIManager constants
Reviewed By: sophiebits

Differential Revision: D5846806

fbshipit-source-id: 7b0a54bd5a4b877f0c5915f11392ee0d34718dbe
2017-09-15 16:47:16 -07:00
Kathy Gray cf2ef84b16 Move destroy threads in catalystinstance off the UI thread
Reviewed By: cwdick

Differential Revision: D5842135

fbshipit-source-id: e9c44c4129d4d10da8781798df121f5c676766f8
2017-09-15 05:48:57 -07:00
Brian Vaughn 75c94a8907 Native view manager event types exposed to JS via view config
Differential Revision: D5814210

fbshipit-source-id: 41291f0d6b39af77f66173f6a699d88f9f4ccc74
2017-09-14 18:17:17 -07:00
Aaron Chiu 6c2c2ecd8c add some RN Core markers
Reviewed By: achen1

Differential Revision: D5740438

fbshipit-source-id: eca6160e0ff9089e1f70ead0f2269ce152258c19
2017-09-14 12:02:29 -07:00
Ramanpreet Nara adb6646016 Make <TextInput multiline> default blurOnSubmit to false.
Reviewed By: achen1

Differential Revision: D5830633

fbshipit-source-id: 3d0880656f14cfafa0f15c4341021799f20f40ed
2017-09-14 11:30:58 -07:00
Valentin Shergin a17797940d Fixed issue with remeasuring ReactTextShadowNode
Summary:
This fixes the regression recently introduced during refactoring of text-related classes.
So, added fragment of code was lost in D5715830.
See how it looked before:
9f5bdd7b49/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java (L424-L431)

Reviewed By: TheSavior

Differential Revision: D5827424

fbshipit-source-id: 5df99620057ff6a27105dd05903c7f5def85c5d2
2017-09-13 14:33:59 -07:00
Tomas Reimers cbb0ccb185 mActivelyScrolling expected to be true so long as events are being fired.
Summary:
**Problem:**

It was observed that in [this code path](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java#L292) (i.e. horizontal, paging-enabled scroll view) if you tried to programmatically call the scrollTo method within ~1s of the onMomentumScrollEnd event (which should only be called after all scrolling has ended), the scrollView would scroll to the new location, and then scroll BACK to the original location.

For example, assume you had released the scrollView at location B, and the nearest page boundary is A. Then, 1000ms later, you call scrollTo position C. The order of operations would be:

1. Begin scrolling to A from position B (as it is the nearest page boundary)
2. Reach position A
3. Fire onMomentumScrollEnd
4. 1000ms later call scrollTo C
5. scrollView scrolls to C
6. scrollView scrolls BACK to position A (for no apparent reason).

**Reason:**

I suspect this is because the [smoothlyScrollTo](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java#L292) will continue to animate towards A, but the [scrollEvents will not fire](f954f3d9b6/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java (L45)) as they are too close to each other. So the true order of events is:

1. Begin scrolling to A from position B (as it is the nearest page boundary)

[begin smoothlyScrollTo]
[scroll towards position A]
[mActivelyScrolling is true]

2. Reach position A

[mActivelyScrolling is true]
[scroll towards position A]
[mActivelyScrolling is false, as there is another scrollEvent, but because it is close enough to the same location it is ignored]

3. Fire onMomentumScrollEnd
4. 1000ms later call scrollTo C

[scroll towards position C]

5. scrollView scrolls to C

[scroll towards position A as the original smoothlyScrollTo animation was never completed]

6. scrollView scrolls BACK to position A.

This is an untested hypothesis, but seems to explain the behavior, and the solution is more semantically correct anyway. If there is an easy way to rebuild the android binaries happy to test it myself! Just let me know!

**Solution:**

 Move the mActivelyAnimating outside the mOnScrollDispatchHelper.onScrollChanged helper, because the HorizontalScrollView event should be considered to be animating so long as onScrollChanged events are being fired.
Closes https://github.com/facebook/react-native/pull/15146

Reviewed By: AaaChiuuu

Differential Revision: D5792026

Pulled By: tomasreimers

fbshipit-source-id: 9654fda038d4a687cc32f4c32dc312baa34627ed
2017-09-12 18:30:39 -07:00
Tomas Reimers 718f4e60c2 Remove 'box-only' as a layoutOnlyProp
Summary:
Currently, having the property `pointerEvents={'box-only'}` marks a view as layoutOnly. For optimization reasons, layoutOnly nodes are [not added to the node hierarchy](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L99)) The problem is that should this box ever need to be [transitioned to not-layout-only](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L394)) (for example, because you add the a CSS transform property),  it must be added to the hierarchy. To add it to the hierarchy the [React Styles Diff Map](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L396)) is passed along with the backing shadowNode to create the node. The problem is that at no point were the original `pointerEvents` and so the new node will be created with `pointerEvents =  'auto'`.

A more correct fix to this problem might be to have shadowNodes carry around their pointerEvents, although this is likely a greater design decision which is why am I proposing the quick fix now.

Will also resolve: https://github.com/react-native-community/react-native-modal/issues/11
Closes https://github.com/facebook/react-native/pull/15529

Reviewed By: AaaChiuuu

Differential Revision: D5792012

Pulled By: tomasreimers

fbshipit-source-id: 625242c53e16cb293c64811a57f6c3905b3483e0
2017-09-12 14:21:11 -07:00
Valentin Shergin 6114f863c3 Restructured inheritance around ReactTextViewManager and co.
Summary:
Abstract class `ReactBaseTextShadowNode` was decoupled from `ReactTextShadowNode` to separate two goals/roles:
 * `ReactBaseTextShadowNode` represents spanned `<Text>` nodes, which can bear text attributes (both `RCTText` and `RCTVirtualText`);
 * `ReactTextShadowNode` represents anchor `<Text>` view in Yoga terms, which can bear layout attributes (`RCTText` and `RCTTextInput`).

`ReactVirtualTextShadowNode` now inherits `ReactBaseTextShadowNode`.
The same architectural changes was applited to view managers.

Why?
 * This is just a better architecture which represents the nature of this objects.
 * Bunch of "negative" logic which turn off excessive features for some suclasses was removed.
 * Memory efficiency.
 * Now we can improve `<TextInput>` component using right inheritance. Yay!

Reviewed By: achen1

Differential Revision: D5715830

fbshipit-source-id: ecc0764a03b5b7586fe77ad31f149cd840f4da41
2017-09-11 15:49:01 -07:00
Valentin Shergin 80027ce6db ReactRawTextShadowNode does not inherit ReactTextShadowNode anymore
Summary:
ReactRawTextShadowNode represents "raw" text node (aka textContent), so it cannot have layout or styling, it is just a line of text, a pure string.
So, we must not interit it from HUGE ReactTextShadowNode (which represents <Text> node with ReactRawTextShadowNode instance inside).
We need this change to make future fancy (and valuable from product perspective) refactoring possible. Stay tuned!

Reviewed By: achen1

Differential Revision: D5712961

fbshipit-source-id: 009e48046bdf34ddfd40b93175934969af64b98b
2017-09-11 15:49:01 -07:00
Spencer Ahrens 393bf88be6 Add all test routes as server snapshot tests
Reviewed By: raluca-elena, TheSavior

Differential Revision: D5638532

fbshipit-source-id: 8db8210d0d0d08b9423b0a77f6b8e4e290f2eef0
2017-09-11 15:18:11 -07:00
Andrew Jack 96de23abf1 Android Oreo (8.0) Support
Summary:
Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`.

https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt

This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later.

When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions.
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY

https://github.com/AndrewJack/react-native-android-oreo tested here
Closes https://github.com/facebook/react-native/pull/15601

Reviewed By: achen1

Differential Revision: D5801619

Pulled By: shergin

fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
2017-09-11 12:48:46 -07:00
David Vacca 4ca617211b Add support for dynamically sized ReactRootView
Reviewed By: achen1, AaaChiuuu

Differential Revision: D5745093

fbshipit-source-id: 65d85252ab8a0ca38322f49a3d4812380d5228c4
2017-09-08 21:18:00 -07:00
Hongtan Du c893989d21 Add check for valid rootTag in ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D5796097

fbshipit-source-id: 1aed793dd77864f1b2cb20e64049483a084f0bc0
2017-09-08 14:17:38 -07:00
Michael Lee 1f2ca244d7 Move to fbsystrace to a new location
Reviewed By: dreiss

Differential Revision: D5760920

fbshipit-source-id: 9ff001dbd34660c14d061dec5428e82a815c719a
2017-09-07 09:17:02 -07:00
Valentin Shergin d2f3a7282b Bikeshedding in ReactTextInputShadowNode, part 2
Reviewed By: AaaChiuuu

Differential Revision: D5712962

fbshipit-source-id: b0cb5dbbd93b661252e5ddcf6c0a34e59cb7f2c6
2017-09-06 17:23:41 -07:00
Valentin Shergin 5f1f0b14f0 Bikeshedding in ReactTextInputShadowNode
Reviewed By: AaaChiuuu

Differential Revision: D5712963

fbshipit-source-id: 87c8394d82e0c206f908fb07eb8b7464b0ecabaf
2017-09-06 17:23:41 -07:00
Valentin Shergin 35cac3bf1b Introducing `ReactShadowNode.isYogaLeafNode()`
Summary:
We have to have a way to explicitly enforce the fact that some nodes cannot have Yoga child nodes.
Previously we relied on `isMeasureDefined()`, which is actually special case (so it does not cover all possible cases).

Reviewed By: AaaChiuuu

Differential Revision: D5647855

fbshipit-source-id: 59591be61ef62c61eb98748d44bb28b878f713fc
2017-09-06 17:23:41 -07:00
Michael Lee ed31f7a97d Reformat BUCK files
Reviewed By: zertosh

Differential Revision: D5756296

fbshipit-source-id: 69af6e9211648a81ba864be8d37165023cb5f9c2
2017-09-05 15:02:19 -07:00
Andrew Chen (Eng) 1ccc03c217 Fix Circle CI build missing appcompat dep
Differential Revision: D5769914

fbshipit-source-id: 51652e276165b4f61ae473bc25a19499da5bd1b4
2017-09-05 15:02:19 -07:00
Marc Horowitz d48f08cad6 Thread the JSI runtime descriptor up into the RCTDevMenu title
Reviewed By: javache

Differential Revision: D5643014

fbshipit-source-id: 977be5729c57c0d01ff67b268031ad6fdbf88a07
2017-09-05 15:02:19 -07:00
Andrew Chen (Eng) 5a3828d299 Dirty the shadow node when ReactLithoView requests layout
Reviewed By: shergin

Differential Revision: D5756680

fbshipit-source-id: 409095a2ee61db7ee7a85e12ab64c7806da3b3d9
2017-09-05 11:01:39 -07:00
Michał Gregorczyk efd728ab7e ReactInstanceManager tests with non-JSC JavaScriptExecutor
Reviewed By: johnislarry

Differential Revision: D5764234

fbshipit-source-id: ea088b025def7ed4f39e6b75b8111ac13da9b331
2017-09-05 09:45:02 -07:00
Janic Duplessis e964a7f4ef Fix scroll events getting skipped on Android
Summary:
This code related to velocity would cause some scroll events to be skipped and caused some jitter for sticky headers. Not sure if there is a better fix but removing this does fix missing events and the velocity calculation still seems to be working.

**Test plan**
Tested that sticky headers now work properly on Android, tested that velocity calculation still seem to work.
Closes https://github.com/facebook/react-native/pull/15761

Differential Revision: D5760820

Pulled By: sahrens

fbshipit-source-id: 562b5f606bdc5452ca3d85efb5e0e3e7db224891
2017-09-01 18:06:24 -07:00
Omer Strulovich b11587b19f Revert D5746286, D5717191, D5717111 to try and unblock stable
Reviewed By: mzlee

Differential Revision: D5758871

fbshipit-source-id: ea014e237246ae3b16ee2d1b5f5a7310e164d183
2017-09-01 15:18:40 -07:00
Michał Gregorczyk 9f76e9d374 Test for non-JSC JavaScriptExecutor
Reviewed By: mhorowitz

Differential Revision: D5746286

fbshipit-source-id: 5bc5d5fcbc9e3ab7de0153145b1276edd3f3aa13
2017-09-01 09:15:43 -07:00
Michał Gregorczyk 4cba3abf06 Fix NPE in ReactInstaceManager.setupReactContext
Reviewed By: AaaChiuuu, mhorowitz

Differential Revision: D5724464

fbshipit-source-id: 80d0b97f4294f6894e0d034dda6dd1a3db4b1341
2017-09-01 09:15:43 -07:00
Michael Lee bf80585eba Switch to xplat folly
Reviewed By: nlutsenko

Differential Revision: D5739990

fbshipit-source-id: a1b862faab1dbcdb3bcc11f1bf662241cf7252e5
2017-08-31 17:02:38 -07:00
Aaron Chiu 47c8b07310 add ability to print from JS and app navigation as a category
Reviewed By: achen1

Differential Revision: D5661567

fbshipit-source-id: 005323afbbb33ec5e36cbce7f395edc573dcc2ff
2017-08-31 14:46:12 -07:00
Adam Ernst 93993799eb Gracefully handle any unrecognized stack frame format
Reviewed By: javache

Differential Revision: D5736692

fbshipit-source-id: e90dc38fa203ae65ac839f37940e96f23b35c330
2017-08-31 07:52:50 -07:00
Ben Nham 6ceb4fa53f add files changed count to reload metrics
Reviewed By: AaaChiuuu

Differential Revision: D5694652

fbshipit-source-id: c7bfe4f222fd7b29baaec4102abe4f920ceaccc6
2017-08-31 04:37:36 -07:00
Zachary Liu 42713c917e Fix empty @ReactModuleList generated code
Reviewed By: AaaChiuuu

Differential Revision: D5737684

fbshipit-source-id: dc9312f595da23390cda14d5092c92d1e0319b83
2017-08-30 14:01:17 -07:00
Florian Schoellhammer fe0d081229 Remove v4 support library from RN deps
Reviewed By: achen1

Differential Revision: D5724107

fbshipit-source-id: 26548c0bc937b725d0cbe3c139ace09006f4fddb
2017-08-30 12:17:10 -07:00
Marc Horowitz de01f09b5d Remove the restriction on importing bridge:cxxreact
Reviewed By: javache

Differential Revision: D5724406

fbshipit-source-id: 24974601d161fd23805d8e925b2b20a1cf11850d
2017-08-30 11:52:28 -07:00
Ben Nham b7096c1136 fix logging of tagged markers
Reviewed By: alexeylang

Differential Revision: D5694590

fbshipit-source-id: 29e9cd7be88645e1c2c9f43d6e12261962c6ed09
2017-08-30 05:15:35 -07:00
Ben Nham ce4e41ac2e fix content appeared logging
Reviewed By: AaaChiuuu

Differential Revision: D5694558

fbshipit-source-id: 9d3ed839c301e700c715de1bbde7f6e44d12f605
2017-08-30 05:15:35 -07:00
Ben Nham d63cf13ce1 download bundle atomically
Reviewed By: javache

Differential Revision: D5697494

fbshipit-source-id: 9217194b609aabf3da23a092b3e5887925bb9bbc
2017-08-30 05:15:35 -07:00
Aaron Chiu e9d7711847 add debug overlay
Reviewed By: achen1

Differential Revision: D5659422

fbshipit-source-id: e95ed85884700b5e9bd084152e2cc89085fa66ad
2017-08-30 02:06:17 -07:00
Nurzhan Bakibayev 7d0c128174 Remove 'Debug JS on-device (experimental)' feature
Reviewed By: bnham

Differential Revision: D5706200

fbshipit-source-id: f389222a9266819c5730860a2e3e461eb1068d0e
2017-08-29 04:29:57 -07:00
Rene Weber 94a2ff93db Force original ime option when using multiline with blurOnSubmit in a…
Summary:
…ndroid

Android overrides the original set ime option when the EditText is a multiline one.
This change makes sure to set it back to the original one when blurOnSubmit is true,
which causes the button icon to be conforming to the set returnKeyType as well as
changing the behaviour of the button, such that it will blurOnSubmit correctly.

The reason not do it with blurOnSubmit being false is
because it then would not create new lines when pressing the submit button,
which would be inconsistent with IOS behaviour.

**Note** this change relies on this one #11006 because the app would crash if we don't expllicitly remove the focus (`editText.clearFocus();`)

Fixes #8778

**Test plan (required)**

1. Create view with TextInput with multiline and blurOnSubmit set to true
```javascript
<View>
           <TextInput
                returnKeyType='search'
                blurOnSubmit={true}
                multiline={true}
                onSubmitEditing={event => console.log('submit search')}></TextInput>
</View>
```

2. Input some text and click submit button in soft keyboard
3. See submit event fired and focus cleared / keyboard removed
Closes https://github.com/facebook/react-native/pull/11125

Differential Revision: D5718755

Pulled By: hramos

fbshipit-source-id: c403d61a8a879c04c3defb40ad0b6689a2329ce1
2017-08-28 12:15:30 -07:00
Alan Foster 2ceed95490 Support flash scroll indicators for android
Summary:
There is missing support for flash scroll indicators on Android. This PR adds this functionality.

Ensured that the functionality works now within iOS _and_ Android

![flashindicators-ios](https://user-images.githubusercontent.com/1271782/29491236-80ecc062-854c-11e7-9562-bdfe03d505f9.gif)

![flashindicators-android](https://user-images.githubusercontent.com/1271782/29491238-826f321c-854c-11e7-955c-cd425afd05f8.gif)
Closes https://github.com/facebook/react-native/pull/15566

Differential Revision: D5686942

Pulled By: shergin

fbshipit-source-id: 40c8bfec47d660fe8108253bb9ba9fd16ff0d19c
2017-08-27 22:29:42 -07:00