Граф коммитов

3039 Коммитов

Автор SHA1 Сообщение Дата
David Vacca 4802cffa14 Remove FabricBinder interface
Summary: This diff removes the FabricBinder interface as it is not required anymore

Reviewed By: sahrens

Differential Revision: D13707495

fbshipit-source-id: ba470e7b0884d75491b1b162cd6bce09c193d863
2019-01-17 13:05:29 -08:00
Luna Wei b2459cc01c Fix [FB4A] DialogModule.showNewAlert
Summary:
Check that the Fragment Manager has not called `onSaveInstanceState` before attempting to show the DialogFragment.

See: https://developer.android.com/reference/android/support/v4/app/FragmentManager#isstatesaved

Reviewed By: mdvacca

Differential Revision: D13686425

fbshipit-source-id: 090a88aa6f892c961b1c49a2bffe603c38528b8a
2019-01-17 11:36:34 -08:00
David Vacca 7debc4da7a remove syncrhronization from FabricSoLoader.staticInit
Summary: removing synchronization as this is not needed

Reviewed By: ejanzer

Differential Revision: D13697495

fbshipit-source-id: d2e2aa5590241abfbcf563a6a860467285eb2ea6
2019-01-17 00:33:22 -08:00
Louis Lagrange cf85d0e4d6 Add HTTP cache by default (like iOS) (#18348)
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!

-->

On iOS, the cache is enabled by default but it's not the case on Android. This PR adds 10Mo of HTTP cache by default. 10Mo was chosen arbitrarily.

Fixes #16795

<!--(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)-->

I wrote it so there's no breaking change for those already using the `OkHttpClientProvider.createClient` and `OkHttpClientProvider.createClientBuilder` public methods.

1. react-native init TestAndroidCache
2. Followed https://facebook.github.io/react-native/docs/android-building-from-source.html to build  with this branch as react-native
3. Added the following code in the App.js (with correct URL_WITH_CACHE_CONTROL)
4. Made sure the debugger is closed
5. Throttled my mac's network speed with the `Network link conditioner` (edge)
6. Tapped "Fetch", it shows ~4000
7. Tapped "Fetch" again, it shows ~6

```js
import React, { Component } from 'react';
import {
  StyleSheet,
  Alert,
  View,
  Button
} from 'react-native';

type Props = {};
export default class App extends Component<Props> {
  fetch = () => {
    const start = Date.now();
    fetch('{URL_WITH_CACHE_CONTROL}').then(() => {
      const diff = Date.now() - start;
      Alert.alert(diff.toString());
    });
  };

  render() {
    return (
      <View style={styles.container}>
        <Button title={"fetch"} onPress={this.fetch} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
});
```

None

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[ANDROID] [FEATURE] [Networking] Add HTTP caching
Pull Request resolved: https://github.com/facebook/react-native/pull/18348

Differential Revision: D13680430

Pulled By: hramos

fbshipit-source-id: 1e49cf75702db72b20a316e9cdd971605f8fe7e0
2019-01-16 20:59:22 -08:00
Ram N aa19fa02e9 Add a way to selectively enable TurboModules
Summary:
Added a flag that checks if TurboModules are enabled, don't expose them to JS via the old module system.
All TurboModules needs to implement TurboModule interface.

Reviewed By: mdvacca

Differential Revision: D13648332

fbshipit-source-id: f22506fe029ac82d56075f5b6962ff2df2e7eaa4
2019-01-16 19:24:42 -08:00
David Vacca b421b5f4bd Open source Fabric android
Summary: This diff open sources Fabric Android implementation and it extracts ComponentDescriptorFactory into a function that can be "injected" per application

Reviewed By: shergin

Differential Revision: D13616172

fbshipit-source-id: 7b7a6461216740b5a1ad5ebbead9e37de4570221
2019-01-16 12:38:22 -08:00
Adam Comella 7d881c1d8a RNTester: Add `allowFontScaling` example to Android (#22991)
Summary:
iOS's `allowFontScaling` example was copied to Android. Also, I added a case illustrating that `allowFontScaling` gets inherited in nested `<Text>` scenarios. This tests the bug fix from #22917. This nested case was added to both iOS and Android.

Also, moved the comment in `TextAttributes.java` from the top of the file to the top of the class definition as requested in #22917.
Pull Request resolved: https://github.com/facebook/react-native/pull/22991

Differential Revision: D13671380

Pulled By: cpojer

fbshipit-source-id: a8aae4f051c76391e33bdbd6bdc80aff9b7de5cd
2019-01-16 06:47:02 -08:00
Adam Comella 0db0d263ac Android Text: Fix `letterSpacing` rendering when `fontSize` changes (#22993)
Summary:
If you set `letterSpacing` on an outer text and then set `fontSize` on an inner text, the wrong `letterSpacing` will be rendered.

Here's an example:

```
<Text style={{ fontSize: 10, letterSpacing: 10 }}>
  <Text style={{ fontSize: 20 }}>Some text</Text>
</Text>
```

`fontSize` affects letter spacing. In this case, the bug is that setting `fontSize` to `20` doesn't cause the letter spacing to be recalculated.

Notice that the logic for applying letter spacing only applies it if the node has a different value for `getEffectiveLetterSpacing()` than its parent. The problem is that `getEffectiveLetterSpacing()` doesn't represent the final letter spacing value -- it doesn't take `fontSize` into account. Consequently, it sometimes incorrectly skips applying letter spacing as illustrated above.

The fix is to ensure `getEffectiveLetterSpacing()` represents the final rendered letter spacing value. To do this, some of the letter spacing calculation code was moved from `CustomLetterSpacingSpan` to `getEffectiveLetterSpacing()`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22993

Differential Revision: D13671505

Pulled By: cpojer

fbshipit-source-id: 400f36d3fd71ab7cb6cba8508baa71f2973f8f0e
2019-01-16 05:40:48 -08:00
Adam Comella e6057095ad Android TextInput: Support `allowFontScaling` on placeholder (#22992)
Summary:
Currently, the `TextInput's` placeholder is always sized as though `allowFontScaling` is `true`.

Note that `allowFontScaling` works fine for the content of the `TextInput`. The reason is that we set the font size in two places: in the shadow node and in the Android view. The shadow node logic determines the size of the content and the Android view logic determines the size of the placeholder. The handler for the `allowFontScaling` prop is only present in the shadow node logic. Consequently, the Android view logic always uses the default value of `true` for the `allowFontScaling` prop.

The fix is to add logic for handling the `allowFontScaling` prop to the Android view.

It would be great if we could handle all text props in one spot instead of duplicating code between the shadow node and the Android view. That would eliminate this whole class of bugs. However, I don't have enough familiarity with the history of this code to know how hard that would be or if it's even possible.

Fixes #18827.
Pull Request resolved: https://github.com/facebook/react-native/pull/22992

Differential Revision: D13671400

Pulled By: cpojer

fbshipit-source-id: 40bae3cfb0ca6298e91a81c05211538935f5a0e8
2019-01-16 05:31:55 -08:00
Kudo Chien e3ff15052a Remove unused files and code for old JSC and gcc build (#23014)
Summary:
----------

1. Unused prebuilt old JSC for 64bits.
2. Folly patch for gcc build.
Pull Request resolved: https://github.com/facebook/react-native/pull/23014

Differential Revision: D13690139

Pulled By: cpojer

fbshipit-source-id: 64555f5b9a5fbd4156e42eeff13da721846c2521
2019-01-16 04:01:53 -08:00
Listen 1fde677cfc Remove duplicated `OnGlobalLayoutListener` to improve performance (#22849)
Summary:
We are writing a native navigation library. When there are more than a dozen `ReactRootView` in the application, the application will be very stuck. It doesn't improve much, even if we remove the invisible ReactRootView from the View hierarchy temporarily.

After debugging, we found that we were not able to remove `OnGlobalLayoutListener` in `onDetachedFromWindow` because  this listener was added twice. One is in `onAttachedToWindow` and the other is in `attachToReactInstanceManager`.

We added the following code by inheriting ReactRootView.

```java
    Override
    protected void onAttachedToWindow() {
        try {
            Method method = ReactRootView.class.getDeclaredMethod("getCustomGlobalLayoutListener");
            method.setAccessible(true);
            // remove duplicated GlobalLayoutListener
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                getViewTreeObserver().removeOnGlobalLayoutListener((ViewTreeObserver.OnGlobalLayoutListener) method.invoke(this));
            } else {
                getViewTreeObserver().removeGlobalOnLayoutListener((ViewTreeObserver.OnGlobalLayoutListener) method.invoke(this));
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        super.onAttachedToWindow();
    }
```

It turns out that there is no pressure even if  opening hundreds of pages that contain ReactRootView (remove ReactRootView from the View hierarchy temporarily in the invisible pages).

Changelog:
----------

[Android] [Fixed] - Remove duplicated `OnGlobalLayoutListener` to improve performance.
Pull Request resolved: https://github.com/facebook/react-native/pull/22849

Differential Revision: D13682818

Pulled By: hramos

fbshipit-source-id: 1f1bc8cd5fc4e01a1bc2f2a4784822b4eae92fdc
2019-01-15 20:45:07 -08:00
gengjiawen 5dd9d72ec0 Fix ReactAndroid bundle issue (#22799)
Summary:
Related change: 0a293a014b.

Changelog:
----------

[Bugfix] [Android] - fix 64bit so bundle issue.
Pull Request resolved: https://github.com/facebook/react-native/pull/22799

Differential Revision: D13669711

Pulled By: hramos

fbshipit-source-id: 0234b4731db0c74c8e4b8b738a19ae971fadb702
2019-01-15 16:49:44 -08:00
Monte Thakkar 7fbccdea22 Updated RedBox screen (#22242)
Summary:
[Re: RedBox screen is a bit scary - Discussions and Proposals](https://github.com/react-native-community/discussions-and-proposals/issues/42)

Per hramos:
> The RedScreen was inspired by Ruby on Rails's error screen

> I do see the RedBox screen could be made less jarring while still successfully displaying all the information we need.

Hence jamonholmgren came up with the idea that only the header & footer of the RedBox screen could be red. This makes the content a bit more readable as well as makes the screen a little less intimidating.

Also frantic made the suggestion that since the bottom buttons are not as important, they don't need to stand out. Hence only the header of the RedBox screen which displays the error is made red.

Screenshots:
----------

<div style="flex-direction: row">
<img width="325" alt="orginal" src="https://user-images.githubusercontent.com/7840686/48322916-b4958b80-e5de-11e8-9276-33378d1b41c5.png">
<img width="320" alt="redbox_v2_ios" src="https://user-images.githubusercontent.com/7840686/48665300-cce32b80-ea60-11e8-8e8f-88f74bad30ca.png">

</div>

<div style="flex-direction: row">
<img width="300" alt="original_android" src="https://user-images.githubusercontent.com/7840686/48322958-d5f67780-e5de-11e8-891c-1b20bd00e67b.png">
<img width="300" alt="redbox_v2_android" src="https://user-images.githubusercontent.com/7840686/48665312-f13f0800-ea60-11e8-9fb6-47e03c809789.png">

</div>
Pull Request resolved: https://github.com/facebook/react-native/pull/22242

Reviewed By: hramos

Differential Revision: D13564287

Pulled By: cpojer

fbshipit-source-id: fcb6ba5e20d863f4b957d20f3787f5b7a365bfdb
2019-01-15 06:29:49 -08:00
Adam Comella 1bdb250906 Android Text: More robust logic for handling inherited text props (#22917)
Summary:
Purpose
----------

This commit fixes a bug and prepares us for adding support for the `maxContentSizeMultiplier` prop (it's currently only supported on iOS).

Details
----------

Today we don't explicitly track inheritance of text props. Instead we rely on `SpannableStringBuilder` to handle this for us. Consider this example:

```
<Text style={{fontSize: 10}}>
  <Text style={{letterSpacing: 5}}>
    ...
  </Text>
</Text>
```

In today's implementation, the inner text doesn't know about `fontSize` (i.e. its `mFontSize` instance variable is `Float.NaN`). But everything works properly because the outer `Text` told `SpannableStringBuilder` to apply the font size across the entire string of text.

However, today's approach breaks down when computing the value to apply to the `SpannableStringBuilder` depends on multiple props. Suppose that RN Android supported the `maxContentSizeMultiplier` prop. Then calculating the font size to apply to the `SpannableStringBuilder` would involve both the `fontSize` prop and the `maxContentSizeMultiplier` prop. If `fontSize` was set on an outer `Text` and `maxContentSizeMultiplier` was set on an inner `Text` then the inner `Text` wouldn't be able to calculate the font size to apply to the `SpannableStringBuilder` because the outer `Text's` `fontSize` prop isn't available to it.

The `TextAttributes` class solves this problem. Every `Text` has a `TextAttributes` instance which stores its text props. During rendering, a child's `TextAttributes` is combined with its parent's and handed down the tree. In this way, during rendering a `Text` has access to the relevant text props from itself and its ancestors.

This design is inspired by the [`RCTTextAttributes`](7197aa026b/Libraries/Text/RCTTextAttributes.m) class from RN iOS.

Bug Fix
----------

This refactoring happens to fix a bug. Today, when setting `fontSize` on nested Text, `allowFontScaling` is always treated as though it is true regardless of the value on the root `Text`. For example, the following snippets should render "hello" identically, Instead, the bottom snippet renders "hello" as though `allowFontScaling` is true.

```
<Text allowFontScaling={false} style={{fontSize: 50}}>hello</Text>
<Text allowFontScaling={false}><Text style={{fontSize: 50}}>hello</Text></Text>
```

(The repro assumes you've increased your device's font setting so that the font size multiplier is not 1.0.)

Introducing the `TextAttributes` class fixed this. It forced us to think about how inheritance should work for `allowFontScaling`. In the new implementation, `Text` components use the value of `allowFontScaling` from the outermost `Text` component. This matches the behavior on iOS (the `allowFontScaling` prop gets ignored on virtual text nodes because it doesn't appear [in this list](3749da1312/Libraries/Text/Text.js (L266-L269)).)
Pull Request resolved: https://github.com/facebook/react-native/pull/22917

Reviewed By: mdvacca

Differential Revision: D13630235

Pulled By: shergin

fbshipit-source-id: e58f458de4fc3cdcbec49c8e0509da51966ef93c
2019-01-14 16:28:19 -08:00
Ram N e6f7d69428 Move Android TurboModules to github
Summary:
This commit moves all the turbo module files for Android to Github.

Note that gradle build is not yet enabled.
Sample Turbo Modules will be added in a later commit.

Other missing features

- Support for `CxxModule`
- Remove usage of folly::dynamic for arguments and result conversion
- Support for Promise return types.

Reviewed By: mdvacca

Differential Revision: D13647438

fbshipit-source-id: 5f1188556d6c64bfa2b2fd2146ac72b0fb456891
2019-01-14 15:48:09 -08:00
Dulmandakh 64de0c0aef bump okhttp to 3.12.1 (#22877)
Summary:
Bump OkHTTP to 3.12.1.

Changelog:
----------
[Android] [Changed] - bump OkHTTP 3.12.1
Pull Request resolved: https://github.com/facebook/react-native/pull/22877

Differential Revision: D13639172

Pulled By: hramos

fbshipit-source-id: 780d10207877637592ea3eb25eff445bc2986f91
2019-01-14 10:34:30 -08:00
David Vacca adc1a95a3b Reuse ViewManagerRegistry between UIManagerModule and FabricUIManager
Summary: This diff reuses the ViewManager registry between UIManagerModule and Fabric, previously View Managers were being initialized twice (one for each UIManager), increasing Fabric TTI by ~77ms

Reviewed By: shergin

Differential Revision: D13640912

fbshipit-source-id: d7a9591084c66e4a2fc2384b2dae1b7fc5a228d0
2019-01-11 18:45:45 -08:00
Taras Tsugrii c458242d87 Reformat xplat build files according to new formatting rules.
Summary: drop-conflicts

Reviewed By: zertosh

Differential Revision: D13610808

fbshipit-source-id: 52c2a90bba3d9b0ac383f6e4a76b4fb3e60bf382
2019-01-10 20:00:42 -08:00
Arthur Lee 6c501eb666 Fix status bar default on Android
Summary: On Android, the status bar color is not always black by default. The existing code causes the status bar to revert to black once the last `<StatusBar>` component is unmounted from the "stack". This diff reverts the bar background color to what it was before, instead of assuming black.

Reviewed By: yungsters

Differential Revision: D13368136

fbshipit-source-id: ef0154f776607b57bb9400b72d521f5f485b0075
2019-01-10 14:53:22 -08:00
Ram N 93fa4efe06 Implement callback method
Summary: Implement callbacks in Turbo Module

Reviewed By: mdvacca

Differential Revision: D6744474

fbshipit-source-id: c896dbc936c3051d9f0e4582da042cd34da996bc
2019-01-09 10:48:02 -08:00
Adam Comella f6f8b092f9 Android TextInput: Improve application of styles for `value` prop (#22461)
Summary:
Prior to this change, when you passed text to `TextInput` via the `value` or `defaultValue` props, React Native didn't apply any of the styles in `buildSpannedFromShadowNode` to the text. This is because `spannedFromShadowNode` appends `value` after calling `buildSpannedFromShadowNode`. Many styles worked because their logic is included in both `buildSpannedFromShadowNode` and `ReactTextInputManager`. However, some only appear in `buildSpannedFromShadowNode` such as `textDecorationLine` (it would be good to understand why we need to duplicate styling logic in `buildSpannedFromShadowNode` & `ReactTextInputManager` and to know whether `ReactTextInputManager` should be handling `textDecorationLine`).

Also, this commit improves consistency between iOS and Android if you specify both `value` and children on a `TextInput`. Prior to this, iOS concatenated the strings such that the `value` prop came before the children whereas Android put the children before the `value` prop. Now Android matches iOS's behavior and puts the `value` prop before the children.

These appear to be regressions. The `value` prop used to be appended before calling `buildSpannedFromShadowNode` (this behavior appears to have been changed by accident in 80027ce6db (diff-4f5947f2fe0381c4a6373a30e596b8c3)).

The fix is to append the `value` prop before calling `buildSpannedFromShadowNode`. Additionally, we have to expose a new `start` parameter on `buildSpannedFromShadowNode` so that we can tell it to include the text from the `value` prop in the range that it styles. Without this, the start of the styled text would be immediately after `value` because `value` is appended before calling `buildSpannedFromShadowNode`
Pull Request resolved: https://github.com/facebook/react-native/pull/22461

Reviewed By: mdvacca

Differential Revision: D13282065

Pulled By: shergin

fbshipit-source-id: 4c99094741441cf54cdec0075bfd08ff7d889e66
2019-01-08 15:58:43 -08:00
David Aurelio 3e24710155 Apply clang-format rules
Summary:
@public

Formats Yoga's source according to our clang-format configuration

Reviewed By: SidharthGuglani

Differential Revision: D13596650

fbshipit-source-id: c3722d4eafd63b7596a8b1e85c0197e9d2d6cb7d
2019-01-08 12:51:43 -08:00
Luna Wei b5e6ae0fc4 Unify native props
Summary: Unify native props for Switch

Reviewed By: TheSavior, mdvacca

Differential Revision: D13563403

fbshipit-source-id: d219febf197bd024d1ef2acda9f42e40bdf39532
2019-01-07 15:39:21 -08:00
David Vacca 3d12ad5b1a workaround to prevent NPE in ReactViewGroup.dispatchProvideStructure
Summary:
This diff adds a workaround to prevent a NPE to be thrown when the user tap on Android assistant.
The Android stacktrace doesn't help to determine what is the root cause
This is affecting few users in the route: react_MarketplaceProductDetailsFromPostIDRoute

see https://our.intern.facebook.com/intern/logview/details/facebook_android_crashes/b4858cd35bd3496922e5dad4cca70fff/?trace_key=d46b402c3f0cc48c33613b279439a8bf for more details

Reviewed By: fkgozali

Differential Revision: D13586092

fbshipit-source-id: 70f44ab3e32b0c0334e61e8e358c1441944d2727
2019-01-04 18:59:20 -08:00
David Vacca dc114260d9 Integrate Fabric rendering system with ReactChoreographer
Summary:
This diff moves the dispatching of views to the React Choreographer, this help to sort the mount of views following the order specified in the ReactChoreographer class.
This also enables synchronous and correct order for mounting of views that are dispatched in the UI Thread.

Reviewed By: sahrens

Differential Revision: D13444487

fbshipit-source-id: d8a43f473b07c9ccf7ea3bc9ab90545ec3c9ecee
2019-01-02 17:24:32 -08:00
Christoph Nakazawa 117dcd9c58 Fix error message in NativeViewHierarchy
Summary: It was pointed out to me in https://github.com/facebook/react-native/pull/22508 by raphael-liu that the error message refers to the wrong tag. I didn't merge the PR because I don't have good insight into the effects it could cause, but we should at least fix the error message.

Reviewed By: TheSavior

Differential Revision: D13564266

fbshipit-source-id: fa76f0888364df329d052dbcc2050f906d39dcef
2019-01-01 19:45:33 -08:00
Luna Wei 3407a74957 ReactViewGroup.dispatchDraw NullPointerException handling
Summary: Add a catch statement for NPE around ViewGroup's dispatchDraw and log it

Reviewed By: mdvacca

Differential Revision: D13554441

fbshipit-source-id: a94d3db71678e17ef6bcda46689a069b85e460c5
2018-12-28 10:34:38 -08:00
Daniel Zlotin f3e5cce474 Use new JavaScriptCore from npm (#22231)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/22231

- Use clang instead of the deprecated gcc
- Use libc++ instead of the deprecated gnustl
- Updated gradle and android plugin version
- Fixed missing arch in local-cli template
- `clean` task should now always succeed
- `clean` task deletes build artifacts
- No need to specify buildToolsVersion. It's derived.
- Elvis operator for more readable code
Pull Request resolved: https://github.com/facebook/react-native/pull/22263

Reviewed By: hramos

Differential Revision: D13004499

Pulled By: DanielZlotin

fbshipit-source-id: da54bb744cedb4c6f3bda590f8c25d0ad64086ef
2018-12-27 14:51:03 -08:00
David Vacca 5957c8b370 Fix dispatching of events when EventDispatcher is not initialized
Summary:
This diff fixes a NPE that can occur when we force the dispatching of events when the EventDispatcher is not initized.

The fix consists on avoid posting the frame callback, if the internals of EventDispatcher are not initialized yet (same behavior used by the dispatchEvent method)

Reviewed By: fkgozali

Differential Revision: D13549147

fbshipit-source-id: ef3baeb536e8772fbd83024352a37af01c21d589
2018-12-26 21:15:02 -08:00
Kevin Gozali b748e83fbf android: worked around onTouchEvent exception
Summary: Catch `IllegalArgumentException: ReactViewPager.onTouchEvent` and ignore it (but log something) to work around this known bug in the Android SDK per https://github.com/chrisbanes/PhotoView/issues/31#issuecomment-19803926. Note that `onInterceptTouchEvent()` is already doing the same thing.

Reviewed By: yungsters

Differential Revision: D13550425

fbshipit-source-id: 9fa3a7a0ca0cd95aafa3bcae6a59e0d1e690b564
2018-12-26 14:54:34 -08:00
Tim Yung 19d69f9c22 RN: Workaround HorizontalMeasurementProvider Crash
Summary: Adds a workaround to `ReactTextView` for a crash that happens in `getOffsetForHorizontal`: https://issuetracker.google.com/issues/113348914

Reviewed By: mdvacca

Differential Revision: D13548917

fbshipit-source-id: 1c346283cd036c88d60a4b10890ade46c7e80eca
2018-12-26 11:46:38 -08:00
Taras Tsugrii 4d9f02f568 Do not use glob for static paths.
Summary:
```
>>> Lint for xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK:

   Warning  (BUILDIFIERLINT2) constant-glob
    Glob pattern `DisplayMetricsHolder.java` has no wildcard ('*'). Constant
    patterns can be error-prone, move the file outside the glob.
    (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#constant-glob)

              50 rn_android_library(
              51     name = "DisplayMetrics",
              52     srcs = glob([
    >>>       53         "DisplayMetricsHolder.java",
              54     ]),
              55     required_for_source_only_abi = True,
              56     visibility = [
```

Reviewed By: hramos

Differential Revision: D13519693

fbshipit-source-id: 1cb9721f541c22480e4dbdad03978092453b42ba
2018-12-20 11:17:02 -08:00
Max Sherman 8e79a74bc2 Add reset logic for RN perf counters
Reviewed By: alexeylang

Differential Revision: D13419565

fbshipit-source-id: 0b355ca2b672fd3ac8844e326c57cb5718da04c5
2018-12-20 10:39:31 -08:00
Alexander Kawrykow c1c2a5bce5 Increase idle timeout for react app tests
Summary:
Some snapshot tests (particularly those for which there is a lot of test data) can still timeout with "Timed out waiting for bridge and UI idle!" error.
Increasing the timeout to 4 minutes from 2 minutes

Differential Revision: D13523429

fbshipit-source-id: 18f04ea93e342d123eea4c4cd812bd3b1cc85ee0
2018-12-20 09:36:07 -08:00
Alex Dvornikov ae121690eb Update JSStackTrace to support segment ids
Reviewed By: jeanlauliac

Differential Revision: D13504222

fbshipit-source-id: ffda11697838ea03d15a28704d401e1051058b49
2018-12-18 16:23:39 -08:00
David Aurelio 6f70d4c0ac Roll back `-ffast-math`
Summary:
@public

`-ffast-math` does not have measurable performance benefits.

By using `NaN` for *undefined* values again, we can squeeze `YGFloatOptional` into 32 bits.
This will also enable us to store `YGValue` (or a variant of it) in 32 bits.

Reviewed By: astreet

Differential Revision: D13403925

fbshipit-source-id: b13d026bf556f24ab4699e65fb450af13a70961b
2018-12-13 07:16:45 -08:00
Ram N 96e4a72679 Add definations for ReadableArray and WritableArray
Summary: In TurboModules, we need to call into WritableArray and ReadableArray interfaces, not their implementations. By adding these interfaces, we can invoke the corresponding Java classes directly.

Reviewed By: fkgozali

Differential Revision: D6981870

fbshipit-source-id: 12b12b204a7d38b24363452ab574d88b827c907f
2018-12-13 07:09:24 -08:00
Ram N dc52cc5a8f Add defination for ReadableMap interface
Summary: In ReactNative, Native Modules usually use `ReadableMap` interface to take in arguments to methods, not `ReadableNativeMap`. Adding this interface defination to C++, so that with TurboModules, we could use it with `getMethod` definations.

Reviewed By: fkgozali

Differential Revision: D6721049

fbshipit-source-id: cb6e82d618338e54199c7dd066a846e71e742bc6
2018-12-12 10:36:51 -08:00
David Vacca f8bc32abb0 AutoFormat ReactWebViewManager
Summary: easy diff to auto format ReactWebViewManager using our current java code guidelines

Reviewed By: fkgozali

Differential Revision: D13425320

fbshipit-source-id: e59407751c324896e9d6aea8a356949e7cadccaa
2018-12-11 21:28:53 -08:00
David Vacca d1b90ee9e2 Allow to toggle Android WebView HardwareAcceleration from JS
Summary:
This diff exposes a new prop for WebView in Android to disable HardwareAcceleration.
Disabling hardware acceleration is sometimes required to workaround chromium bugs: https://bugs.chromium.org/p/chromium/issues/detail?id=501901

Reviewed By: fkgozali

Differential Revision: D13425243

fbshipit-source-id: e3cd53c72d01f74624b60834496f3cc44076b6b5
2018-12-11 21:28:53 -08:00
Comical DERSKEAL 448a665286 Update CompositeReactPackage.java (#21421)
Summary:
Fixed a typo in function doc.

Release Notes:
--------------
[INTERNAL][MINOR][CompositeReactPackage.java] - Updated a function documentation.

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/21421

Differential Revision: D13422878

Pulled By: hramos

fbshipit-source-id: ce08080d67652159c7f8bbb1ac8b0bfada814b4b
2018-12-11 18:46:26 -08:00
David Vacca aeaeac88f8 Disables StateListAnimator for React Slider Android 6 and 7
Summary:
This diff disables the StateListAnimator for the ReactSlider component in Android 6 and 7
This is this is a hack to prevent T37452851 and https://github.com/facebook/react-native/issues/9979

Reviewed By: yungsters

Differential Revision: D13404685

fbshipit-source-id: d4c4f8796664c890f6a6b3502d3493370e17c300
2018-12-11 11:54:59 -08:00
David Vacca 39b6890346 Fix crash when removing root nodes
Summary: If a children of a root node is being removed and the Root Node is empty, it was likely already removed and cleaned previously, likely due to a race condition caused by RN's async nature. In those cases, let's avoid crashing the app and instead silently ignore the root view removal.

Reviewed By: fkgozali

Differential Revision: D13405817

fbshipit-source-id: 0179d10a88a2d19f1db5ea35b48cb83d9d7429a6
2018-12-11 03:28:04 -08:00
Salakar 794d2264f9 Allow 'userInfo' for native promise.reject + add native error stack support (#20940)
Summary:
As mentioned [here](https://github.com/react-native-community/react-native-releases/issues/34#issuecomment-417718601), Android is missing native Promise reject with a `userInfo` `WritableMap` support and also `nativeStack` support (which addresses `TODO(8850038)`). This PR adds Android support for both of these.

React Native on iOS ([here](https://github.com/facebook/react-native/blob/master/React/Base/RCTUtils.m#L433)) and Windows ([here](https://github.com/Microsoft/react-native-windows/pull/732)) already support this so this is a relatively minor addition to bring Android in line with the other platforms. (JS support is also [here](https://github.com/facebook/react-native/blob/master/Libraries/BatchedBridge/NativeModules.js#L145-L148))

Existing methods remain unchanged other than general cleanup of variable names (`e -> throwable`) and adding code comments/docs.

Additionally, the `ShareTestModule` implementation of Promise (SimplePromise) was updated to reflect these changes - other line changes in this file are from formatting in Android Studio - if this is an issue let me know.

 - Currently inconsistent with other platforms.
 - Blocking a couple of issues over at [invertase/react-native-firebase](https://github.com/invertase/react-native-firebase) - save for re-writing everything to Promise resolve only - which is no small change and isn't a great solution either.
Pull Request resolved: https://github.com/facebook/react-native/pull/20940

Differential Revision: D13412527

Pulled By: cpojer

fbshipit-source-id: 2ca6c5f3db9ff2c2986b02edda80bc73432f66d3
2018-12-10 21:15:55 -08:00
Christoph Nakazawa 63a6bb7637 Remove remaining references to local-cli
Summary: This removes the remaining references to `local-cli`. We already have a `cli.js` file on the root that was just forwarding to the local-cli folder, so I removed that. It also seems that `setupBabel.js` is no longer necessary in RN.

Reviewed By: TheSavior

Differential Revision: D13396218

fbshipit-source-id: a945cb91dae39c4b58c5cabcca6b0f0328fc4717
2018-12-10 19:08:10 -08:00
Elliott Sprehn 167d7861cb Don't crash on second resolve or reject in PromiseImpl. (#20303)
Summary:
Promise semantics per JS should allow calling resolve or reject repeatedly without crashing. Only the first one should do anything, but others should be allowed. This change fixes the Java bridge for Android. A separate change is needed for iOS.

Issue #20262
Pull Request resolved: https://github.com/facebook/react-native/pull/20303

Differential Revision: D13396975

Pulled By: cpojer

fbshipit-source-id: 81f14f73654fa7c44e043f574a39fda481ace44b
2018-12-10 05:56:22 -08:00
David Aurelio 90f582ffb9 Back out Stack D13119110..D13236159
Summary: backout, causes failures

Reviewed By: adityasharat

Differential Revision: D13376210

fbshipit-source-id: 1fa8823f2dce601c47738f34ddb2674288197e79
2018-12-07 13:01:28 -08:00
David Vacca 69c8aa64e5 Fix NPE when opening Google Search Assist when a RN Dialog is displayed
Summary:
This fixes app crashes on opening android search assistant when a RN modal is visible. The root cause is that ViewGroup.dispatchProvideStructure() method uses the private variable 'mChildren' to access the children of a view group instead of the publicApi.

This fixes the top crash for the react_MarketplaceProductDetailsNonIPadRoute route.

This also fixes github issues:
https://github.com/facebook/react-native/issues/15932
https://github.com/facebook/react-native/issues/13201
https://github.com/facebook/react-native/issues/15440

that were closed without a fix

Reviewed By: PeteTheHeat

Differential Revision: D13375993

fbshipit-source-id: d603cb4ef65a423c63a6ef2b51235702c7dbffcb
2018-12-07 09:55:40 -08:00
Lea Bärtschi cbe7d41f3f Remove trailing slash from origin header if no port is specified (#22290)
Summary:
Fixes #16304

The standard format for origin HTTP headers does not allow a trailing slash. In order to not get warnings when connecting a websocket, I removed the trailing slash when generating the default origin HTTP header for the websocket connect request.

Release Notes:
----------
[Android] [Fixed] - Fixed default origin header for websocket connections to match the standard format (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) in WebSocketModule
Pull Request resolved: https://github.com/facebook/react-native/pull/22290

Differential Revision: D13374345

Pulled By: cpojer

fbshipit-source-id: 1173241f2b6912fd6df5e196053a950bb42ff01b
2018-12-06 21:36:19 -08:00
ferrannp e8a6cb5e18 Android: Adding sendIntent on Linking module (#22302)
Summary:
This PR implements "Add a standardized way to send intents on Android" discussed in https://github.com/react-native-community/discussions-and-proposals/issues/34.
Pull Request resolved: https://github.com/facebook/react-native/pull/22302

Differential Revision: D13374186

Pulled By: cpojer

fbshipit-source-id: 2f0b9b9f46e99f382b6c35b1914e75df23a7fd74
2018-12-06 21:13:58 -08:00
David Aurelio 57a38263bf Roll back `-ffast-math`
Summary:
@public

`-ffast-math` does not have measurable performance benefits.

By using `NaN` for *undefined* values again, we can squeeze `YGFloatOptional` into 32 bits.
This will also enable us to store `YGValue` (or a variant of it) in 32 bits.

Reviewed By: SidharthGuglani

Differential Revision: D13119110

fbshipit-source-id: 4e6964240bf74ebc22d8783107b89d536a1a0842
2018-12-06 07:38:43 -08:00
David Vacca 844e11967d Fix dispatch of OnLayout event for first render
Summary: This diff ensures that Events delivered from the C++ side are actually processed. This is done forcing the execution of AsyncEventBeat.beat() in these cases

Reviewed By: shergin

Differential Revision: D13313955

fbshipit-source-id: b2785647913a640c2d557f4fa08d447845a540e9
2018-12-05 18:00:39 -08:00
Max Sherman 1fe947d956 Record thread cpu time for native modules thread
Summary: I want the same instrumentation we did for the JS thread for the NM thread.  This diff adds thread cpu time.

Reviewed By: alexeylang

Differential Revision: D13328876

fbshipit-source-id: 7b310956c52907ffbd881f864e1f8e774853d7f5
2018-12-05 12:43:17 -08:00
Dulmandakh 9d00d4d5bb Bump Android SDK to 28, Build Tools to 28.0.2, Gradle to 4.7, Gradle Plugin to 3.2.0 (#21632)
Summary:
This PR is bumping compileSdkVersion to 28, buildToolsVersion to 28.0.2, Gradle to 4.7, Android Gradle plugin to 3.2.0.

Gradle 4.7 added support for Java 10 and 11.

allow-large-files

Release Notes:
--------------
[ANDROID] [ENHANCEMENT] [SDK] - bump to 28

Pull Request resolved: https://github.com/facebook/react-native/pull/21632

Reviewed By: mdvacca

Differential Revision: D13084836

Pulled By: hramos

fbshipit-source-id: e0f493881e80e87faf8c3ef1ac77044495966a49
2018-12-05 09:06:31 -08:00
Max Sherman 2330843fa7 Add API for instrumentation to learn the starting wall time of bg threads
Summary: Computing things like "page faults since this thread was created" or "cpu time spent on this thread since it was created" is pretty easy - just measure it when you want it.  However, if you want to know "how much wall time has elapsed since this thread was created" you need to record some timing info when the thread is created.  This diff adds a an API for querying that from the RN thread holder abstraction.

Reviewed By: alexeylang

Differential Revision: D13246235

fbshipit-source-id: d36af61dbe27f662980fe508b2644e9d5255bb7e
2018-12-03 11:50:36 -08:00
David Vacca 0f3be77b7d fix possible NPE in StatusBarModule
Summary:
This diff fixes a NPE happening in StatusBarModule when the style passed by parameter is null.
Even if JS shoulnd't send a null value, this method should not crash with an NPE. I'm not changing behavior, only avoiding NPE when status is null

Reviewed By: RSNara

Differential Revision: D13287057

fbshipit-source-id: cc5ac4e97083d63f2bf65c03bac0dc9bce976423
2018-11-30 19:29:48 -08:00
Emily Janzer a2ead1c7b5 Decouple JSBundleLoader from CatalystInstanceImpl
Summary: Right now JSBundleLoader is tightly coupled to CatalystInstanceImpl; this diffs adds an interface, JSBundleLoaderDelegate, that CatalystInstanceImpl implements so that we can use the bundle loader with other classes.

Reviewed By: mdvacca

Differential Revision: D13216752

fbshipit-source-id: fc406ef30f12ed9d3ed13a062dedd7b33f3b7985
2018-11-30 16:51:26 -08:00
Ram N fe97458b03 Add more information in ending Marker Tags
Summary: Added more information to ending tags so that they can be connected with the starting tags.

Reviewed By: mdvacca

Differential Revision: D7121038

fbshipit-source-id: 72d51952955e22a4c8d66c4f9e75a3fd9d34df7f
2018-11-30 11:30:58 -08:00
David Aurelio ea734dcfbf Adjust yearless format for MIT license
Summary:
@public

Adjust license headers throughout the project

Reviewed By: SidharthGuglani

Differential Revision: D13255691

fbshipit-source-id: 98be2aa372a94e7a54a65e3d64e5c6a436b18083
2018-11-29 11:37:51 -08:00
Panagiotis Vekris ef2084c6bd 0.87.0 in xplat/js
Summary: allow-large-files

Reviewed By: samwgoldman

Differential Revision: D13230018

fbshipit-source-id: f07e2371a3b7382de0592cc7c7b20e7f4faa6889
2018-11-28 17:32:50 -08:00
Alexandre Kirszenberg e81adb99f3 DeltaClient: split DeltaBundle's modules into added and modified
Summary:
The reasoning behind this change is that right now, having both added and modified modules inside of a single `modules` field doesn't allow for basic operations like combining two deltas.

For instance, say I have three different bundle revisions: A, B and C.

Module 42 was added in B, and then removed in C.

A->B = `{modules: [42, "..."], deleted: []}`
B->C = `{modules: [], deleted: [42]}`
A->C = `{modules: [], deleted: []}`

However, were we to compute A->C as the combination of A->B and B->C, it would result in `{modules: [], deleted: [42]}` because we have no way of knowing that module 42 was only just added in B.

This means that the `deleted` field of delta X->Y might eventually contain module ids that were never present in revision X, because they were added and then removed between revisions X and Y.

The last time I changed the delta format, we had a few bug reports pop out from people who had desync issues between their version of React Native and their version of Metro. As such, I've tried to make this change backwards compatible in at least one direction (new RN, old Metro). However, this will still break if someone is using a newer version of Metro and an older version of RN. I created T37123645 to follow up on this.

Reviewed By: rafeca, fromcelticpark

Differential Revision: D13156514

fbshipit-source-id: 4a4ee3b6cc0cdff5dca7368a46d7bf663769e281
2018-11-28 02:50:56 -08:00
Adam Ernst 7030d95988 Fix unmangled visibility in rn_defs
Summary: The wrappers exposed by `rn_defs.bzl` should mangle visibility to include the cell.

Reviewed By: scottrice

Differential Revision: D13219109

fbshipit-source-id: ded17e79a1d388d6b76fbdf2ab0d75e586092fcd
2018-11-27 13:46:24 -08:00
David Vacca 00681c3660 Fix TouchEvents on text after state changes
Summary:
This diff fixes a bug that produces TouchEvents on text to stop working after a react state has happened.
An easy way to reproduce this is opening a YellowBox, minimizing it and trying to open it again

Reviewed By: shergin

Differential Revision: D13198663

fbshipit-source-id: 19b08818bbff8014ab8227b3db1119edc4193389
2018-11-27 11:51:12 -08:00
Krzysztof Sroka d3f3bfa2a5 Added `persistentScrollbar` prop in ScrollView component (#22300)
Summary:
This PR is a follow-up from the closed [discussions-and-proposals PR](https://github.com/react-native-community/discussions-and-proposals/pull/39), that explains in more detail the rationale for adding this feature.
Pull Request resolved: https://github.com/facebook/react-native/pull/22300

Reviewed By: fkgozali

Differential Revision: D13121748

Pulled By: mdvacca

fbshipit-source-id: 899641be79bdb41fa6649df0772c602a5e09b3b9
2018-11-27 11:21:54 -08:00
Nicolas Gallagher fd78eee11b Fix text alpha bug
Summary: Set the default text radius to 0 so that text shadows aren't applied to every text node

Reviewed By: mdvacca

Differential Revision: D13027589

fbshipit-source-id: 4f7386059ac1654b8f77dddf9eb1b772f6049e23
2018-11-26 17:24:43 -08:00
Taras Tsugrii fed8b39c3f Sort build file loads.
Reviewed By: yungsters

Differential Revision: D13176340

fbshipit-source-id: 0942970770866c2f2280f746b2c4c592ff0c383c
2018-11-26 09:05:39 -08:00
Christoph Nakazawa 2de01cb54d Inline `extractSingleTouch` from fbjs
Summary: There is only a single use of this function across RN, and one more use in a test file. I inlined this function in both places to reduce the dependency on fbjs.

Reviewed By: yungsters

Differential Revision: D13138137

fbshipit-source-id: 32660c965a975d17e236bdd13ff0b2a8d64751ee
2018-11-26 06:28:25 -08:00
David Vacca 89f647d521 Redefine hashcode for AttributedString
Summary:
This diff changes the method to calculate the hash of an AttributedString (removing shadowNode and parentShadowNode from it).
This is necessary becuase otherwise hashcode of clonned parent keep changing in every state change, when the text doesnt change

With this change we are able to cache spannables in android properly

Reviewed By: shergin

Differential Revision: D13189110

fbshipit-source-id: c1f7372809ce98a5b4d091485cc15281a4ab5e1e
2018-11-25 17:21:00 -08:00
David Vacca f341795824 Add caching of spannable text objects
Summary: This diff adds support to cache the Spannable objects that are created during measure() and updateLocalData() for text

Reviewed By: shergin

Differential Revision: D13188599

fbshipit-source-id: 6547d8ce2bb8b1dfb3c91e64facff3ba0cd97472
2018-11-25 17:21:00 -08:00
David Vacca 5be17c01a1 Fix re-measure of text
Summary: This diff fixes re-measures of a text component result of a change of state. For details of the bug see: T36838266

Reviewed By: shergin

Differential Revision: D13188601

fbshipit-source-id: ea9a889540f600d4e4e788105d5fa22e6cd5448c
2018-11-25 17:20:59 -08:00
David Vacca 10ce6c3e11 Refactor types used during yoga meassure calls
Summary: This diff refactors the types used when Yoga requires to measure the size of a View in C++

Reviewed By: shergin

Differential Revision: D13124086

fbshipit-source-id: 89dfe80bb41b4fb2eaba84af630d52ef2509b1e1
2018-11-25 17:20:59 -08:00
David Vacca 0357d0de64 Ensure thread safety in the exeuction of RuntimeExecutor
Summary: This diff ensures thread safety for operations invoked by the runtime executor

Reviewed By: shergin

Differential Revision: D13136340

fbshipit-source-id: 119092dff29b37f39d4bcdcc34f1c34d638b7e07
2018-11-25 17:20:59 -08:00
Nick Novitski 4514041b44 - Resolve two gradle deprecation warnings (#22360)
Summary:
> Configure project :ReactAndroid
> The Task.leftShift(Closure) method has been deprecated. This is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

> Task :ReactAndroid:buildReactNdkLib
> A problem was found with the configuration of task ':ReactAndroid:buildReactNdkLib'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
> - File '[...]/react-native/ReactAndroid/src/main/jni/react' specified for property '$1' is not a file.
Pull Request resolved: https://github.com/facebook/react-native/pull/22360

Differential Revision: D13176269

Pulled By: hramos

fbshipit-source-id: cf6d498049b955d3920d356f2d68f3bc43008c56
2018-11-22 18:36:59 -08:00
David Aurelio 64d162e7c6 Dealloc JNI implementation experiment
Summary:
@public

Remove ability to configure Yoga to run with/without JNI fast calls on dalvik / art.
This switches to always run with fast calls.

Reviewed By: astreet

Differential Revision: D13144652

fbshipit-source-id: 091aab0cd1290d46346323d3e26a11dd0bb17187
2018-11-22 04:01:21 -08:00
Amir Shalem 3337a1db55 Add getUndefined() method to obtain the undefined value
Summary:
Add getUndefined() method to obtain the undefined value.
This would allow to obtain the Yoga undefined value in runtime, and not just in compile time

Reviewed By: davidaurelio

Differential Revision: D13136972

fbshipit-source-id: aa198aa1ea65bb6b7302abeba6f9f5d483a45ff3
2018-11-22 02:35:36 -08:00
Kudo Chien 0a293a014b Fix ReactAndroid build break. (#22377)
Summary:
During C++ build, we need the libjsc.so.
  But arm64-v8a and x86_64 libjsc.so are in different path and this error raised:

    Android NDK: ERROR:/home/circleci/react-native/ReactAndroid/build/third-party-ndk/jsc/Android.mk:jsc: LOCAL_SRC_FILES points to a missing file
    /opt/ndk/android-ndk-r17c/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.
    Android NDK: Check that /home/circleci/react-native/ReactAndroid/build/third-party-ndk/jsc/jni/arm64-v8a/libjsc.so exists  or that its path is correct

  The commit moves prebuilt libjsc.so into
  ReactAndroid/src/main/jni/third-party/jsc/jni and let ndkbuild script find the prebuilt libjsc.so.
  For AAR packaging, modify the jniLibs so that gradle android library plugin could find the prebuilt libjsc.so as well.
Pull Request resolved: https://github.com/facebook/react-native/pull/22377

Differential Revision: D13166556

Pulled By: hramos

fbshipit-source-id: 61daaede7defbc66491a3e2f20058e7d248ba13e
2018-11-21 21:34:36 -08:00
gengjiawen f22473e9e9 Fix jsc regression.Fixes #22274 (#22293)
Summary:
My silly mistake when tinkering with the jsc lib. Also you have this patch first https://github.com/facebook/react-native/pull/22295.
Kudo plz review.

![image](https://user-images.githubusercontent.com/3759816/48561684-758f6f00-e92b-11e8-905b-e394f72349f7.png)
Pull Request resolved: https://github.com/facebook/react-native/pull/22293

Differential Revision: D13153931

Pulled By: hramos

fbshipit-source-id: 8a6efa0cd8abbff359f082d5ea7713933b6e7ac6
2018-11-21 14:36:33 -08:00
David Vacca 7b2030bcea Fix padding for Text Views in Fabric
Summary: This diff extends Text View to support not only paddingLeft, paddingRight, etc but also padding props.

Reviewed By: shergin

Differential Revision: D13111433

fbshipit-source-id: 3b0efe8468f20a5ffaf31e3f1f180e96a5409865
2018-11-17 02:27:20 -08:00
David Vacca 8367fa9644 Implement layout constraint when measuring text
Summary: This diff adds support for layout constraint when measuring text

Reviewed By: shergin

Differential Revision: D13111434

fbshipit-source-id: 0c8689e9ac8ce2281b03386f275d2a8e034f88d8
2018-11-17 02:27:20 -08:00
David Vacca d3a7325abd Fix scrolling with multiple fingers in RN Fabric scrollView
Summary: Scrolling with multiple fingers produced a redbox in Fabric

Reviewed By: shergin

Differential Revision: D13108544

fbshipit-source-id: 7b70b3f55f325448191adc48c782f2014b502ad6
2018-11-17 02:27:19 -08:00
David Vacca 74f6575f35 Cleanup old Fabric methods from ReactShadowNodeImpl
Summary: These methods and variables were used by Android implementation of Fabric, these are not used anymore.

Reviewed By: shergin

Differential Revision: D13108547

fbshipit-source-id: d169eb58ba20f3bfe117a124f0494ff3a4fb5dce
2018-11-17 02:27:19 -08:00
Andrew Chen (Eng) 17ced5701f Add test for WritableNativeMap
Summary: A simple test for WritableNativeMap. Also includes a test to verify that the key name exists in the error message if a dynamic cast exception occurs (this will be implemented in the future)

Reviewed By: mdvacca

Differential Revision: D12914375

fbshipit-source-id: 654674b1b32e7b3f38cc1364a2302d1ce08ec33e
2018-11-16 18:44:35 -08:00
Dulmandakh 673ef39561 resizeMode applies to Image.defaultSource (#22216)
Summary:
resizeMode applies to Image.defaultSource, because depending on screen resolution sometimes we see padding around defaultSource image while source loading. Now we can control scale of both source and defaultSource.

Changelog:
----------
[Android] [Fixed] - Image.resizeMode will apply to defaultSource, enhanced user experience. Previously, resizeMode didn't applied to defaultSource, therefore depending on screen resolution sometimes we see padding around defaultSource image while source loading.
Pull Request resolved: https://github.com/facebook/react-native/pull/22216

Differential Revision: D13088220

Pulled By: mdvacca

fbshipit-source-id: 92c66cf6228f3b7666b9ef2404d034f0005b5234
2018-11-15 20:37:16 -08:00
gengjiawen 5939d078a0 Fix compatibility issue for android 16 device.Fixes #22294 (#22295)
Summary:
Fix compatibility issue for android 16 device. Related issue https://github.com/facebook/react-native/pull/22295.
pass all current ci.
none
 [GENERAL] [ANDROID] [Fixed] - Fix compatibility issue for android 16 device
Pull Request resolved: https://github.com/facebook/react-native/pull/22295

Differential Revision: D13084152

Pulled By: hramos

fbshipit-source-id: 42459ddc6f84f870affdda5ba19bcd8bb27b56d7
2018-11-15 09:58:13 -08:00
David Aurelio 619de16661 Back to yearless format for MIT license
Summary:
@public

Restores the yearless format of the MIT license.

Reviewed By: SidharthGuglani

Differential Revision: D13082510

fbshipit-source-id: f5a849b06652cedf68547d4a7963398b2627915f
2018-11-15 08:24:57 -08:00
Igor Mandrigin b971c5beb8 Workaround a wrong fling direction for inverted ScrollViews on Android P (#21117)
Summary:
This is a safe workaround to an issue in Android P: https://issuetracker.google.com/issues/112385925

It is based on a fact that even though `fling` receive a wrong sign in `velocityY`, `mOnScrollDispatchHelper.getYFlingVelocity()` still returns a fling direction.

Fixes #19434
Pull Request resolved: https://github.com/facebook/react-native/pull/21117

Differential Revision: D13082740

Pulled By: hramos

fbshipit-source-id: 1b28586d2c7bdcae4a111d3cead4a0455cebb99a
2018-11-15 07:19:09 -08:00
Andrew Chen (Eng) b649fa96a0 Fix crash when removing root nodes
Summary: If a root node is being removed and has an id of NO_ID, it was likely already removed previously, likely due to a race condition caused by RN's async nature. In those cases, let's avoid crashing the app and instead silently ignore the root view removal.

Reviewed By: mdvacca

Differential Revision: D13055140

fbshipit-source-id: ec10f4c79f2ba21614f52f57557f6b3d734c9461
2018-11-14 10:57:02 -08:00
Andrew Chen (Eng) 83405ff316 Fix crash when releasing RN views
Summary: There are cases where we're trying to drop a view that is not associated with a ViewManager. This is likely caused by race conditions that can occur if we're dropping a view from JS (when it's no longer used) but at the same time dropping it from native (when layout animation ends, when the rootview gets unmounted). In either of those cases, it should be safe to ignore the drop operation because the view was likely dropped already.

Reviewed By: mdvacca

Differential Revision: D13036643

fbshipit-source-id: 260ffb56d32a0d670ad08f449b8df165b2533195
2018-11-14 10:51:15 -08:00
Taras Tsugrii 9b781bdda8 Remove unused loads from xplat.
Summary:
Unused loads still take time to process and pollute
execution environment.

drop-conflicts

Reviewed By: passy

Differential Revision: D13054018

fbshipit-source-id: a8fe58d1c55c031925c2c0267e24e67f021cd91d
2018-11-14 10:51:15 -08:00
Sidharth Guglani 6eb5bd381c added functionality using which child node can tell parent node to use it as a reference baseline
Summary:
@public
Currently only parent can tell the layout to align its children based on baseline. But if one of the children is a column or row then basealign does not work as expected.

We have added an api setReferenceBaseline which when set to true would mean that it's baseline would be considered as the reference baseline for parent amongst its siblings. If there are more than one siblings with referenceBaseline set, the first one would be considered.

Reviewed By: davidaurelio

Differential Revision: D12883323

fbshipit-source-id: 19beccfc47d98bb38f81f5b66ba764e83680f821
2018-11-14 02:51:34 -08:00
Eric Butler a508134724 Fixed HTTP connection timeout on Android (#22164)
Summary:
Fixes #11666 (Which was incorrectly closed)
Pull Request resolved: https://github.com/facebook/react-native/pull/22164

Differential Revision: D13057001

Pulled By: hramos

fbshipit-source-id: bcd53e893bc7c114f866e54938166b74b8ae0299
2018-11-14 00:43:35 -08:00
Ranjan Shrestha 2e465bca15 Android: Close websocket properly when remote server initiates close (#22248)
Summary:
When the remote server closes the websocket, the app doesn't get a 'close' event in Android, There is no issue on iOS.
Pull Request resolved: https://github.com/facebook/react-native/pull/22248

Differential Revision: D13047556

Pulled By: hramos

fbshipit-source-id: c5c56ea8418cfdf734fb51f863b3066856de6512
2018-11-13 23:19:42 -08:00
Ram N 9f9390ddfc Moved androidID constant to a method
Summary:
androidID was a constant that was exposed as a Platform constant, but it seems to use slightly expensive methods when they need to be computed. Moving this to a method so that it is computed only when needed.
Test Plan

Reviewed By: ejanzer

Differential Revision: D6563853

fbshipit-source-id: 3c5929fcbc947c13c3a25f2bf473e145ac4bf73e
2018-11-10 08:54:18 -08:00
Stepan Hruda 2bf0d54f15 Only include ServerHost constant in debug builds
Summary: I recently changed the implementation of `getServerHost` to be more expensive. I am excluding it from constants in non-debug builds, since loading that module lies on a critical path.

Reviewed By: axe-fb

Differential Revision: D12982150

fbshipit-source-id: eaaa50418726dbb2da2d517d0810f39b0dc7fac2
2018-11-09 17:03:02 -08:00
Andrew Chen (Eng) be282b5287 Fix ReactRootView attachRootView race condition
Summary:
Yet another issue with mAttachedRootViews. Every time attachRootView is called, the root view's id is reset to NO_ID. However, there can be a case where the react context has not initialized yet, so we delay attaching the root view to the instance manager until setupReactContext. If attachRootView was called a second time before the react context has finished initializing, we end up in a situation where we try to attach the same root view twice

I'm planning to remove mAttachedRootViews all together in a future diff, but for now let's avoid these crashes.

Reviewed By: mmmulani

Differential Revision: D12835167

fbshipit-source-id: ebef3fadc5f9f467eebb3b5644c685acc5ea10bf
2018-11-09 16:08:05 -08:00
Ram N d4aef08af9 Add a marker to indicate when JS thread priority is lowered
Summary:
When RN starts up, it lowers the default priority of the JS thread. This diff sets a point to see when the JS thread priority is lowered.

In subsequent diffs, we will be able to use this marker to play around with bumping the priority of the JS thread till TTI is done.

Reviewed By: alexeylang

Differential Revision: D8965457

fbshipit-source-id: 87cb1e3d3b370af183f388c411fd9a87a6cba250
2018-11-09 14:24:57 -08:00
Andrew Chen (Eng) df7e8c64ff Fix ReactInstanceManager deadlock
Summary:
D12829677 introduced a deadlock where onHostResume holds the lock on `moveToResumedLifecycleState()` then waits for the `mReactContext` lock, but at the same time setupReactContext holds the `mReactContext` lock and waits for `moveToResumedLifecycleState()` https://our.intern.facebook.com/intern/everpaste/?handle=GAgXFgLQH1ZlQikBAMQzo2LZ6h9TbiAxAAAz. The purpose of the previous diff was to make sure that detachRootoView and
setupReactContext did not interfere with each other, and implemented that by blocking on mReactContext. Since this overloads the usage of mReactContext, let's use a different lock `mAttachedRootViews` to implement this behavior instead

Reviewed By: mdvacca

Differential Revision: D12989555

fbshipit-source-id: c12e5fd9c5fa4c2037167e9400dc0c1578e38959
2018-11-09 13:43:17 -08:00
David Vacca fba7c1ece2 Add copyright header into ContextUtils class
Summary: Trivial diff to include copyright header into ContextUtils class

Reviewed By: achen1

Differential Revision: D13001556

fbshipit-source-id: 439f25647a094485381637ea2b59f62962b9c1ac
2018-11-09 11:21:26 -08:00
Ram N 803e993e6a Use static constants instead of strings when referring to View Managers and Native Modules
Summary: Using strings to refer to Native Modules and View Managers in ReactPackages are prone to error. The compiler replaces the constants with the actual strings anyway, so using constants gives us  better type safety

Reviewed By: achen1

Differential Revision: D12843649

fbshipit-source-id: 7a7c6c854c8689193f40df92dc8426a3b37f82c8
2018-11-09 10:50:54 -08:00
Chris Tolliday 918a7d5b70 Turn off static linking for cxxreact:bridge
Summary: Remove `force_static=true` from cxxreact:bridge, add dependencies to targets that were pulling them in from a statically linked cxxreact:bridge.

Reviewed By: mhorowitz

Differential Revision: D12914861

fbshipit-source-id: ff335b70e80d014538a8d5dc8c0bb7b095e7940e
2018-11-08 22:33:37 -08:00