Commit Graph

2539 Commits

Author SHA1 Message Date
David Vacca 49655c6eb3 Fix BadtokenException thrown when opening Android Catalyst app
Reviewed By: achen1

Differential Revision: D7676053

fbshipit-source-id: e0cf9541de131b7c21de9a2647e4270f78b0a107
2018-04-18 18:17:46 -07:00
Andrew Chen (Eng) 4fcd9970bd Fix crash when reloading with Perf Monitor enabled
Reviewed By: mdvacca

Differential Revision: D7678392

fbshipit-source-id: 5fcf3bda545896f48543a95d4885c6492fac961e
2018-04-18 18:17:46 -07:00
Andrew Chen (Eng) 2ad0a92d38 Fix OSS Fabric test build
Reviewed By: fkgozali

Differential Revision: D7676633

fbshipit-source-id: a7db945395af10d06dddc1fde4bd035aee14b702
2018-04-18 15:04:53 -07:00
Andrew Chen (Eng) af20958425 Use real YogaNodes in FabricReconcilerTest
Reviewed By: mdvacca

Differential Revision: D7664493

fbshipit-source-id: 74b088a91ea4f691cc15b5ea15dd585fe46e2035
2018-04-18 15:04:53 -07:00
Pascal Hartig aa6239301a Add getParent() method for easier migration
Reviewed By: emilsjolander

Differential Revision: D7654526

fbshipit-source-id: efe44807caa97f495c5e5691dedcf281760fa23e
2018-04-18 04:32:34 -07:00
Andrew Chen (Eng) 864cc00a61 Use real YogaNodes in FabricUIManagerTest
Reviewed By: mdvacca

Differential Revision: D7663769

fbshipit-source-id: 78cdde975037c4e8d97d4bd21ddd7927cc105dd0
2018-04-17 18:12:23 -07:00
Andrew Chen (Eng) ff9b3c6517 Display JS component stack in native view exceptions
Reviewed By: mdvacca

Differential Revision: D7578033

fbshipit-source-id: 4dc393cddf8487db58cc3a9fefbff220983ba9da
2018-04-17 17:47:38 -07:00
Andrew Chen (Eng) c10c6dbf7c Move Fabric tests to OSS
Reviewed By: mdvacca

Differential Revision: D7654802

fbshipit-source-id: a30c8cf062636243066a1fc73da0711442a29c76
2018-04-17 14:26:48 -07:00
Himabindu Gadupudi 4469952c9a Pass drawable width and height in pixels for inline image
Reviewed By: achen1

Differential Revision: D7655775

fbshipit-source-id: 32887eb5a686ccc45f50fb334248aad6889f704a
2018-04-17 13:44:24 -07:00
shockdesign 7c5d581d78 Switch equality check in BlobModule.java
Summary:
Switch the equality check to avoid crash on the first item. The check can be on a null object and return the correct result.

Fixes #18709

Just a simple switch on equals, to make sure we're not bombing out by having a null scheme.

No related PRs and does not require a document change.

[ANDROID][BUGFIX][BlobModule] Switch equality check in BlobModule.java
Closes https://github.com/facebook/react-native/pull/18893

Differential Revision: D7658036

Pulled By: hramos

fbshipit-source-id: db61b98dae178dbbb645070f7b0d73ab43d30541
2018-04-17 13:26:35 -07:00
Andrew Chen (Eng) e4f88c66e3 Revert D7569885: Fix anti aliasing rounded background
Differential Revision:
D7569885

Original commit changeset: 4bfb00485211

fbshipit-source-id: 2fc76ca8615d5562ebe8c7527e9a54058b8d82dc
2018-04-17 10:36:54 -07:00
Andrew Chen (Eng) eff98b6c25 Better error message for invalid native module
Reviewed By: mdvacca

Differential Revision: D7641828

fbshipit-source-id: b1500029da49b60b6a69bc61ecc7f72629f65dcb
2018-04-16 16:37:36 -07:00
Leo Nikkilä d8fcdb9bd7 Fix view indices with Android LayoutAnimation
Summary:
Fixes issue #11828 that causes layout animations for removed views to
remove some adjacent views as well. This happens because the animated
views are still present in the ViewGroup, which throws off subsequent
operations that rely on view indices having updated.

This issue was addressed in #11962, which was closed in favour of a more
reliable solution that addresses the issue globally since it’s difficult
to account for animated views everywhere. janicduplessis [recommended][0]
handling the issue through ViewManager.

Since API 11, Android provides `ViewGroup#startViewTransition(View)`
that can be used to keep child views visible even if they have been
removed from the group. ViewGroup keeps an array of these views, which
is only used for drawing. Methods such as `ViewGroup#getChildCount()`
and `ViewGroup#getChildAt(int)` will ignore them.

I believe relying on these framework methods within ViewManager is the
most reliable way to solve this issue because it also works if callers
ignore ViewManager and reach into the native view indices and counts
directly.

[0]: https://github.com/facebook/react-native/pull/11962#pullrequestreview-21862640

I wrote a minimal test app that you can find here:

<https://gist.github.com/lnikkila/87f3825442a5773f17ead433a810d53f>

The expected result is that the red and green squares disappear, a blue
one appears, and the black one stays in place. iOS has this behaviour,
but Android removes the black square as well.

We can see the bug with some breakpoint logging.

Without LayoutAnimation:

```
    NativeViewHierarchyOptimizer: Removing node from parent with tag 2 at index 0
    NativeViewHierarchyOptimizer: Removing node from parent with tag 4 at index 1
    NativeViewHierarchyManager: Removing indices [0] with tags [2]
    RootViewManager: Removing child view at index 0 with tag 2
    NativeViewHierarchyManager: Removing indices [1] with tags [4]
    RootViewManager: Removing child view at index 1 with tag 4
```

With LayoutAnimation tag 3 gets removed when it shouldn’t be:

```
    NativeViewHierarchyOptimizer: Removing node from parent with tag 2 at index 0
    NativeViewHierarchyOptimizer: Removing node from parent with tag 4 at index 1
    NativeViewHierarchyManager: Removing indices [0] with tags [2]
    NativeViewHierarchyManager: Removing indices [1] with tags [4]
->  RootViewManager: Removing child view at index 1 with tag 3
    RootViewManager: Removing child view at index 2 with tag 4

    (Animation listener kicks in here)

    RootViewManager: Removing child view at index 1 with tag 2
```

Here are some GIFs to compare, click to expand:

<details>
  <summary><b>Current master (iOS vs Android)</b></summary>
  <p></p>
  <img src="https://user-images.githubusercontent.com/1291143/38695083-fbc29cd4-3e93-11e8-9150-9b8ea75b87aa.gif" height="400" /><img src="https://user-images.githubusercontent.com/1291143/38695108-06eb73a6-3e94-11e8-867a-b95d7f926ccd.gif" height="400" />
</details><p></p>

