Commit Graph

12851 Commits

Author SHA1 Message Date
Josh Hargreaves b60a727adb Fix crashes onKeyPress Android
Summary:
There appear to be two different types of crashes related to the recent addition of `onKeyPress` on Android introduce in `0.53`. This PR addresses the cause of both of them.

Firstly, it seems possible to get an `indexOutOfBoundsException` with some 3rd-party keyboards as observed in https://github.com/facebook/react-native/issues/17974 & https://github.com/facebook/react-native/issues/17922. I have simplified the backspace determining logic slightly, and also put in an explicit check for zero case so it is not possible to get an indexOutOfBoundsException & it should make sense in the context of the onKeyPress logic.

Secondly, it appears that `EditText#onCreateInputConnection` can return null. In this case, if we set `null` to be the target of our subclass of `ReactEditTextInputConnectionWrapper`, we will see the crashes as seen [here](https://github.com/facebook/react-native/issues/17974#issuecomment-368471737), whereby any of methods executed in the `InputConnection` interface can result in a crash. It's hard to reason about the state when `null` is returned from `onCreateInputConnection`, however I would might reason that any soft keyboard input cannot update the `EditText` with a `null` `input connection`, as there is no way of interfacing with the `EditText`. I'm am not sure, if there is a later point where we might return/set this input connection at a later point? As without the `InputConnection` onKeyPress will not work. But for now, this will fix this crash at least.

I have not managed to reproduce these crashes myself yet, but users have confirmed that the `indexOutOfBounds` exception is fixed with the 'zero' case and has been confirmed on the respective issues https://github.com/facebook/react-native/issues/17974#issuecomment-368471737.

For the `null` inputConnection target case, I have verified that explicitly setting the target as null in the constructor of `onCreateInputConnection` results in the same stack trace as the one linked. Here is also a [reference](https://github.com/stripe/stripe-android/pull/392/files#diff-6cc1685c98457d07fd4e2dd83f54d5bb) to the same issue closed with the same fix for another project on github.

It is also important to verify that the behavior of `onKeyPress` still functions the same after this change, which can be verified by running the RNTesterProject and the `KeyboardEvents` section in `InputText`.
The cases to check that I think are important to check are:
- Cursor at beginning of input & backspace
- Return key & return key at beginning of input
- Select text then press delete
- Selection then press a key
- Space key
- Different keyboard types

This should not be a breaking change.

 [ANDROID] [BUGFIX] [TextInput] - Fixes crashes with TextInput introduced in 0.53.
Closes https://github.com/facebook/react-native/pull/18114

Differential Revision: D7099570

Pulled By: hramos

fbshipit-source-id: 75b2dc468c1ed398a33eb00487c6aa14ae04e5c2
2018-02-27 10:01:40 -08:00
Jean Lauliac a759a44358 npmignore: ignore tests and fixtures
Summary:
This try to address #17672 and https://github.com/facebook/metro/issues/139. We should probably not include these folders in the released version of React Native, as they are used only for testing—am I incorrect?

cc MoOx, t4deu.

I ran:

```
npm pack
tar -t -f react-native-1000.0.0.tgz | less
```

Then verified that `__fixture__` was not part of the package.

https://github.com/facebook/react-native/pull/17672

[GENERAL] [BUGFIX] [.npmignore] - Do not publish test-specific files
Closes https://github.com/facebook/react-native/pull/18019

Differential Revision: D7098211

Pulled By: jeanlauliac

fbshipit-source-id: 0748ad8c064450bd2a9f4d6f49675a7f74fb300f
2018-02-27 08:42:14 -08:00
Kevin Gozali 28c694f25a iOS - expose C++ FabricUIManager to the bridge via a wrapper class
Reviewed By: shergin

Differential Revision: D7093253

fbshipit-source-id: 7317144ad2cb5b8903227c779798e1576f8de2c2
2018-02-27 08:42:14 -08:00
Kevin Gozali 52acbbdd62 iOS: adjusted JSI binding for C++ FabricUIManager
Reviewed By: sebmarkbage, shergin

Differential Revision: D7078631

fbshipit-source-id: 6df21e52d3941372a9845fdcf2aed777de7cb359
2018-02-27 08:42:14 -08:00
Jamie Curtis da84eba318 Catch exception and report it when making a network request with invalid URL on Android
Summary:
Currently if you invoke `fetch()` with an invalid URL ("aaa" for
example) you cannot catch the error in javascript since it's not
reported. Instead the entire app crashes.

Fixes #7436 and #18087

Hopefully.

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

-->

Fix using fetch on Android with user generated input.

Added relevant unit test

`./scripts/run-android-local-unit-tests.sh` all pass

[ANDROID] [BUGFIX] [fetch] - Allow "unexpected url" exception to be caught on Android when using fetch
<!--
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
-->
Closes https://github.com/facebook/react-native/pull/18103

Differential Revision: D7097110

Pulled By: hramos

fbshipit-source-id: 69144e8a0f7404d9bcc7c71a94650de36a48c84a
2018-02-27 04:39:01 -08:00
Sebastian Markbage 07334cb47b Clean up unused modules
Reviewed By: fkgozali

Differential Revision: D7092777

fbshipit-source-id: 619a78911f2857f1183597143aec86957f277f9e
2018-02-26 20:03:27 -08:00
Sebastian Markbage 84ad5d3d3c Explicitly handle null props in bindings
Reviewed By: fkgozali, mdvacca

Differential Revision: D7080813

fbshipit-source-id: 7c9706df719a39e11a3d99c2de38af992b62dabf
2018-02-26 19:46:51 -08:00
Spencer Ahrens 3756d41de1 Add testOnly_pressed to TouchableHighlight
Reviewed By: yungsters

Differential Revision: D7043098

fbshipit-source-id: 1df06df6820d81b37dc9a167a7931ed20df44f0f
2018-02-26 13:48:19 -08:00
Manman Ren ebbd4371c9 Mark ObjC methods that are called from React Native as dynamic.
Reviewed By: mmmulani

Differential Revision: D7087100

fbshipit-source-id: 18e5726e5b48e7b71fcaab19f6fe73be0cad6233
2018-02-26 12:24:17 -08:00
Ken Woo 3eee96ab86 Change React Native application layout check
Reviewed By: shergin

Differential Revision: D7076910

fbshipit-source-id: dc6df2dee886bbdf139d6e50192d621efad6d57e
2018-02-26 11:49:36 -08:00
Rafael Oleza bd30336d86 Bump metro@0.28.0
Reviewed By: davidaurelio

Differential Revision: D7085296

fbshipit-source-id: 76032af022d37a28976b33176f9a573e39861a39
2018-02-26 10:09:54 -08:00
David Vacca 62efff8ab8 Implement cloning for all ReactShadowNodes
Reviewed By: achen1

Differential Revision: D7063509

fbshipit-source-id: 90df8a3d2e6f2a4efa13f5eb0337b191b690bf8f
2018-02-26 09:04:48 -08:00
Miguel Jimenez Esun dabe8e0d01 Allow passing custom configs through the CLI ("js1 run")
Reviewed By: jeanlauliac

Differential Revision: D7081913

fbshipit-source-id: f5952599c840f2c65213bd2928b21f0c1d84f510
2018-02-26 03:48:43 -08:00
Tim Yung 80c18395e2 RN: Flow Type for `PressEvent`
Reviewed By: sahrens

Differential Revision: D7082716

fbshipit-source-id: 13e1730b0b2380ae6be63e2b36bb40b9a44a99f4
2018-02-25 23:27:00 -08:00
Tim Yung a817c64043 RN: Use `$ReadOnly` in CoreEventTypes
Reviewed By: sahrens

Differential Revision: D7082715

fbshipit-source-id: d2f7e280d02bbd8e7dcba2d38b719fa4f82ecb8b
2018-02-25 23:27:00 -08:00
siddhantsoni 16c9e5b715 Fix: Added scroll Bounds check in scrollToOffset method in RCTScrollView on iOS
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!

-->

The scrollToOffset method of RCTScrollView for iOS does not include bound check for the scroll offset provided to the method. This can cause the whole view to scroll out of screen if the offset provided is greater than the bounds of the View.
The same does not happen on Android, where the scroll halts once the last item of the scrollView is in the viewport.
I have added bounds check so the offset resets to the MaxOffset which makes sure the view does not scroll out of the viewport.

The issue can be observed in the following snack:
https://snack.expo.io/H1363Uo8f

![ezgif com-optimize 1](https://user-images.githubusercontent.com/16662518/36068270-2437ae88-0ef7-11e8-96dd-819b4ae0fd67.gif)

To test my changes I ran the code provided in the snack above with the react-native dependency pointing to my branch. As can be see in the video attached below, the scroll halts once it hits the end of the ScrollView even if the scroll offset provided is higher than the bounds of the ScrollView. It also does not scroll up for negative scroll offset.

![ezgif com-optimize](https://user-images.githubusercontent.com/16662518/36068130-9ae4f918-0ef3-11e8-8728-af7b2888bdb8.gif)

[IOS] [BUGFIX] [ScrollView] - Added bounds check to prevent ScrollView from scrolling to an offset which is out of bounds of the ScrollView for iOS.
Closes https://github.com/facebook/react-native/pull/17927

Differential Revision: D7014466

Pulled By: shergin

fbshipit-source-id: a817738d08e1057a4c70f43373132f88fa1461c4
2018-02-25 22:18:31 -08:00
Maxime Thirouin 59c7b2cfac Add missing mock for AppState (removeEventListener)
Summary:
I am testing with Jest a component that use [AppState.removeEventListener](https://facebook.github.io/react-native/docs/appstate.html#removeeventlistener) and I am currently facing a fatal error saying that `AppState.removeEventListener` is `undefined`.

Create a component that uses `AppState`, e.g.

```jsx
import React, { Component } from 'react';
import { AppState } from 'react-native';

class TestComponent extends Component {
  componentDidMount() {
    AppState.addEventListener('change', this.stateChangeListener);
  }
  componentWillUnmount() {
    AppState.removeEventListener('change', this.stateChangeListener);
  }
}
```

It should pass test using Jest (snapshots)

It's the continuation of #11199. This PR finish the mock for the native module `AppState`.

[ GENERAL  ]   [ BUGFIX      ]   [AppState] Add missing mock for Jest for `removeEventListener` method.
Closes https://github.com/facebook/react-native/pull/17908

Differential Revision: D7083144

Pulled By: shergin

fbshipit-source-id: eafa07f064f971c3d657f2ffc9c00766c0925bac
2018-02-25 22:18:30 -08:00
Ruben Bridgewater d2817f48a1 Use sync fs.mkdir
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!

-->

This ensures that errors are actually noticed in case it is not
possible to create the directory. This will also throw an error when used with the upcoming Node.js 10.x because there is no callback.

Refs: https://github.com/nodejs/node/pull/18668

[CLI][MINOR][local-cli/library/library.js] - Use sync fs.mkdir for error handling
<!--
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
-->
Closes https://github.com/facebook/react-native/pull/18084

Differential Revision: D7083122

Pulled By: shergin

fbshipit-source-id: a13b64e57860e1ab2c15e0c008211dc0dca3b2d2
2018-02-25 21:49:28 -08:00
Valentin Shergin a534672e13 Fixed problem in Text measurent on iOS
Summary: See the comment it code.

Reviewed By: mmmulani

Differential Revision: D7074168

fbshipit-source-id: e6eda9a47552142ccb0ba8e7bd9a103b0cb4f9f9
2018-02-25 09:37:38 -08:00
Eric Rozell 8a073c1d8b Fix `onLayout` prop for TextInput on Android
Summary:
When the `autogrow` prop was removed from `TextInput` on Android, the `_onLayout` helper method was removed. This helper method implemented the hook required to make `autogrow` work, then dispatched the `onLayout` event to the handler in `this.props`. This change points passes the `onLayout` handler from `this.props` directly to the inner component.

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

-->

I was updating copied code in react-native-windows and noticed this bug.

Run jest tests.

N/A

<!--
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][MINOR][BUGFIX] [TextInput] - Fix `onLayout` prop for TextInput on Android
Closes https://github.com/facebook/react-native/pull/18040

Differential Revision: D7078736

Pulled By: hramos

fbshipit-source-id: 798530729d7f0ee1ebb59f698af4d4b6ff43928b
2018-02-24 01:02:42 -08:00
Kevin Gozali 0ee03178a0 added C++ setup for FabricUIManager
Reviewed By: shergin

Differential Revision: D7077312

fbshipit-source-id: e284c151438eb4d1f67a8386580ab54e3dce7c17
2018-02-23 19:49:03 -08:00
Sasha Nikiforov d8bb990abc Update ReactAndroid build script to support gradle 2.3.0
Summary:
We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided:

````
* What went wrong:
A problem occurred configuring project ':ContextMenuAndroid'.
> Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'.
   > A problem occurred configuring project ':ReactAndroid'.
      > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project.
````

To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property.

Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set:

````
def getRepositoryUrl() {
    if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl'))

    return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
````
Then I ran gradle with "repositoryUrl" set like this (passing the property):
````
./gradlew -PrepositoryUrl=blah assembleDebug
````

As expected, it detected that "repositoryUrl" was set and threw an exception:
````
* What went wrong:
A problem occurred configuring project ':ContextMenuAndroid'.
> Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'.
   > A problem occurred configuring project ':ReactAndroid'.
      > blah
````

The same issue has been reported before - #14811, #14810

Minor changes in the Android build script
Closes https://github.com/facebook/react-native/pull/18075

Differential Revision: D7077788

Pulled By: hramos

fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
2018-02-23 19:16:02 -08:00
David Vacca 1b63da753f Implement Cloning for ART Views
Reviewed By: achen1

Differential Revision: D7058410

fbshipit-source-id: 394330654be1ab70853f78580c2543e04a3efb7c
2018-02-23 17:52:20 -08:00
Kevin Gozali 486ac9dc82 update FabricUIManager to call the right JS object
Reviewed By: sebmarkbage

Differential Revision: D7037275

fbshipit-source-id: 6a1d13227910d0cdb99dde4b6c98ed7a20ef9911
2018-02-23 17:04:40 -08:00
Sebastian Markbage 25b0c374b3 JSC bindings for FabricUIManager - Android
Reviewed By: fkgozali

Differential Revision: D7054214

fbshipit-source-id: 6275a8a3e2a87dfd851a09392f09658538083483
2018-02-23 16:24:24 -08:00
Eric Rozell b9be28915c Remove Platform check from WebSocket module
Summary:
WebSocket uses the Platform module to check how many arguments for the `close` method should be used. In react-native-windows, we have the same number of arguments for `close` as Android, so we're prevented from using this module as-is because of the platform check (see https://github.com/Microsoft/react-native-windows/blob/master/Libraries/WebSocket/WebSocket.windows.js#L136).

By switching to an argument count check, this module becomes more useful cross-platform. If you'd like to keep the platform check, I'm also open to inverting the conditional, e.g., `if (Platform.OS !== 'ios')`.

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

-->

I'd like to minimize the amount of code I need to copy over to react-native-windows for platform-specific overrides.

Run jest tests.

N/A

<!--
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
-->
[GENERAL][MINOR][ENHANCEMENT][Libraries/WebSocket/WebSocket.js] - Better enable cross-platform support of WebSocket.js
Closes https://github.com/facebook/react-native/pull/18056

Differential Revision: D7070380

Pulled By: TheSavior

fbshipit-source-id: 9bfd47654d0bf6f0e07fc799853a206721467525
2018-02-23 11:17:27 -08:00
Reem Helou 446ce49e9b Fix Bug with Date Picker IOS
Reviewed By: sahrens

Differential Revision: D7052609

fbshipit-source-id: 740fffa9ad55ccd21347626f9c5dc180fcc4094d
2018-02-23 10:53:22 -08:00
David Aurelio 87f98bcd7c BundleDownloader/DevServerHelper: Close http responses
Reviewed By: amnn

Differential Revision: D7067204

fbshipit-source-id: 9b3dde374280b8d7bdc028a14e9218f37cfc87f2
2018-02-23 09:50:45 -08:00
Jean Lauliac 33a893e18b react-native: prefer custom source extensions over default extensions
Reviewed By: mjesun

Differential Revision: D7066617

fbshipit-source-id: cdde7451cb817d62d6705071752fce0686cf04dc
2018-02-23 08:50:16 -08:00
Burak Yigit Kaya 8d74af4d60 Release Metro 0.27.0
Reviewed By: davidaurelio

Differential Revision: D7067140

fbshipit-source-id: a2ae64a8049e5ef883c08f4abbe108401427b0aa
2018-02-23 07:47:33 -08:00
Burak Yigit Kaya a29906a209 Upgrade Jest to 22.4.2
Reviewed By: mjesun

Differential Revision: D7060484

fbshipit-source-id: 91cc7b6d66a2bb99242c144e011eef4393f87e9e
2018-02-23 03:37:59 -08:00
David Aurelio e214bb3971 `DevSupportManager`: tag `RELOAD` marker with metro host
Summary: Adds the configured metro host to `ReactMarker.logMarker(ReactMarkerConstants.RELOAD)`. This may be used for diagnostics in marker listeners

Reviewed By: bnham

Differential Revision: D7041086

fbshipit-source-id: 0b0777b1cd4c74b29b9245e925cf7851b24985fa
2018-02-23 03:37:59 -08:00
David Vacca d352c93487 Register ReactRootView into FabricUIManagerModule
Reviewed By: achen1

Differential Revision: D7043902

fbshipit-source-id: fecef5a019dadd3d2802baa20dd8a3711e566ed3
2018-02-22 23:06:19 -08:00
Islam Magdy b57a78c3de Fix for #17348, Scrollable failing due to uglify-es
Summary:
Fixes https://github.com/facebook/react-native/issues/17348 - Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'this._subscribableSubscriptions.forEach')

Same existing tests applies, just added extra checks.

This patch fixes the issue https://github.com/facebook/react-native/issues/17348

 [ANDROID] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
 [IOS] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
Closes https://github.com/facebook/react-native/pull/17463

Reviewed By: sahrens

Differential Revision: D7062101

Pulled By: TheSavior

fbshipit-source-id: 1306f4695ffc8748f674de70740ded09e1e390f7
2018-02-22 18:03:03 -08:00
Krzysztof Magiera ef9d1fba23 Fix IllegalStateException in looped timing native animation
Summary:
This PR fixes regression introduced in #17896 with IllegalStateException being thrown in FrameBasedAnimationDriver.

After investigating it seemed that the root cause was the code responsible for looping animations that was setting next frame time by adding the frame interval to the current time. In some circumstances the next frame would run earlier than that and as a result the calculated frame index was negative.

Here is the stacktrace as reported by axemclion https://github.com/facebook/react-native/pull/17896/files#r170007224
```
Caused by: java.lang.IllegalStateException: Calculated frame index should never be lower than 0
	at com.facebook.react.animated.FrameBasedAnimationDriver.runAnimationStep(FrameBasedAnimationDriver.java:60)
	at com.facebook.react.animated.NativeAnimatedNodesManager.runUpdates(NativeAnimatedNodesManager.java:444)
	at com.facebook.react.animated.NativeAnimatedModule$1.doFrameGuarded(NativeAnimatedModule.java:100)
	at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
```

Run native animated tests suite. Run RNTester and scroll to the loop animation and see it working correctly

[ANDROID][BUGFIX][Animated] - Fix exception thrown by timing animation when looping
Closes https://github.com/facebook/react-native/pull/18061

Differential Revision: D7059335

Pulled By: hramos

fbshipit-source-id: b08dfd1398d028eeeabeb11863743666379da374
2018-02-22 13:37:26 -08:00
Andrew Chen (Eng) cf0193f9e0 More tests for FabricUIManagerModule
Reviewed By: mdvacca

Differential Revision: D7045459

fbshipit-source-id: f96758cf04b41836f73b29e62d43a122d955c67a
2018-02-22 12:24:32 -08:00
Mats Byrkeland edb6ca72fd Fix ESLint warnings using 'yarn lint --fix'
Summary:
Hi! I would like to contribute to React Native, and I am just starting out. I forked the repo and found that it has quite a lot of ESLint warnings – many of which were automatically fixable. This PR is simply the result of running `yarn lint --fix` from the root folder.

Most changes are removing trailing spaces from comments.

Haven't really done any manual testing, since I haven't done any code changes manually. `yarn test` runs fine, `yarn flow` runs fine, `yarn prettier` is satisfied.

N/A

[INTERNAL][MINOR][] - Fix ESLint warnings
Closes https://github.com/facebook/react-native/pull/18047

Differential Revision: D7054948

Pulled By: hramos

fbshipit-source-id: d53e692698d1687de5821c3fb5cdb76a5e03b71e
2018-02-22 07:23:17 -08:00
Burak Yigit Kaya 47e57ef8c1 Upgrade Jest to 22.4.0 to pull fixes for jest-haste-map
Reviewed By: mjesun

Differential Revision: D7041111

fbshipit-source-id: 6dbd0cbf7b62a54d0b5f16bbf2fa81332542f14e
2018-02-22 06:15:59 -08:00
Maël Nison 13ee1b5920 Uses Yargs instead of Command
Summary: This diff allows Metro to throw an error when a configuration file cannot be found, by using a new strict: true option.

Reviewed By: rafeca

Differential Revision: D6998613

fbshipit-source-id: b704633be18d5c007f1a022fa811d0a74c636fc9
2018-02-22 06:08:22 -08:00
Andrew Chen (Eng) 190e6bef2e FabricUIManagerModuleTest setup and testCloneNode
Reviewed By: mdvacca

Differential Revision: D7037558

fbshipit-source-id: a62617c7e16102cf7d12ecde48a95feec264fa51
2018-02-21 12:47:51 -08:00
Alex Kotliarskyi 7dd12a26b9 Mock static methods of TouchableNativeFeedback on iOS
Reviewed By: TheSavior

Differential Revision: D7016679

fbshipit-source-id: bd04244eaf876e3ffab4f0c64792769a9ea40abd
2018-02-21 11:21:34 -08:00
David Vacca 4371d1e1d0 Implement FabricUIManagerModule in Android
Reviewed By: achen1

Differential Revision: D7031902

fbshipit-source-id: a8d9d505f981ac4268760efa32f4cbc7955aec32
2018-02-21 09:33:22 -08:00
Eric Rozell 47addd8e34 Remove unused reference in Text.js
Summary:
Previously, the Platform module was used to detect when RCTVirtualText should be used. Recently, this has changed to detecting the availability of a native virtual text component on the UIManager. The import for the Platform module can be deleted.

I was cleaning up source code copied in react-native-windows and noticed this reference is no longer used in Text.js.

Run jest tests.

N/A

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

Differential Revision: D7042473

Pulled By: hramos

fbshipit-source-id: d318cfdfd2d052bd1662ac469dd51633f6d59d17
2018-02-21 09:17:30 -08:00
Valentin Shergin b7fbeb253a RCTSurface: Support for synchronous waiting for mounting stage
Summary:
So, all initial operations can now be done synchronously (and on the main thread).
To do so, instancitate `RCTSurface` object and call `synchronouslyWaitForStage:timeout:` method like that:

RCTSurface *surface = [[RCTSurface alloc] initWithBridge:... moduleName:... initialProperties:...];
BOOL success = [surface synchronouslyWaitForStage:RCTSurfaceStageSurfaceDidInitialMounting timeout:timeout];

or

RCTSurfaceHostingView *surfaceHostingView = [[RCTSurfaceHostingView alloc] initWithBridge:... moduleName:... initialProperties:...];
BOOL success = [surfaceHostingView.surface synchronouslyWaitForStage:RCTSurfaceStageSurfaceDidInitialMounting timeout:timeout];

Reviewed By: fkgozali

Differential Revision: D7014178

fbshipit-source-id: c3c13904a3587ff2a222fa71623c40c8f30bc8af
2018-02-20 22:19:45 -08:00
Valentin Shergin 402ae2f01f New UIManager API allowing intercept/delay mounting process
Summary: In some embedding/interop cases (RN inside, something else outside), the interop layer has to have the ability to control (intercept, delay, perform synchronously with another stuff) mounting process. This API allows doing that.

Reviewed By: fkgozali

Differential Revision: D7014179

fbshipit-source-id: 04036095f7e60a5ff7e69025ff6066fea92eb361
2018-02-20 22:19:45 -08:00
Valentin Shergin 60c000022e Enforcing sequential ordering of creating view and applying props in UIManager
Summary: See the comment in code.

Reviewed By: fkgozali

Differential Revision: D7014177

fbshipit-source-id: c58db856d7701a285564470eb1f024b5012dd451
2018-02-20 22:19:44 -08:00
Valentin Shergin b90c1cf6c3 RCTSurface: Optional sync ShadowView/View registing
Summary:
See the comment in code.
If we on the main thread on registering time, we can/will break sequentiality of registering and mounting processes doing registration asynchronously.
We need this to make sync mouting eventually possible.

Reviewed By: fkgozali

Differential Revision: D7014176

fbshipit-source-id: 110ad5e5d86e3422eac15c3b1bdb29ae04acd7e6
2018-02-20 22:19:44 -08:00
Tim Yung 8c036ce090 RN: Remove Animated -> ScrollView -> Animated Cycle
Reviewed By: sahrens

Differential Revision: D7027223

fbshipit-source-id: 59924fada0f29a5e2ce1ae9a3694a94cfb26367c
2018-02-20 20:35:08 -08:00
David Vacca ad06403c3e Introduce cloning mechanism for React Shadow Node
Reviewed By: achen1

Differential Revision: D7018869

fbshipit-source-id: beca45b1df9602ebbc9172091b24a2bf44e103f4
2018-02-20 19:09:52 -08:00
Brian Vaughn 9dd7608c97 Replaced unstable_AsyncComponent with unstable_AsyncMode
Reviewed By: gaearon

Differential Revision: D7025510

fbshipit-source-id: 1aff984ce7479e5fdff71259d0f552193a6cdcea
2018-02-20 17:46:53 -08:00