<details>
  <summary><b>With this patch (iOS vs Android, fixed)</b></summary>
  <p></p>
  <img src="https://user-images.githubusercontent.com/1291143/38695083-fbc29cd4-3e93-11e8-9150-9b8ea75b87aa.gif" height="400" /><img src="https://user-images.githubusercontent.com/1291143/38695137-1090f782-3e94-11e8-94c8-ce33a5d7ebdb.gif" height="400" />
</details><p></p>

Previously addressed in #11962, which wasn’t merged.

Tangentially related to my other LayoutAnimation PR #18651.

No documentation changes needed.

[ANDROID] [BUGFIX] [LayoutAnimation] - Removal LayoutAnimations no longer remove adjacent views as well in certain cases.
Closes https://github.com/facebook/react-native/pull/18830

Reviewed By: achen1

Differential Revision: D7612904

Pulled By: mdvacca

fbshipit-source-id: a04cf47ab80e0e813fa043125b1f907e212b1ad4
2018-04-16 14:39:19 -07:00
David Vacca 660a578aeb Fix cloning for ReactTextInputShadowNode
Reviewed By: shergin

Differential Revision: D7628252

fbshipit-source-id: 034f2d619f716600dde21a5dd43538c261be773b
2018-04-16 14:01:49 -07:00
Andrew Chen (Eng) 311a7a8e82 Use the provided NativeModuleCallExceptionHandler if provided
Summary:
Before, any calls to ReactContext would either use the default DevSupportManager's exception handler in debug mode OR throw exceptions immediately in non debug mode. In order to intercept these kinds of native exceptions, we should reuse the NativeModuleCallExceptionHandler provided by the ReactInstanceManager. For those who don't specify a NativeModuleCallExceptionHandler, the resulting behavior remains the same. For those who do specify a NativeModuleCallExceptionHandler,
the main difference is that it will now be responsible for handling exceptions for ReactContext.handleException

Reviewed By: mdvacca

Differential Revision: D7641772

fbshipit-source-id: 8f175df687723fcbb8a7620f90d8a08c94798738
2018-04-16 13:31:56 -07:00
Andrew Chen (Eng) 8102e35271 Fix originalNode memory leak
Reviewed By: mdvacca

Differential Revision: D7608359

fbshipit-source-id: 7cf69f987d4c92202ea5794b76345cb1c685f881
2018-04-16 12:34:37 -07:00
Jakub Grzmiel a42b2988ae Clean up BUCK files for missing dependencies and tests
Differential Revision: D7618360

fbshipit-source-id: 421834892519998ad088a138b3fc3d96afe34d79
2018-04-14 13:18:08 -07:00
Kevin Gozali f569b45f4c OSS: upgrade Folly 2016.09.26 => 2016.10.31
Summary:
There was a fix around folly::dynamic constructor that will be needed for Fabric work. This was done in 94e964976c (diff-7d1cb97d222ba0c863ea8a8e43b2ee2b) and luckily the release 1 month after the Folly version we used in RN already had the fix, so that we don't need to upgrade to the latest folly yet (minimizing breakages).

Tested by:
* running RNTester xcode project (ios)
* running RNTesterPods workspace via cocoapods
* building android via gradle

Reviewed By: shergin

Differential Revision: D7626037

fbshipit-source-id: cb36ba5b91ba131d4e450300bd620db657cfa1e8
2018-04-13 17:33:23 -07:00
Himabindu Gadupudi e8e2a6e410 Add tint color to inline icons
Reviewed By: achen1

Differential Revision: D7625378

fbshipit-source-id: a60cf79f32f2d4091dbddebd65af4880ebb8c2c7
2018-04-13 17:33:23 -07:00
Himabindu Gadupudi 7500b3ec83 Fix anti aliasing rounded background
Reviewed By: shergin, achen1

Differential Revision: D7569885

fbshipit-source-id: 4bfb00485211417b475f14a92fd7b2e52a4b2ff6
2018-04-13 12:45:41 -07:00
Leo Nikkilä f6e2f13f4b Handle layout updates during LayoutAnimation animations on Android
Summary:
On Android, LayoutAnimation directly updates the layout since a generic
scaling animation is more difficult to implement. This causes a problem
if the layout is updated during an animation, as the previous layout is
stored with the animation and is not updated. As a result the view gets
the old layout instead once the animation completes.

This commit fixes this issue by storing the layout handling animations
while those animations are active, and updating the animations on the
fly if one of the views receives a new layout. The resulting behaviour
mirrors what iOS currently does.

This bug has real world consequences, for example if a LayoutAnimation
happens right after a VirtualizedList has mounted, it’s possible that
some list rows are mounted while the animation is active, making the
list content view bigger. If the content view is being animated, the
new size will not take effect and it becomes impossible to scroll to
the end of the list.

I wrote a minimal test case to verify the bug, which I’ve also added to
RNTester. You can find the standalone app here:

<https://gist.github.com/lnikkila/18096c15b2fb99b232795ef59f8fb0cd>

The app creates a 100x300 view that gets animated to 200x300 using
LayoutAnimation. In the middle of that animation, the view’s dimensions
are updated to 300x300.

The expected result (which is currently exhibited by iOS) is that the
view’s dimensions after the animation would be 300x300. On Android the
view keeps the 200x300 dimensions since the animation overrides the
layout update.

The test app could probably be turned into an integration test by
measuring the view through UIManager after the animation, however I
don’t have time to do that right now...

Here are some GIFs to compare, click to expand:

<details>
  <summary><b>Current master (iOS vs Android)</b></summary>
  <p></p>
  <img src="https://user-images.githubusercontent.com/1291143/38191325-f1aeb3d4-3670-11e8-8aca-14e7b24e2946.gif" height="400" /><img src="https://user-images.githubusercontent.com/1291143/38191337-f643fd8c-3670-11e8-9aac-531a32cc0a67.gif" height="400" />
</details><p></p>

<details>
  <summary><b>With this patch (iOS vs Android, fixed)</b></summary>
  <p></p>
  <img src="https://user-images.githubusercontent.com/1291143/38191325-f1aeb3d4-3670-11e8-8aca-14e7b24e2946.gif" height="400" /><img src="https://user-images.githubusercontent.com/1291143/38191355-07f6e972-3671-11e8-8ad2-130d06d0d64d.gif" height="400" />
</details><p></p>

No documentation changes needed.

[ANDROID] [BUGFIX] [LayoutAnimation] - View layout is updated correctly during an ongoing LayoutAnimation, mirroring iOS behaviour.
Closes https://github.com/facebook/react-native/pull/18651

Differential Revision: D7604698

Pulled By: hramos

fbshipit-source-id: 4d114682fd540419b7447e999910e05726f42b39
2018-04-12 14:03:02 -07:00
David Vacca 88139eb6e1 rename unmountComponentAtNodeAndRemoveContainer -> unmountComponentAtNode
Reviewed By: achen1

Differential Revision: D7597730

fbshipit-source-id: d72a138b3fc82b09ab7b871089356d38c8405631
2018-04-12 10:28:18 -07:00
David Vacca fcecc1502a Revert D7473762: [react-native][PR] added in snapAlignment for horizontal android scrollView
Differential Revision:
D7473762

Original commit changeset: ad4778b83f9f

fbshipit-source-id: 90f002ad60d26abd801a7a9d37e71254b063faef
2018-04-11 09:02:20 -07:00
Andrew Kriger 722f88ca90 Adds Android click sound to Touchables
Summary:
Android apps play a touch sound on press, as long as you have "Touch sounds" enabled in the settings. As and Android user, when building my app using React Native, one of the first things I noticed was that there were not any touch sounds. This is missing from React Native and there have been multiple PRs to have this implemented, but no success.

This PR iterates over [#6825](https://github.com/facebook/react-native/pull/6825) and [#11136](https://github.com/facebook/react-native/pull/11136)

This PR keeps it simple by only implementing the enhancement for Android, as iOS apps typically do not use touch sounds, and follows the users' system settings for whether or not the sound is played.

I have manually tested this on multiple devices and emulators with zero problems

[ANDROID] [ENHANCEMENT] [UIManagerModule.java]- Adds Android click sound to touchables

[ANDROID] [ENHANCEMENT] [Touchable] - Adds Android click sound to touchables
Closes https://github.com/facebook/react-native/pull/17183

Differential Revision: D7560327

Pulled By: hramos

fbshipit-source-id: ce1094c437541bc677c7d64b0dba343dd9574422
2018-04-09 17:01:57 -07:00
David Vacca 16bed9e6e5 Support cloning of virtual ReactShadowNodes
Reviewed By: achen1

Differential Revision: D7542648

fbshipit-source-id: 58494db9f8525d4deabc6345f36941fa93a1d887
2018-04-07 00:51:13 -07:00
Liamandrew 3372541a2a Add ability for Animated views to be created with scale X or scale Y
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!

-->

*Accidentally closed previous PR*

Sometimes it can be useful to have an animated view be created with either scale X or scale Y in cases where scaleXY might not be as visually appealing.

Test Plan
Tested on both ios and android in the sample project:

https://github.com/Liamandrew/ScaleAnimationSample

![scaleanimation](https://user-images.githubusercontent.com/30114733/37023697-d0aa7372-217a-11e8-8d3b-2958c63ad83a.gif)
Closes https://github.com/facebook/react-native/pull/18220

Differential Revision: D7542334

Pulled By: hramos

fbshipit-source-id: 208472e5d8f5a04ca3c3a99adce77b035e331ef1
2018-04-06 17:46:54 -07:00
Kevin Gozali 667ca15893 android: don't process touch events too early
Summary: There can be a race when loading JS from rootview for the first time vs touching rootview before JS is ready. This may cause redbox on the JS side.

Reviewed By: mdvacca

Differential Revision: D7531334

fbshipit-source-id: 36ffa1e5ff205f60b95e0a1d1016301ea76936aa
2018-04-06 17:36:20 -07:00
Dulmandakh b0fa3228a7 Implement Image.defaultSource property on Android
Summary:
This pull request implements Image.defaultSource property on Android, using Fresco (http://frescolib.org/docs/placeholder-failure-retry.html), which will show placeholder image (local asset) while loading remote image. Implementation code is almost same with loadingIndicatorSource, but without rotation.

This requires release or production to bundle local images in an APK file.

This provides feature parity with iOS.

Set Image.defaultSource on Android, and will show it while loading Image.source.

```JSX
<Image
  defaultSource={require('<path to image>')}
  source={{uri: '<url to remote image>'}}
  style={{ height: 300, width: 300 }}
/>
```

[ANDROID] [FEATURE] [IMAGE] - Image.defaultSource will show local image as placeholder while loading remote Image.source.
Closes https://github.com/facebook/react-native/pull/18588

Differential Revision: D7540489

Pulled By: himabindugadupudi

fbshipit-source-id: 908ceb659b3416e517bba64c76a31879d965ec09
2018-04-06 16:03:00 -07:00
David Vacca bf7601fde1 Avoid holding references to ReactShadowNode after a tree is commited
Reviewed By: achen1

Differential Revision: D7495721

fbshipit-source-id: 33d5bba5040729f891455a9c330234fe25130b02
2018-04-06 15:17:51 -07:00
David Vacca 9fd2b9a75f Add more logs into FabricUIManager and ReactShadowNodeImpl
Reviewed By: shergin, achen1

Differential Revision: D7495615

fbshipit-source-id: 4227b6648aaff8d9fe59bff1d4f75fd546baae6a
2018-04-06 15:17:50 -07:00
David Vacca 84ae1c9aec Move execution of Yoga.calculateLayout method before diffing algorithm
Reviewed By: shergin

Differential Revision: D7495581

fbshipit-source-id: 63d2f2a66c53727dea7981837d6d0f896bac35d3
2018-04-06 15:17:50 -07:00
David Vacca e21bbee586 Mutate shared ReactShadowNode during Fabric.appendChild
Reviewed By: shergin

Differential Revision: D7495539

fbshipit-source-id: 2b2b06d3d4f02a00b01c7ed27d47b61787ea922f
2018-04-06 15:17:50 -07:00
Andrew Chen (Eng) c2b9be08f8 Thread safe renderComponent
Reviewed By: mdvacca

Differential Revision: D7528307

fbshipit-source-id: 1f22898c17f10b883965b03d5c95bbb3c39209c4
2018-04-06 12:52:03 -07:00
gengjiawen 9b9b6c845e Inline and fix proguard rules
Summary:
The original proguard rules are put in the template, which is not very convenient and easy to get wrong. Because new rules get put, people also has two copy paste the rule. And there are also existing project import react native as a dependency. So the best way to  keep a android library project proguard rule is to manage the rule itself, using `consumerProguardFiles` like [dagger](46baef6d96/butterknife/build.gradle (L9)) and other android library project.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Use RNTester to build the release flavor (now it has bugs https://github.com/facebook/react-native/issues/18460, I keep my change in local for now), after build success, run to check if crash.

In the process, I also fix https://github.com/facebook/react-native/issues/12994 and https://github.com/facebook/react-native/issues/6624 by adding the following to proguard rules
```proguard
-keep,includedescriptorclasses class com.facebook.react.bridge.** { *; }
```

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

[ANDROID] [ENHANCEMENT and BUGFIX] [Proguard rules] - inline and fix proguard rules .

<!--
  **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
-->
Closes https://github.com/facebook/react-native/pull/18461

Differential Revision: D7527533

Pulled By: hramos

fbshipit-source-id: 447dbc16983bcfb597187b40c1be3987a8c5a832
2018-04-05 17:34:53 -07:00
philvasseur 3ed076b65a added in snapAlignment for horizontal android scrollView
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
`snapToAlignment` is available on iOS but not android yet. This PR is to add support for `snapToAlignment` on android as `snapToInterval` was recently added to android and they are very useful together.

Make a `Flatlist` in android with `pagingEnabled`, `horizontal`, `snapToInterval` and `snapToAlignment` set and see how adjusting between the three values of `snapToAlignment` aligns just like it does in iOS.

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [MINOR] [ScrollView] - On Android, **ScrollView** now takes snapToAlignment like iOS

<!--
  **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
-->
Closes https://github.com/facebook/react-native/pull/18648

Differential Revision: D7473762

Pulled By: mdvacca

fbshipit-source-id: ad4778b83f9fd1352455b2ed28a5f37229d9d8c7
2018-04-04 20:57:32 -07:00
Pritesh Nandgaonkar c041c9fd62 clean up experimental setup and keep using ffast-math flag
Reviewed By: emilsjolander

Differential Revision: D7414228

fbshipit-source-id: 320e1b1953f6af867b13e617af7872eb8999160e
2018-04-04 08:31:53 -07:00
David Vacca 8a99241f81 Re-enable Yoga cloning in React Shadow Node
Reviewed By: achen1

Differential Revision: D7435365

fbshipit-source-id: 3e04b3252945112cf0c7206b0e6fb63535499eb9
2018-04-01 18:32:12 -07:00
David Vacca 5be4ff0261 Extend Yoga to be able clone Yoga Node with new children
Reviewed By: emilsjolander

Differential Revision: D7245421

fbshipit-source-id: 72578c8261f29e4a12fc6c72a91f2f891cd58d48
2018-04-01 18:32:12 -07:00
David Vacca 29ff30c539 Rename YogaNode.parent -> YogaNode.owner
Reviewed By: priteshrnandgaonkar

Differential Revision: D7352778

fbshipit-source-id: dcf1af5e72bfc3063b5c4bda197d7952a9194768
2018-04-01 18:32:12 -07:00
David Vacca aff5a75d8e Refactor cloning of YogaNode
Reviewed By: priteshrnandgaonkar

Differential Revision: D7339832

fbshipit-source-id: 2de6f47ae7601ac083d3b9fbe10ffaf6307ae760
2018-04-01 18:32:12 -07:00
David Vacca d58ba8242b Avoid app crashing when a StackOverflowError is thrown when rendering deep RN view hierarcy
Reviewed By: achen1

Differential Revision: D7400906

fbshipit-source-id: faaf701a88440f89390518f00e6a35f19e9203db
2018-03-31 23:37:54 -07:00
Vladislav Pilgasov 4906f8d28c Add an implementation of Animated.subtract
Summary:
Fixes #18451

I've added another example to NativeAnimationsExample, which makes use of `Animated.substract()`, let me know if the example is not desired / doesn't add much value. Below two GIFs of the new method working on iOS and Android:

<img width="320" src="https://user-images.githubusercontent.com/1437605/38154748-165cc5f8-3474-11e8-8b31-504444271896.gif" />
<img width="320" src="https://user-images.githubusercontent.com/1437605/38154749-1679bff0-3474-11e8-80b1-b558d44e0494.gif" />

<!--
  Required: 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!
-->

https://github.com/facebook/react-native-website/pull/276

[GENERAL] [ENHANCEMENT] [Animated] - Implemented Animated.subtract
Closes https://github.com/facebook/react-native/pull/18630

Differential Revision: D7462867

Pulled By: hramos

fbshipit-source-id: 4cb0b8af08bb0c841e44ea2099889b8c02a22a4a
2018-03-30 21:08:52 -07:00
David Aurelio 550339c71b Add `JReadableByteChannel`
Summary:
Adds `JReadableByteChannel`, which maps to `java.nio.ReadableByteChannel`.
This class is useful to stream data from Java to C++ memory (in conjunction with `JByteBuffer`).

Differential Revision: D7437312

fbshipit-source-id: 4979706148f0e20228f0f52341fb340497c24a8b
2018-03-29 23:06:55 -07:00
Kevin Gozali 1020ac9481 OSS: add gradle wrapper helper to prepare offline gradle caches
Summary:
This is to help build offline module caches for gradle builds.

allow-large-files

Reviewed By: hramos

Differential Revision: D7441450

fbshipit-source-id: 37ceb070223f0de06720f5c104ecfce2ad6cedfd
2018-03-29 21:17:02 -07:00
Ram N ee0c69dfa6 Keep nativeIDs immutable in ReactFindViewUtil
Reviewed By: mdvacca

Differential Revision: D7430144

fbshipit-source-id: c8e8242c1c3216258e4b8c27623160338e2578d8
2018-03-29 16:12:10 -07:00
David Aurelio 6be7b396ec Update okio
Summary:
Update okio dependency from 1.13.0 to 1.14.0.

The interesting feature is `BufferedSource` extending `java.nio.ReadableByteChannel`, allowing to bridge with `java.nio` more easily and integrating with the latest fbjni additions.

Reviewed By: emilsjolander

Differential Revision: D7443269

fbshipit-source-id: e397d7a0436e3fc59ade1f4357f30190ca7bbe35
2018-03-29 11:18:22 -07:00
David Aurelio 24b5721fb4 Fix `ByteBuffer.h`
Reviewed By: mjesun

Differential Revision: D7443482

fbshipit-source-id: aa765d54149fd81f785dbca7252342ed9b3c236d
2018-03-29 08:05:06 -07:00
David Aurelio ff2260b022 Add `JByteBuffer::rewind()`
Summary:
Adds a `rewind()` method to `JByteBuffer`, which maps to `java.nio.Buffer#rewind()`.
This is useful if a `ByteBuffer` is reused for calls between Java and C++.

Differential Revision: D7435171

fbshipit-source-id: 488131d6ad2d5abb1b86a5efabc2f39ba0ab16cd
2018-03-29 05:30:58 -07:00
David Vacca e88f128608 Refactor ReactShadowNode.SetRootNode() -> ReactShadowNode.setRootTag()
Reviewed By: achen1

Differential Revision: D7419566

fbshipit-source-id: 6be790972e88b879fe690acd4f23d0caa27964a4
2018-03-29 00:03:18 -07:00
Dmitry Zakharov 7cbb222cd5 Remove class-loading experiment for View Managers.
Reviewed By: fkgozali

Differential Revision: D7418876

fbshipit-source-id: 52f8dce29a509233b9545a564c4f0d390fa81f13
2018-03-28 13:22:58 -07:00
David Vacca 9c805062e7 Refactor RootShadowNodeRegistry to make it ThreadSafe
Reviewed By: achen1

Differential Revision: D7417965

fbshipit-source-id: 90fa007242d2f00a315a4db25d2b6a0949e4b0d3
2018-03-27 18:35:09 -07:00
Himabindu Gadupudi 56971bbb15 RN: Fix rounded Image Background (Android)
Reviewed By: achen1

Differential Revision: D7384113

fbshipit-source-id: 348bdbc54a3e5923e012cb4cbc32da83145f04b4
2018-03-27 11:51:04 -07:00
David Vacca 45abbf36d6 Support multiple Fabric ReactRootView running at the same time
Reviewed By: achen1

Differential Revision: D7409472

fbshipit-source-id: 9525e610f3bce49cae8d3c5e4427f99a48c32091
2018-03-27 11:13:34 -07:00
Riley Dulin 0150a0c85b Add nativeLoggingHook to JSIExecutor
Reviewed By: danzimm

Differential Revision: D7203114

fbshipit-source-id: 2f4640d19267dc4d75f6d6c8a7876c92abc22276
2018-03-27 11:13:34 -07:00
Dulmandakh 226bff3ed0 Android: include error types in getCurrentPosition error
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.

Include geolocation error types in error, and provide feature parity with iOS.

If error occurs when you call getCurrentPosition, then error object includes PERMISSION_DENIED, POSITION_UNAVAILABLE, TIMEOUT keys with error codes. It should be used to compare with error.code value.

This is minor fix that provides feature parity with iOS.
Closes https://github.com/facebook/react-native/pull/18533

Differential Revision: D7396586

Pulled By: mdvacca

fbshipit-source-id: bd698b80a3d075456738a3d4e48b572ae819ee3d
2018-03-25 21:02:33 -07:00
Tadeu Valentt 85e33aaf90 Prevents android crash due to unsupported ellipsize mode
Summary:
Fixes #18474

This allows use clip as ellipsize mode for truncated text on android

Added a test to RNTester, so it can be tested from there:
1. Run RNTester project
2. Navigate to `<Text>` tests
3. Scroll down to "Ellipsize mode" examples
4. Check the default behavior being applied when the value is set to "clip"

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [Text] - Prevents android crash due to unsupported "clip" ellipsize mode

<!--
  **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
-->
Closes https://github.com/facebook/react-native/pull/18540

Differential Revision: D7396379

Pulled By: mdvacca

fbshipit-source-id: 6c4b223731143c5081b3d12a3c740d1e375bd586
2018-03-25 20:51:18 -07:00
Andrew Chen (Eng) cbb7c7c193 Pass fabric flag from native to JS
Reviewed By: mdvacca

Differential Revision: D7373722

fbshipit-source-id: 3cd051f38677900693f3da797effa11f9161df37
2018-03-23 09:32:00 -07:00
Andrew Chen (Eng) 046d4cee8b Assert root node isn't null in createView
Reviewed By: mdvacca

Differential Revision: D7374406

fbshipit-source-id: 534e58e7867a9fa8e395abd587e2c808c9c7843d
2018-03-22 22:20:30 -07:00
Eric Samelson 15fa2250fd fix ReadableNativeMap.toHashMap() for nested maps and arrays
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Commit 7891805d22 broke the previous behavior of `ReadableNativeMap.toHashMap()` for nested maps and arrays. Previously, all nested `ReadableNativeMap`s and `ReadableNativeArray`s were recursively converted to `HashMap`s and `ArrayList`s, but this is lost when only `getLocalMap()` is returned.

<!--
  Required: 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!
-->

Call `ReadableNativeMap.toHashMap()` on a map with values of type `ReadableNativeMap` and `ReadableNativeArray`. Verify the returned hash map has these converted to `HashMap` and `ArrayList`, respectively.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [ReadableNativeMap] - Fix toHashMap() for nested maps and arrays

<!--
  **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
-->
Closes https://github.com/facebook/react-native/pull/18455

Reviewed By: kathryngray

Differential Revision: D7347344

Pulled By: mdvacca

fbshipit-source-id: af2bca9dec6c0cb8a7da099b6757434fcc3ac785
2018-03-22 10:49:44 -07:00
Andrew Jack 8e065baad4 Update fresco to v1.8.1
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
The current version of fresco in use is [v1.3.0](https://github.com/facebook/fresco/releases/tag/v1.3.0) from April 2017. There has been a lot of [improvements](https://github.com/facebook/fresco/releases) since then.

Fresco also depends on OkHttp 3.8.0 and soloader 0.3.0 so I have updated these too. Let me know if there's any reason either of these shouldn't be updated, however this will prevent Fresco from being updated.

The latest version of OkHttp is 3.10.0, but I have kept it as low as possible to allow developers to choose the version.

<!--
  Required: 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!
-->
Test with local build.
Check CI passes.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [ENHANCEMENT] [Fresco/OkHttp/SoLoader] - Updates Fresco to 1.8.1, OkHttp to 3.8.0, & SoLoader to 0.3.0

cc foghina

<!--
  **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
-->
Closes https://github.com/facebook/react-native/pull/18496

Differential Revision: D7361161

Pulled By: foghina

fbshipit-source-id: 6d2c5afb94ce5ff8e621188c2ac60f1ca4b787a6
2018-03-21 18:10:46 -07:00
Andrew Chen (Eng) 47910f0cad Set measure function after YogaNode has been copied
Reviewed By: mdvacca

Differential Revision: D7338948

fbshipit-source-id: e805169e162a47d0c7c775a3decbe9013c27c0e4
2018-03-21 17:48:55 -07:00
Andrew Chen (Eng) c0d27de37e Fix removal of virtual nodes in FabricReconciler
Reviewed By: mdvacca

Differential Revision: D7338949

fbshipit-source-id: 31263c138689f9b3f59deb26851132df04b8a823
2018-03-21 14:33:09 -07:00
Andrew Chen (Eng) 657c1a45bd Add more debug logs to FabricReconciler
Reviewed By: mdvacca

Differential Revision: D7338946

fbshipit-source-id: 839de31ca26a8e45d3bb3271d3ab5a4f53f639b0
2018-03-20 20:01:53 -07:00
Andrew Chen (Eng) af42829404 Fix TextRenderingTestCase
Reviewed By: mdvacca

Differential Revision: D7330681

fbshipit-source-id: 5dd2a60382d01fb841f16851a9b2027e2b08e748
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) f136ae1362 Add test for FabricText
Reviewed By: mdvacca

Differential Revision: D7326562

fbshipit-source-id: e1229f84496e9181475979d757066e3796a24a3f
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) c49afb174f Add debug logs to FabricUIManager
Reviewed By: mdvacca

Differential Revision: D7310879

fbshipit-source-id: 3c874fd4dbd75dd865f7d94e7e31f538ef67eb66
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) 785c8f7eb9 Use native as the source of truth to decide if a test should use Fabric
Reviewed By: fkgozali

Differential Revision: D7304221

fbshipit-source-id: cdd7053e6ce6522474df261db5710e2d9c013be6
2018-03-20 01:01:53 -07:00
David Vacca 5347ecfd29 Fix removal of ReactShadowNode
Reviewed By: achen1

Differential Revision: D7323294

fbshipit-source-id: 411aa1bcd93cc4f9df78f64ceb0c0d8c127bc3b0
2018-03-19 18:31:36 -07:00
David Vacca cc3d45d2e9 Add logging to debug Fabric diffing algorithm
Reviewed By: achen1

Differential Revision: D7319185

fbshipit-source-id: fe47c21db5e1415aebe806f0d74b1f65f667a397
2018-03-19 18:31:36 -07:00
David Vacca 7d3de1016a Implement Fabric Reconciler
Reviewed By: achen1

Differential Revision: D7240208

fbshipit-source-id: 236b76146c50fb7f357190b08f8a5bfcef7f6645
2018-03-19 18:31:36 -07:00
David Vacca 3f84a0a6f4 Extend ReactShadowNode in order to have a reference to the ReactShadowNode that was used to clone a node
Reviewed By: achen1

Differential Revision: D7289345

fbshipit-source-id: 34bfba8aca43299a3a8929a0e3eb85721f736dd0
2018-03-19 18:31:36 -07:00
David Vacca b43afcdde9 Change cloning mechanism for mutableCopyWithNewChildren method
Reviewed By: achen1

Differential Revision: D7239873

fbshipit-source-id: d931e753c3a0b26d439eb450d62af93a672641f4
2018-03-19 18:31:36 -07:00
David Vacca 0930fef46d Disable YogaNode cloning in Android
Reviewed By: achen1

Differential Revision: D7313239

fbshipit-source-id: ecf905a22e04a2115ab968fd29f7582301f0f3c9
2018-03-19 18:31:36 -07:00
Héctor Ramos 41db09d573 Remove @xplat cell syntax in open source, part 2
Differential Revision: D7325421

fbshipit-source-id: 95e3ee0a6c41292b1d2e1fc8b0691861ad69468f
2018-03-19 12:30:59 -07:00
Andrew Chen (Eng) 12c208cbd4 Create a new instrumentation test that does not enforce rendering a single RN component
Reviewed By: mdvacca

Differential Revision: D7293466

fbshipit-source-id: 8ddaf9a52f4d6324e8b37f3c6fd4d3e0db6f3a12
2018-03-19 11:00:23 -07:00
tuncaulubilge 263d04d756 Added nestedScrollEnabled prop to scroll view for android
Summary:
Nested scrolling in scrollViews, listViews and flatLists are enabled on iOS by default, but needs to be enabled manually on Android. This PR introduces a `nestedScrollEnabled` property to ScrollViews to support nested scrolling on Android 21 and above.

Enabling nested scroll will resolve issues with coordinator layout in android and required to support a collapsing toolbar.

Tested on the test app. We are also using this property in our app currently to support scrolling behaviour required by coordinator layouts.

[ANDROID] [ENHANCEMENT] [ScrollView] - Added a prop to enable nested scrolling
Closes https://github.com/facebook/react-native/pull/18299

Reviewed By: sahrens

Differential Revision: D7256604

Pulled By: mdvacca

fbshipit-source-id: fb8b7f1b5bed39837a2066db7f2a8798d52a3fd6
2018-03-18 20:16:15 -07:00
miguelsm 353c070be9 Add a way to dismiss PopupMenu elements
Summary:
In native Android apps, like the YouTube app, context menus are closed when the device orientation changes.

In React Native apps instead, when having a [PopupMenu](https://developer.android.com/reference/android/widget/PopupMenu.html) open and rotating the device, the PopupMenu is not dismissed and appears in a wrong position on the screen.

This PR exposes a `dismissPopupMenu` method to allow the application to dismiss any open PopupMenu:

```(javascript)
UIManager.dismissPopupMenu()
```
Closes https://github.com/facebook/react-native/pull/15636

Differential Revision: D6837663

Pulled By: hramos

fbshipit-source-id: 7b0f4f04341129ad45c703a50897e17d93651974
2018-03-16 17:22:05 -07:00
Tadeu Valentt 076b1cea35 Prevent show a hidden status bar when opening modals, fix #7474
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!

-->

Closes the old #7474, keeping the status bar hidden when displaying a modal
or dialog, this is accomplished by verifying if the activity status bar is hidden or not.

Added a test to [RNTester](https://github.com/facebook/react-native/tree/master/RNTester), so it can be tested from there:

1. Run [RNTester](https://github.com/facebook/react-native/tree/master/RNTester) project
2. Go to <StatusBar> tests
3. Set `hidden: true` in the *StatusBar hidden* samples
4. Set `modal visible: true` and see the result

Here are some gifs to help see the results:
![fail](https://user-images.githubusercontent.com/1649955/36345378-f443ad7e-1407-11e8-850d-d6317fb34da4.gif)
![success](https://user-images.githubusercontent.com/1649955/36345392-1c590b56-1408-11e8-9244-a2e828f579ab.gif)

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} |
[----------]   [-------------]   [-------------]   |-----------|

[ GENERAL  ]   [ BUGFIX      ]   [ [StatusBar] - Prevent show a hidden status bar when opening modals
 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
-->
[ GENERAL  ]   [ BUGFIX      ]   [StatusBar] - Prevent show a hidden status bar when opening modals
Closes https://github.com/facebook/react-native/pull/18004

Differential Revision: D7307564

Pulled By: hramos

fbshipit-source-id: 47e481ead78204865811ddf2ef3d27da77ad8b8f
2018-03-16 16:46:42 -07:00
Héctor Ramos f376fe3232 Remove @xplat cell syntax in open source
Differential Revision: D7292243

fbshipit-source-id: f1c162be8bc90669481f04de8aa71f3d9dbece36
2018-03-15 16:47:26 -07:00
Dmitry Zakharov c989ea8728 Extract NativeExtensionsProvider definition
Reviewed By: danzimm

Differential Revision: D6964355

fbshipit-source-id: e20dfa99bd9d8784a5f31a313302104d6dc33652
2018-03-15 09:27:40 -07:00
Andrew Chen (Eng) d678058402 Add Fabric integration test
Reviewed By: fkgozali

Differential Revision: D7207630

fbshipit-source-id: 69cc10d7d45031eec9f3d934b981a5e4bb62a0ef
2018-03-14 16:27:05 -07:00
Andrew Chen (Eng) 304db5cb65 Add MIT license to Fabric
Reviewed By: fkgozali

Differential Revision: D7278262

fbshipit-source-id: 39f4c73b8f693162eb037125bf64fecc7eb0cf8b
2018-03-14 15:50:13 -07:00
Khaer Ansori c595509048 Add number-pad keyboardType
Summary:
On Android there's no number-pad but numeric instead, for my use-case I need number only (without decimal and sign, for PIN input)

I write it so there's no breaking change for those already using the `TextInput` Component

None

[ANDROID][ENHANCEMENT][Component] Add number-pad keyboardType
Closes https://github.com/facebook/react-native/pull/18350

Reviewed By: achen1

Differential Revision: D7269721

Pulled By: mdvacca

fbshipit-source-id: 82571dce948e0cf2e4354dc46c69198ec69ba65a
2018-03-14 14:48:10 -07:00
Andrew Chen (Eng) 3a2bdf5c50 Move Fabric JSC bindings to oss
Reviewed By: mdvacca

Differential Revision: D7205065

fbshipit-source-id: 5876cb3e08ee96e39b80e6b377c60600f404ca21
2018-03-14 12:02:14 -07:00
Pritesh Nandgaonkar 321b107685 Expose layout diffing flag to java
Reviewed By: emilsjolander

Differential Revision: D7272067

fbshipit-source-id: e67e82eb057e4c7124904c715f9dca4dcfea21ea
2018-03-14 08:48:52 -07:00
Ram N 9737774b96 Fix crash in Sapienz bot for Interpolator type
Reviewed By: mdvacca

Differential Revision: D7252818

fbshipit-source-id: 30c585a2e6f6c2d7a7e7013c26c6228d8ef29aa6
2018-03-13 18:11:31 -07:00
Héctor Ramos aa323d4aa9 Use MIT license
Summary: Closes https://github.com/facebook/react-native/pull/18352

Differential Revision: D7257144

Pulled By: hramos

fbshipit-source-id: 477ff82f74cfa3fd0681c9522cc5199a60b24921
2018-03-13 10:32:13 -07:00
Héctor Ramos 7a1c618de6 Change newly imported file to MIT license
Summary:
The project at large switched to MIT last month. A PR that was opened prior to the change was merged, this PR updates the file to use the correct license.

None, trivial PR

[ANDROID] [MINOR] [Image] Update license
Closes https://github.com/facebook/react-native/pull/18343

Differential Revision: D7252836

Pulled By: hramos

fbshipit-source-id: b7c207c782f4bf19c12d121e86f394e52326a5ab
2018-03-12 20:26:43 -07:00
Moti Zilberman 0459e4ffaa Support Image resizeMode=repeat on Android
Summary:
`<Image resizeMode="repeat" />` for Android, matching the iOS implementation (#7968). (Non-goal: changing the component's API for finer-grained control / feature parity with CSS - this would be nice in the future)

As requested in e.g. #14158.

Given https://github.com/facebook/fresco/issues/1575, and lacking the context to follow the specific recommendations in https://github.com/facebook/fresco/issues/1575#issuecomment-267004303, I've opted for a minimal change within RN itself.

It's likely that performance can be improved by offloading this work to Fresco in some clever way; but I'm assuming that the present naive approach is still an improvement over a userland implementation with `onLayout` and multiple `<Image>` instances.

- Picking up on a TODO note in the existing code, I implemented `MultiPostprocessor` to allow arbitrary chaining of Fresco-compatible postprocessors inside `ReactImageView`.
- Rather than extensively refactor `ImageResizeMode`, `ReactImageManager` and `ReactImageView`, I mostly preserved the existing API that maps `resizeMode` values to [`ScaleType`](http://frescolib.org/javadoc/reference/com/facebook/drawee/drawable/ScalingUtils.ScaleType.html) instances, and simply added a second mapping, to [`TileMode`](https://developer.android.com/reference/android/graphics/Shader.TileMode.html).
- To match the iOS rendering exactly for oversized images, I found that scaling with a custom `ScaleType` was required - a kind of combination of `CENTER_INSIDE` and `FIT_START` which Fresco doesn't provide - so I implemented that as `ScaleTypeStartInside`. (This is, frankly, questionable as the default behaviour on iOS to begin with - but I am aiming for parity here)
- `resizeMode="repeat"` is therefore unpacked by the view manager to the effect of:
  ```js
     view.setScaleType(ScaleTypeStartInside.INSTANCE);
     view.setTileMode(Shader.TileMode.REPEAT);
   ```
  And the added postprocessing in the view (in case of a non-`CLAMP` tile mode) consists of waiting for layout, allocating a destination bitmap and painting the source bitmap with the requested tile mode and scale type.

Note that as in https://github.com/facebook/react-native/pull/17398#issue-285235247, I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.

Also, I'm happy to address any code style issues or other feedback; I'm new to this codebase and a very infrequent Android/Java coder.

Tested by enabling the relevant case in RNTester on Android.

| iOS | Android |
|-|-|
| <img src=https://user-images.githubusercontent.com/2246565/34461897-4e12008e-ee2f-11e7-8581-1dc0cc8f2779.png width=300>| <img src=https://user-images.githubusercontent.com/2246565/34461894-40b2c8ec-ee2f-11e7-8a8f-96704f3c8caa.png width=300> |

Docs update: https://github.com/facebook/react-native-website/pull/106

[ANDROID] [FEATURE] [Image] - Implement resizeMode=repeat
Closes https://github.com/facebook/react-native/pull/17404

Reviewed By: achen1

Differential Revision: D7070329

Pulled By: mdvacca

fbshipit-source-id: 6a72fcbdcc7c7c2daf293dc1d8b6728f54ad0249
2018-03-12 16:14:18 -07:00
Ram N 1dde989919 Add support for springDamping in SpringInterpolator
Reviewed By: mdvacca

Differential Revision: D7201334

fbshipit-source-id: 50929b4294188cd5a2a8ffa2080c38c0a9983535
2018-03-12 14:54:58 -07:00
Alexander Tu 216c8ec04b AndroidInfoModule now also returns Android ID
Summary: Added Android ID as one of the constants returned by AndroidInfoModule

Reviewed By: fkgozali

Differential Revision: D7206029

fbshipit-source-id: 110b33235d3023b4a4607d37acc3440cfe735cef
2018-03-09 12:12:21 -08:00
Caleb Meredith a48b4d5df1 Add Sonar support to Oculus Twilight Android
Reviewed By: alex1kom

Differential Revision: D7177071

fbshipit-source-id: 685d40e564d391d18592cedfcc12d8ac743a5331
2018-03-09 11:42:40 -08:00
David Vacca c883d4e727 Add "newProps" map into ReactShadowNode
Reviewed By: achen1

Differential Revision: D7205127

fbshipit-source-id: 6c27070806de36cab7adf9c392a10c815aee90d4
2018-03-09 09:47:44 -08:00
David Vacca e31781be61 Add extra debug information to ReactShadowNodes objects
Reviewed By: achen1

Differential Revision: D7195373

fbshipit-source-id: 6611726c3e1f92f387e00e733b1b8909a3e9edc2
2018-03-09 09:47:44 -08:00
David Vacca a7558d58a0 Clone ReactShadowNode when Yoga clones a YogaNode during layout
Reviewed By: achen1

Differential Revision: D7195840

fbshipit-source-id: d596e3ada8fe48577b91295721d41c0afd33087f
2018-03-09 09:47:43 -08:00
Andrew Chen (Eng) 596bcb6d84 Initialize ReactChoreographer before creating the TimingModule
Reviewed By: mdvacca

Differential Revision: D7185838

fbshipit-source-id: f775f5668ccff3b311c95a0bdd37a420ec64b7d4
2018-03-07 18:57:42 -08:00
samsafay d52569c4a1 check for GET and Head in send request
Summary:
React Native had an underlying problem connecting to Firestore (Google's latest database) from Android devices. You can follow the issue [here](https://github.com/firebase/firebase-js-sdk/issues/283).
The main problem was in NetworkingModule.java. Please refer to section 3 of 4.5.6 in whatwg.org's guideline https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send

In this [video](https://www.youtube.com/watch?v=tILagf46ys8), I am showing how the react native behaved before adding the new fix and how it worked after the new fix added.  The new fix starts at 50 seconds.

[ANDROID] [BUGFIX] [FIRESTORE][XMLHttpRequest][ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java] - Fixes the connection to Firestore by following whatwg.org's XMLHttpRequest send() method
Closes https://github.com/facebook/react-native/pull/17940

Differential Revision: D7173468

Pulled By: hramos

fbshipit-source-id: 354d36f03d611889073553b93a7c43c6d4363ff3
2018-03-06 17:39:22 -08:00
Andrew Chen (Eng) 6fc416313c Clean up FabricUIManagerViewHierarchyTest
Reviewed By: mdvacca

Differential Revision: D7165823

fbshipit-source-id: e6d2a83bf9e089c67d69de6581d177bdf0d2ec4e
2018-03-06 16:19:04 -08:00
Andrew Chen (Eng) e7b8341024 Add Fabric test for text nodes
Reviewed By: mdvacca

Differential Revision: D7165356

fbshipit-source-id: ab5b019943d0d6f759bdb16ca646e34a2ef79e23
2018-03-06 16:19:04 -08:00
Krzysztof Ciombor b7bb2e5745 Add support for Android TV devices
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!

-->

* To be on par with Apple TV support, this makes it possible to run React Native apps on Android TV devices (See also: https://react-native.canny.io/feature-requests/p/android-tv-support)
* These changes also make it possible to navigate through the app using D-PAD buttons that are present on some mobile devices
* Since these changes affect, among others, `ReactRootView.java` and `Touchable.js` code and are closely related to Apple TV implementation, it makes sense for them to be included in the core

 - React native apps can be launched on Android TV devices and properly render their content
 - Navigation is possible using left, right, top, bottom arrows from the remote (or D-PAD)
 - Touchable components can handle D-PAD center button press events and correctly fire their `onPress` handlers
 - Touchable components will receive `onPressIn` and `onPressOut` events and can react to focus/blur changes appropriately (just like on Apple TV)
 - `Platform` constants allow to check if the react-native app is running on TV (`Platform.isTV`)
 - `ScrollView`s behave correctly (same as native implementation) when switching to view outside bounds – that is, the container would scroll such that the newly focused element is fully visible
 - Native "clicking" sounds are played when moving between focusable elements
 - Play/Pause click event is send to `TVEventHandler`
 - Rewind and FastForward events are send to `TVEventHandler`
 - Back button behaves as a normal Android back button
 - Diagonal buttons work correctly on Android TV, e.g. if there is no button directly to the right from the focused one, but there is one to the right but a bit higher/lower it will grab focus
 - Dev menu can be accessed by long pressing fast forward button

A demo showing RNTester app running on Android TV device (Amazon Fire TV Stick) can be found here:
[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20)

- `TextInput` will not work on Android TV devices. There's an issue with native `ReactEditText` implementation that prevents it from receiving focus. This makes it impossible to navigate to `TextInput`.
This will be fixed next, but will be included in a separate Pull Request
- ~Overlay permissions cannot be granted on Android TV devices running Android version >= 6.0
This is because the overlay permission can only be granted by firing an Intent to open settings page (`ACTION_MANAGE_OVERLAY_PERMISSION`). Since this page does not exist on TV devices the permission cannot be requested. This will make the app crash when trying to open dev menu (⌘+M) or displaying a redbox error.
Note: This does not affect devices running Android version < 6.0 (for example Amazon Fire TV Stick)~
This is now fixed by: https://github.com/facebook/react-native/pull/16596

* Launch the RNTester app on Android TV device.
  * Ensure it launches without a crash
  * Ensure basic navigation is possible
  * Ensure Touchable components can receive select events
* Ensure the changes do not break current Android and iOS mobile devices functionality.
* Ensure the changes do not break current Apple TV functionality.

[RNAndroidTVDemo video](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)

* Added `ReactAndroidTVViewManager` that handles TV `KeyEvent`s and dispatches events to JS - This is the core that enables basic navigation functionality on Android TV devices
* Following the above change we copy `TVEventHandler.ios.js` into `TVEventHandler.android.js` to enable JS to pick up those native navigation events and dispatch them further to subscribed views. (Note: We do not have a native `TVNavigationEventEmitter` implementation on Android, thus this file is slightly modified, e.g. it does pass `null` to `NativeEventEmitter` constructor)
* Added `uiMode` to `AndroidInfoModule`. (**Note**: This required changing `extends BaseJavaModule` to `extends ReactContextBaseJavaModule` to be able to use `getSystemService` which requires `Context` instance!
* Added `isTV` constants to both `Platform.ios.js` (keeping the deprecated `isTVOS` as well) and `Platform.android.js`
* Changed condition check on `Touchable.js` to use the newly added `isTV` flag to properly handle TV navigation events on Android as well
* Added `LEANBACK_LAUNCHER` to `RNTester` `intent-filter` so that it is possible to launch it on Android TV devices.
* See also a PR to `react-native-website` repo with updated docs for Android TV: https://github.com/facebook/react-native-website/pull/59

 - [ ] Fix `TextInput` components handling by allowing them to be focused and making a proper navigation between them (and/or other components) possible. One thing to note here that the default behavior to immediately open software keyboard when focused on `TextInput` field will need to be adjusted on Android TV as well)
 - [x] Fix overlay permissions issue by changing the way redbox/dev menu are displayed (see: https://github.com/facebook/react-native/pull/16596)
 - [ ] Adjust placement of TV-related files (e.g. the `TVEventHandler.js` file is placed inside `AppleTV` directory which is not accurate, since it does handle Android TV events as well)

Previous discussion: https://github.com/SoftwareMansion/react-native/pull/1
<!--
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] [TV] - Added support for Android TV devices
Closes https://github.com/facebook/react-native/pull/16500

Differential Revision: D6536847

Pulled By: hramos

fbshipit-source-id: 17bbb11e8583b97f195ced5fd9762f8902fb8a3d
2018-03-06 10:47:02 -08:00