Commit Graph

13861 Commits

Author SHA1 Message Date
Sho Ikeda 045688bc28 Fix Stable release date of 0.58.0 (#19751)
Summary:
See https://github.com/facebook/react-native/pull/19715#discussion_r195620169 for the details.

hramos
Closes https://github.com/facebook/react-native/pull/19751

Differential Revision: D8466070

Pulled By: hramos

fbshipit-source-id: 569e84119ac927e393889ad2c2f38d2b982aa6e8
2018-06-16 01:31:32 -07:00
Tim Yung c749d951ad React sync for revisions c0fe8d6...ae14317
Summary:
This sync includes the following changes:
- **[ae14317d6](https://github.com/facebook/react/commit/ae14317d6)**: Inline fbjs/lib/emptyFunction (#13054) //<Dan Abramov>//
- **[72434a768](https://github.com/facebook/react/commit/72434a768)**: Remove or inline some fbjs dependencies (#13046) //<Dan Abramov>//
- **[64c54edea](https://github.com/facebook/react/commit/64c54edea)**: Adding movementX and movementY to synthenticMouseEvent fixes #6723 (#9018) //<Jason Williams>//
- **[9bd4d1fae](https://github.com/facebook/react/commit/9bd4d1fae)**: Synchronously restart when an error is thrown during async rendering (#13041) //<Andrew Clark>//
- **[9bda7b28f](https://github.com/facebook/react/commit/9bda7b28f)**: Suspended high pri work forces lower priority work to expire early  (#12965) //<Andrew Clark>//
- **[2e7577907](https://github.com/facebook/react/commit/2e7577907)**: Fix incorrect data in compositionend event with Korean IME on IE11 (#10217) (#12563) //<Crux>//
- **[bc963f353](https://github.com/facebook/react/commit/bc963f353)**: setJSResponder in Fabric renderer (#13031) //<Sebastian Markbåge>//
- **[051637da6](https://github.com/facebook/react/commit/051637da6)**: Extract Fabric event handlers from canonical props (#13024) //<Sebastian Markbåge>//
- **[2a8085980](https://github.com/facebook/react/commit/2a8085980)**: Remove rAF fork (#12980) //<Flarnie Marchan>//
- **[e0c78344e](https://github.com/facebook/react/commit/e0c78344e)**: Retry on error if there's lower priority pending work (#12957) //<Andrew Clark>//
- **[9725065eb](https://github.com/facebook/react/commit/9725065eb)**: Update bundle sizes for 16.4.1 release //<Dan Abramov>//
- **[0b87b2790](https://github.com/facebook/react/commit/0b87b2790)**: Updating package versions for release 16.4.1 //<Dan Abramov>//
- **[036ae3c6e](https://github.com/facebook/react/commit/036ae3c6e)**: Use native event dispatching instead of Simulate or SimulateNative (#13023) //<Philipp Spieß>//
- **[945fc1bfc](https://github.com/facebook/react/commit/945fc1bfc)**: Call gDSFP with the right state in react-test-render (#13030) //<Rafał Ruciński>//
- **[392530104](https://github.com/facebook/react/commit/392530104)**: Remove feature flag around 'getDerivedStateFromProps' bug fix (#13022) //<Flarnie Marchan>//
- **[1594409fa](https://github.com/facebook/react/commit/1594409fa)**: Scheduler depends on common packages (#13020) //<Dan Abramov>//
- **[d5c11193e](https://github.com/facebook/react/commit/d5c11193e)**: Added production profiling bundle type (#12886) //<Brian Vaughn>//
- **[ec60457bc](https://github.com/facebook/react/commit/ec60457bc)**: Popping context is O(1) in SSR (#13019) //<Dan Abramov>//
- **[30bc8ef79](https://github.com/facebook/react/commit/30bc8ef79)**: Allow multiple root children in test renderer traversal API (#13017) //<Dan Abramov>//
- **[d480782c4](https://github.com/facebook/react/commit/d480782c4)**: Don’t error when returning an empty Fragment (#12966) //<Philipp Spieß>//
- **[4ac6f133a](https://github.com/facebook/react/commit/4ac6f133a)**: Fallback to event.srcElement for IE9 (#12976) //<Nathan Hunzaker>//
- **[23be4102d](https://github.com/facebook/react/commit/23be4102d)**: Fixed an issue with nested contexts unwinding when server rendering. Issue #12984 (#12985) //<Eric Soderberg>//
- **[d0d428064](https://github.com/facebook/react/commit/d0d428064)**: Remove old reference to inst._wrapperState (#12987) //<Nathan Hunzaker>//
- **[c78957eac](https://github.com/facebook/react/commit/c78957eac)**: Fix an SVG focusing crash in IE11 (#12996) //<Jifa Jiang>//
- **[bfb12ebb5](https://github.com/facebook/react/commit/bfb12ebb5)**: delete a couple of redundant lines in performWorkOnRoot() in ReactFiberScheduler.js (#13003) //<Nathan Quarles>//
- **[394b17eed](https://github.com/facebook/react/commit/394b17eed)**: Update custom renderer docs //<Dan Abramov>//
- **[188c4252a](https://github.com/facebook/react/commit/188c4252a)**: Fix react-dom ReferenceError requestAnimationFrame in non-browser env (#13000) (#13001) //<Ivan Babak>//
- **[9cf3733a9](https://github.com/facebook/react/commit/9cf3733a9)**: update comment in computeAsyncExpiration() to reflect code (#12994) //<Nathan Quarles>//
- **[c5a733e1e](https://github.com/facebook/react/commit/c5a733e1e)**: Fix links of docs on the comment (#12795) //<Ende93>//
- **[36546b513](https://github.com/facebook/react/commit/36546b513)**: Set the correct initial value on input range (#12939) //<Maxime Nory>//
- **[15767a8f8](https://github.com/facebook/react/commit/15767a8f8)**: [scheduler] 5/n Error handling in scheduler (#12920) //<Flarnie Marchan>//
- **[3118ed9d6](https://github.com/facebook/react/commit/3118ed9d6)**: Expose unstable_interactiveUpdates on ReactDOM (#12943) //<Andrew Clark>//
- **[524a74331](https://github.com/facebook/react/commit/524a74331)**: Fix for Flow issues in SimpleCacheProvider (#12942) //<Flarnie Marchan>//
- **[ae57b125c](https://github.com/facebook/react/commit/ae57b125c)**: [simple-cache-provider] Use LRU cache eviction (#12851) //<Andrew Clark>//
- **[e0a03c1b4](https://github.com/facebook/react/commit/e0a03c1b4)**: Extend input type check in selection capabilities (#12062) (#12135) //<Spyros Ioakeimidis>//
- **[79a740c6e](https://github.com/facebook/react/commit/79a740c6e)**: Rename variables to remove references to 'global' global (#12931) //<Flarnie Marchan>//
- **[ff724d3c2](https://github.com/facebook/react/commit/ff724d3c2)**: [scheduler] 4/n Allow splitting out `schedule` in fb-www, prepare to fix polyfill issue internally (#12900) //<Flarnie Marchan>//
- **[83f76e4db](https://github.com/facebook/react/commit/83f76e4db)**: ForwardRefs supports propTypes (#12911) //<Brian Vaughn>//
- **[8aeea5afa](https://github.com/facebook/react/commit/8aeea5afa)**: Do not assign node.value on input creation if no change will occur (#12925) //<Nathan Hunzaker>//
- **[aa85b0fd5](https://github.com/facebook/react/commit/aa85b0fd5)**: Upgrade to Jest 23 (#12894) //<Simen Bekkhus>//
- **[61777a78f](https://github.com/facebook/react/commit/61777a78f)**: [scheduler] 3/n Use a linked list instead of map and queue for callback storage (#12893) //<Flarnie Marchan>//
- **[e7bd3d59a](https://github.com/facebook/react/commit/e7bd3d59a)**: No longer expose ReactNativeComponentTree (#12904) //<Sebastian Markbåge>//
- **[f35d989be](https://github.com/facebook/react/commit/f35d989be)**: TestRenderer warns if flushThrough is passed the wrong params (#12909) //<Brian Vaughn>//
- **[557870067](https://github.com/facebook/react/commit/557870067)**: Record "actual" times for all Fibers within a Profiler tree (alt) (#12910) //<Brian Vaughn>//
- **[76e07071a](https://github.com/facebook/react/commit/76e07071a)**: [scheduler] 2/n Adding 'schedule' fixture (#12884) //<Flarnie Marchan>//
- **[345e0a71a](https://github.com/facebook/react/commit/345e0a71a)**: Improve tests for 'schedule' module (#12880) //<Flarnie Marchan>//
- **[8765d6089](https://github.com/facebook/react/commit/8765d6089)**: Update bundle sizes for 16.4.0 release //<Andrew Clark>//
- **[d427a563d](https://github.com/facebook/react/commit/d427a563d)**: Updating package versions for release 16.4.0 //<Andrew Clark>//
- **[53852a887](https://github.com/facebook/react/commit/53852a887)**: add functional components warning about legacy context api (#12892) //<Chang Yan>//
- **[fe747a51c](https://github.com/facebook/react/commit/fe747a51c)**: Add React.Timeout to getComponentName (#12890) //<Toru Kobayashi>//
- **[c601f7a64](https://github.com/facebook/react/commit/c601f7a64)**: add siblings Timeout components test case (#12862) //<Chang Yan>//
- **[735035837](https://github.com/facebook/react/commit/735035837)**: add legacy context API warning in strict mode (#12849) //<Chang Yan>//
- **[e88579184](https://github.com/facebook/react/commit/e88579184)**: Fix a regression that caused us to listen to extra events at the top (#12878) //<Dan Abramov>//
- **[7c0aca289](https://github.com/facebook/react/commit/7c0aca289)**: Rollup freeze: false (#12879) //<Brian Vaughn>//
- **[33289b530](https://github.com/facebook/react/commit/33289b530)**: Tests and fixes for 'timing out' behavior (#12858) //<Flarnie Marchan>//
- **[ad27845cc](https://github.com/facebook/react/commit/ad27845cc)**: Fix double-firing submit events (#12877) //<Sophie Alpert>//
- **[dd5fad296](https://github.com/facebook/react/commit/dd5fad296)**: Update Flow to 0.70 (#12875) //<Dan Abramov>//
- **[13003654e](https://github.com/facebook/react/commit/13003654e)**: Pass "start time" and "commit time" to Profiler callback (#12852) //<Brian Vaughn>//
- **[dc3b144f4](https://github.com/facebook/react/commit/dc3b144f4)**: Treat Rollup "warnings" as errors (#12868) //<Dan Abramov>//
- **[d7b9b4921](https://github.com/facebook/react/commit/d7b9b4921)**: Fix react native example links in README of 'react-reconciler' (#12871) //<Kevin (Kun) "Kassimo" Qian>//
- **[9bed4a6ae](https://github.com/facebook/react/commit/9bed4a6ae)**: https in reactProdInvariant text (#12869) //<Sophie Alpert>//
- **[47b003a82](https://github.com/facebook/react/commit/47b003a82)**: Resolve host configs at build time (#12792) //<Dan Abramov>//

Release Notes:
[GENERAL] [FEATURE] [React] - React sync for revisions c0fe8d6...ae14317

Reviewed By: bvaughn

Differential Revision: D8458731

fbshipit-source-id: afefaa50685d43e70c8ea85c70d2e29dee311cbb
2018-06-16 00:46:24 -07:00
Tim Yung 23f959aab8 FBJS: Upgrade to 0.8.17
Reviewed By: hramos

Differential Revision: D8458729

fbshipit-source-id: 1e92098b2651751f1b7ba3c8da1316fe4c0ca808
2018-06-16 00:46:23 -07:00
Kirill Nikolaev 52f431b4bb Eliminate circular dependency between MessageQueue and JSTimers modules. (#19526)
Summary:
This makes JSTimers actively register a callback for callImmediates.

Besides being generally tricky, circular dependency prevent compiling React Native code with bundlers that rely on concatenating module sources rather that evaluating code at the time of requiring, like Google Closure Compiler.

Sadly, Google Closure Compiler setup that prompted this change is complicated and brittle. And there are no good public tools to find circular dependencies among Haste-style modules (with unqualified require paths).

So some advice on a good test plan would be useful. Does Facebook have any tools to find circular dependencies with Haste-style requires?

FWIW, a check that worked for me was to replace all import paths in React Native from Haste style to normal relative paths (which I needed anyway) and then run [`madge`](https://www.npmjs.com/package/madge) on the code base:

```
$ ~/node_modules/.bin/madge --circular react-native/Libraries
Processed 390 files (7.4s) (81 warnings)

✖ Found 2 circular dependencies!

1) BatchedBridge/NativeModules.js > BatchedBridge/BatchedBridge.js > BatchedBridge/MessageQueue.js > Core/Timers/JSTimers.js
2) StyleSheet/flattenStyle.js > StyleSheet/StyleSheet.js
```

(The second cycle is already eliminated in a8e3c7f578).

[GENERAL] [MINOR] [MessageQueue] - MessageQueue implementation doesn't have a circular dependency on JSTimers.
Closes https://github.com/facebook/react-native/pull/19526

Reviewed By: hramos

Differential Revision: D8458755

Pulled By: yungsters

fbshipit-source-id: e753139b920ba1ad1a6db10f974c03ca195340c7
2018-06-15 17:06:29 -07:00
Dulmandakh 18e9ea2112 Suppress lint errors in Dialog module. remove abortOnError=false (#19740)
Summary:
Suppress lint errors in Dialog module. remove abortOnError=false.

This might hide future problems, so removing it
``` gradle
lintOptions {
  abortOnError false
}
```

Builds locally just fine. But CI is failing for unknown reasons. https://circleci.com/gh/dulmandakh/react-native/265

RNTester will built without errors
Closes https://github.com/facebook/react-native/pull/19740

Differential Revision: D8450600

Pulled By: hramos

fbshipit-source-id: faf508a0c546af18a05ee224628f88b02a38ab9f
2018-06-15 14:28:39 -07:00
Dulmandakh 77a02c0d83 deprecate ReactFragmentActivity (#19741)
Summary:
Android Support Library page says https://developer.android.com/topic/libraries/support-library/
> Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages. For more information, see Version Support and Package Names in this document.

_android.support.v4.app.FragmentActivity_ is used to support **Fragment**s on Android API versions below 11. Now, we support only API version 14 and above, it's ok to remove _ReactFragmentActivity_ that extends _FragmentActivity_.

Once ReactFragmentActivity removed, we can remove some codes that use _android.support.v4_ to work support _ReactFragmentActivity_ on **unsupported** Android versions.

CI is failing for unknown reasons: https://circleci.com/gh/dulmandakh/react-native/278
> Received 'killed' signal

Everything will build and work just fine, except showing _ ReactFragmentActivity_ as deprecated
Closes https://github.com/facebook/react-native/pull/19741

Differential Revision: D8454968

Pulled By: hramos

fbshipit-source-id: e5f901438ef764163af013fe854904a28c73070a
2018-06-15 13:02:11 -07:00
Kevin Gozali 0a530f5d16 iOS: fix up nullability annotation for UIAppDelegate method signature
Reviewed By: TheSavior

Differential Revision: D8454576

fbshipit-source-id: 879b695b1b014a92453bf85f23cc1a0e64f015a3
2018-06-15 12:31:43 -07:00
Héctor Ramos 3f29d2c440 Skip metro bump commits (#19680)
Summary:
New metro releases are published to npm when a "Bump metro" commit is synced to GitHub and picked up by facebook/metro's Circle CI.
The same commit is picked up by facebook/react-native's Circle CI, but it will fail the checkout job because yarn will not find the new package on npm.
This is expected because the package will only be published to npm after Circle CI is done running on facebook/metro.

We can safely skip `yarn install` on these commits, and rely on the restored yarn cache instead.
Closes https://github.com/facebook/react-native/pull/19680

Differential Revision: D8450638

Pulled By: hramos

fbshipit-source-id: 436c229d09bfb4f9f92236c5aeec4a60d8317922
2018-06-15 11:47:40 -07:00
Valentin Shergin dc0ebf7cb0 Fabric: Implementation of <View transform={...}/> property
Summary: After moving all matrix math to C++, the actual client native code is quite trivial.

Reviewed By: fkgozali

Differential Revision: D8344059

fbshipit-source-id: 6910c6af5de64d5f901e82075d30edbde177af40
2018-06-15 11:47:40 -07:00
Valentin Shergin 55f8cfe693 Fabric: Implementation of shadow related props of <View> component
Summary: Quite trivial.

Reviewed By: fkgozali

Differential Revision: D8344060

fbshipit-source-id: 1e44a2ad78e98699dd0ae7ca2816f8c8349bf6d6
2018-06-15 11:47:40 -07:00
Valentin Shergin 5bb538ab5c Fabric: Color conversions function in RCTConversions
Summary:
This is quite interesting.
In Fabric, on C++ layer we store `color` values as `SharedColor` objects which (on iOS) are `shared_ptr`s with custom deallocater (which calls CoreFramework's `CFRelease` function). All this means that we cannot directly transfer ovenership of this managed pointer to ARC (honestly, I am not 100% sure about that, but at least this "shared ownershipt between ARC and non-ARC worlds" concept is as dangerous as any "relying on implementation details" approach). To to so, we have to create a copy and transfer ownership of the copy to ARC (which we do in 1RCTCGColorRefFromSharedColor`).

Reviewed By: fkgozali

Differential Revision: D8344061

fbshipit-source-id: 8b6764e1539b1982b41f502bbd3307c7b6900fd9
2018-06-15 11:47:40 -07:00
Valentin Shergin 8df7d51600 Fabric: Transform type and <View transform/> prop
Summary: The matrix magic and parsing approach are mixins between current iOS and Android implementation.

Reviewed By: fkgozali

Differential Revision: D8344054

fbshipit-source-id: 524b48c5ab61959ce740373534d0d435eb37b647
2018-06-15 11:47:39 -07:00
Valentin Shergin 3c8c01791f Fabric: Implementation of bunch of trivial <View> props
Summary: Pretty straightforward.

Reviewed By: fkgozali

Differential Revision: D8344063

fbshipit-source-id: e6d35353cb3f3e374d2f2b723a612eda2d19c8b7
2018-06-15 11:47:39 -07:00
Valentin Shergin 8bdc1ff10b Fabric: Implementatiton of <View hitSlop={}/> on the native side
Summary: The implementation was basically ported from existing one.

Reviewed By: fkgozali

Differential Revision: D8344057

fbshipit-source-id: c0ec3b7b986080eab62532244da73859b445fcbb
2018-06-15 11:47:39 -07:00
Valentin Shergin cde30eb6b7 Fabric: Basic implementation of <View nativeId={...}>
Summary:
Trivial.
`nativeId` is meant to be used by subclasses of external inspector-like tools, so it does not have any real functionality.

Reviewed By: fkgozali

Differential Revision: D8344064

fbshipit-source-id: d86ef378cda1f7f0e9a7b4ffc09f51004ae530d2
2018-06-15 11:47:39 -07:00
Valentin Shergin da55ef1367 Fabric: Definition of the rest <View> props on C++ side
Summary:
Just definition; we don't have an implementation on the native view layer yet.
And we don't have `transform` prop yet (because it's quite complex).

Reviewed By: fkgozali

Differential Revision: D8344058

fbshipit-source-id: 3b7b41480be8295cbc90b95ebe8562e52c6f81d7
2018-06-15 11:47:39 -07:00
Valentin Shergin f65e4e0174 Fabric: Implemetation of <Switch> component
Summary:
This is pretty straightforward implementation uses native `UISwitch`.
Suddenly we need Switch to test a bunch of other things.

Reviewed By: fkgozali

Differential Revision: D8344055

fbshipit-source-id: cfc51b8bc11198eb9d4d5e4745b96fb3a7f14de1
2018-06-15 11:47:39 -07:00
Valentin Shergin 8fa2d847b6 Fabric: `-[RCTViewComponentView setContentView:]`:
Summary:
This is just the convenient way to embed native views inside custom View components.
See coming <Switch> implementation as an example.

Reviewed By: fkgozali

Differential Revision: D8344056

fbshipit-source-id: 7f5f8cfeeffa7676bc7b562aa07f006cb9006575
2018-06-15 11:47:39 -07:00
Valentin Shergin e311fbb797 Fabric: CornerInsets: Graphical primitive for rect-corner-specific values
Summary: CornerInsets is something like EdgeInsets but about corners instead of edges.

Reviewed By: fkgozali

Differential Revision: D8344062

fbshipit-source-id: 9bf7a8696fba96e3124cb15e8e84093c1f4f8747
2018-06-15 11:47:39 -07:00
Kevin Gozali cb19621dfe Implementation of JS reload without crashing
Summary:
On JS reload the FabricUIManager and EventDispatcher didn't get release due to a retain cycle. This breaks the cycle.

In addition, force release the Scheduler on reload so that the stale classes get cleaned up properly, avoiding crashes. Also the surface now remounts the content correctly

Reviewed By: shergin

Differential Revision: D8414916

fbshipit-source-id: 4b14031f29b3bc9987d7aa765dc0d930a7de2b1e
2018-06-15 11:02:17 -07:00
Kevin Gozali 2ca4770011 fabric: send events via JS thread
Summary: Calling the event emitters on the main thread seems to be problematic, so let's dispatch it via the JS thread. This requires some changes to make "eventTarget" single-use because otherwise the binding would need to synchronize the actual JS call with the act of releasing the target.

Reviewed By: shergin

Differential Revision: D8375291

fbshipit-source-id: bd2b42731176ae209f4a19c232309c163fb1c01b
2018-06-15 11:02:17 -07:00
Jay Phelps 0883e52c74 remove deprecated behavior of touchableHandleActivePressIn/Out called for focus/blur (#19718)
Summary:
Follow up to #18470, which has not yet landed in a release so we may want to hold off merging this until it has so that people receive the deprecation warning.

***

This PR removes the previously deprecated behavior of touchableHandleActivePressIn/Out (as well as onPressIn/Out being called on TV platforms for focus/blur. Instead, users should utilize the new `onFocus` and `onBlur` for these events.

This was because on TV platforms onPressIn/Out was overloaded to trigger for not only presses but these focus events as well. The normal behavior of true presses will still defer to touchableHandleActivePressIn/Out (which defers to onPressIn/Out).

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

[TV] [BREAKING] [Touchable] - On TV platforms `onPressIn` and `onPressOut` on Touchables will now only be triggered for press events, not for focus/blur. Instead, you can use `onFocus` and `onBlur`.

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

Cc/ matthargett
Closes https://github.com/facebook/react-native/pull/19718

Differential Revision: D8450514

Pulled By: hramos

fbshipit-source-id: 818e85a338a451834b54d8965602699fc9b24e87
2018-06-15 10:46:47 -07:00
Eoin Norris a7a2ef1bb6 Possible fix for 18890 (#19687)
Summary:
Potential fixes for 18890. The issue was that when the setAttributedText method in RCTBaseTextInputView.m is called it does two main things:

Check that the attributed text that it receives is equal to the existing attributed text in the underlying backed up view ( backedTextInputView)
If not set the attributed text of the backed up view to the value passed into the method. This kills the dictation as it is effectively the equivalent of typing in the backed up text view.
    self.backedTextInputView.attributedText = attributedText;
is the problem. It kills the dictation. It may have other effects as well.

In all cases I have seen the underlying text of the attributed string that is passed in the same as the text in the backedTextInputView, what was said to the dictation; however the attributes are different, which causes the isEqualToAttributedString: check to fail and thus the update happens, and the keyboard is killed.

Fix is to test for the underlying string equality not the attributed string equality when the input mode is dictation.

By necessity this had to be an integration test on an existing application. To test I enabled the keyboard and started the dictation. It worked with this fixes and not without. Will upload videos later.

This might break attributes on dictation, as it is happening. However anything set on the existing underlying text view should hold.

[IOS] [BUG] [Textinput] fixed an issue where the keyboard dictation ended abruptly.
Closes https://github.com/facebook/react-native/pull/19687

Differential Revision: D8450590

Pulled By: hramos

fbshipit-source-id: f97084131f98e9e0ed1f32111afc0f9f510f3b3b
2018-06-15 10:37:42 -07:00
Vojtech Novak 4e1abdd74d fix permission requests on pre-M android (#19734)
Summary:
On pre-M devices, `PermissionsAndroid.request` currently returns a boolean, whereas on newer, it returns GRANTED, DENIED or other constants defined in `PermissionsModule.java`

given the example form the [docs](https://facebook.github.io/react-native/docs/permissionsandroid.html) which I guess many people use, this will lead to code that does not work before M (it will tell you that permissions are not given even if they are in the manifest).

I believe the author of [this](51efaab120) forgot to change the resolved value in this one place but changed it in other places, eg [here](51efaab120 (diff-2a74096453bc8faa5d4a1599ad0ab33fL99)).

The docs are written correctly:

> On devices before SDK version 23, the permissions are automatically granted if they appear in the manifest, so check and request should always be true.

but the code is not right because we'd need to check for `if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {`

Also, the behavior is done correctly in [requestMultiplePermissions](26684cf3ad/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java (L148)) so returning a boolean is an inconsistency.

I tested this locally. The code is the same as on line [148](26684cf3ad/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java (L148)) where it is done correctly.

[ANDROID] [BUGFIX] [PermissionAndroid] - return GRANTED / DENIED instead of true / false on pre-M android

<!--
  **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/19734

Differential Revision: D8450402

Pulled By: hramos

fbshipit-source-id: 46b0b7f83f81d817d60234f155d43de7f57248c7
2018-06-15 10:37:42 -07:00
gengjiawen 86d8c7a9b3 Bugfix/ci lint proguard (#19724)
Summary:
* avoid lint to interrupt ci
* add proguard rules
pass all ci
none
 [GENERAL] [ENHANCEMENT] [CI] - Fix lint and proguard
Closes https://github.com/facebook/react-native/pull/19724

Differential Revision: D8446721

Pulled By: hramos

fbshipit-source-id: b21c5418210b27dda6a7194995a25df39af0c92a
2018-06-15 08:01:51 -07:00
Héctor Ramos 5fd5e6b230 Revert "Bump soloader to 0.5.0 (#19676)" (#19739)
Summary:
This reverts commit e3c5524bc6.
Closes https://github.com/facebook/react-native/pull/19739

Differential Revision: D8446714

Pulled By: hramos

fbshipit-source-id: 1b0e78fe57e9864faafcc766364bd76a1ba5bd03
2018-06-15 07:47:43 -07:00
Peter van der Zee b8402852a2 Bump Metro dep in RN preset to 39.1, preset to 5.0.2
Reviewed By: rubennorte

Differential Revision: D8445528

fbshipit-source-id: e8937509bb1384a2d62e880c860306d8c86dab92
2018-06-15 07:22:09 -07:00
Vojtech Novak 1723b6cd9c Checkbox to inherit from AppCompatCheckBox (#18318)
Summary:
The checkbox components inherits from `android.widget.CheckBox`. `AppCompatCheckBox` offers better appearance and support for advanced features (eg. tinting) on older APIs.

~~However, the build fails for some reason; If somebody could shed some light on this, I'd appreciate it.~~ Thanks for the comment, I was being blind and somehow ignored the BUCK file.

I have created a simple app with a checkbox.

Screenshot from android 4.1 (current master):

<img src="https://user-images.githubusercontent.com/1566403/37357997-2d34bdb8-26ea-11e8-8c77-709a4f96c6bf.png" width="300" />

Screenshot after applying the change, also android 4.1:

<img src="https://user-images.githubusercontent.com/1566403/37358016-3c28fb86-26ea-11e8-8dca-3a92e41450c9.png" width="300" />

https://github.com/facebook/react-native/pull/18300 (this PR is needed to support tinting on older android api levels)

[ANDROID]  [ENHANCEMENT]  [Checkbox] - Checkbox inherits from AppCompatCheckBox
Closes https://github.com/facebook/react-native/pull/18318

Differential Revision: D7268393

Pulled By: hramos

fbshipit-source-id: 01cb2819f4d56c4e0f94cdd1fb5e1a90667a398a
2018-06-15 00:30:49 -07:00
David Vacca 3bc62f3610 Keep UIManagerModule as a default renderer
Reviewed By: fkgozali

Differential Revision: D8439626

fbshipit-source-id: d761d977c9e6dab38f21e18da72b045483431f79
2018-06-14 22:48:37 -07:00
Kevin Gozali 5230b23130 ios: expose surfaceForRootTag: up the chain
Summary: The app needs to find the surface by rootTag at some point.

Reviewed By: shergin

Differential Revision: D8391957

fbshipit-source-id: b0bb107b7be882071890afb46de17b50e7ee060d
2018-06-14 20:46:34 -07:00
Eli White d904361477 Tightening some Image Flow Types
Reviewed By: yungsters

Differential Revision: D7270059

fbshipit-source-id: 3b9727363aeb6910fbbdc613a70d9e8cac97b3b1
2018-06-14 19:57:16 -07:00
David Vacca 0dc86dfd91 Add systrace logging for Fabric android
Reviewed By: fkgozali

Differential Revision: D8387339

fbshipit-source-id: 2e202566541cc25fb6b8773a94e607e8b40fb0ce
2018-06-14 18:47:18 -07:00
David Vacca d62e432446 Adding UIManager performance counters in Fabric
Reviewed By: fkgozali

Differential Revision: D8381255

fbshipit-source-id: d817557c8a3033d0d7ae47e5ea0a21d224279e29
2018-06-14 18:47:18 -07:00
David Vacca e773b36990 Refactor Log to Flog in Fabric
Reviewed By: shergin

Differential Revision: D8363593

fbshipit-source-id: fb4104b66ef3d50d4101c39a1bf4515e6d0ecd19
2018-06-14 18:47:17 -07:00
hamaron 1ffb2b63be iOS: Fixed the bug where a Backspace event was emitted when entering characters after clearing a text in TextInput by an empty string (#18627)
Summary:
The bug #18374 was caused by the loose condition to execute `stringByReplacingCharactersInRange` in the method `textInputShouldChangeTextInRange` . As a result, `findMismatch` wrongly returning `true` which ends up the Backspace event being fired in another `textInputShouldChangeTextInRange` call in `textInputDidChange`.

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

1. Pass all the tests by `yarn run test`
2. Run the following code and type any text. (This code is brought from #18374. Thank you michalpetrov!!) And then verify that 'Backspace' events are not emitted after clearing text
and entering any letters.

```javascript
type Props = {};
type State = {
  text: string,
  keys: string
};
export default class App extends Component<Props, State> {
  state = {text: '', keys: ''}
  render() {
    return (
      <View style={styles.container}>
        <TextInput style={styles.textInput} value={this.state.text} onChangeText={this.onChangeText} onKeyPress={this.onKeyPress}/>
        <Button title="Clear" onPress={this.onClear}/>
        <Text>Text: {this.state.text}</Text>
        <Text>Keys: {this.state.keys}</Text>
      </View>
    );
  }

  onChangeText = (text: string) => {
    this.setState({text})
  }

  onKeyPress = ({ nativeEvent }: Object) => {
    this.setState({keys: this.state.keys + nativeEvent.key + ', '})
  }

  onClear = () => {
    this.setState({text: '', keys: ''})
  }
}
```

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

[IOS] [BUGFIX] [TextInput] - Fixed the bug where Backspace event was emitted when entering a character after clearing a text in TextInput by an empty string

<!--
  **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/18627

Differential Revision: D8436331

Pulled By: hramos

fbshipit-source-id: ec75a6ca926061cbf7cb106db652f2b4a71c9a0c
2018-06-14 18:30:54 -07:00
gengjiawen 8200c98029 add RNTester to ci (#19673)
Summary:
* Current ci is missing an important part to test the whole part. With this we can make sure the js and android part compiles.
* Ensure the current android proguard rules is okay.

The `my-release-key.keystore` is just a copy of debug.keystore in `react-native/keystores`.
Pass all ci.
none
 [GENERAL] [ENHANCEMENT] [CI] - Add RNTester to ci
Closes https://github.com/facebook/react-native/pull/19673

Differential Revision: D8435419

Pulled By: hramos

fbshipit-source-id: d3d92a5d1b8477c1f298643cc96695769e5c93ea
2018-06-14 18:30:54 -07:00
Héctor Ramos e8fea879fd Update GitHub Issue templates (#19723)
Summary:
Now that we have templates for everything we want to handle in the repo, the bot will go back to automatically closing issues that do not use one of the provided templates.

We have an escape valve for generic issues ("For Discussion"), so anyone who gets their issue closed automatically by the bot is unlikely to have read our instructions.
Closes https://github.com/facebook/react-native/pull/19723

Differential Revision: D8435415

Pulled By: hramos

fbshipit-source-id: 41db33cefce1367ad8f3d9440b7bba27565679cb
2018-06-14 17:46:58 -07:00
Dulmandakh 699e5eebe8 bump gradle-plugin@2.3.3, gradle@3.5.1, gradle-download-task@3.4.3 (#19697)
Summary:
bump gradle-plugin@2.3.3, gradle@3.5.1, gradle-download-task@3.4.3, as we landed build tools 26.0.2 with 065c5b6590

Will improve Android build performance.

Everything will work as normal, but build faster.

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

[ANDROID] [ENHANCEMENT] [TOOLS] - bump gradle-plugin@2.3.3, gradle@3.5.1, gradle-download-task@3.4.3
Closes https://github.com/facebook/react-native/pull/19697

Differential Revision: D8433743

Pulled By: hramos

fbshipit-source-id: da72aeb314bed7f63807a0c69bebd24c633cc807
2018-06-14 17:02:18 -07:00
Dulmandakh 6d56a234e3 add google maven repo in android project template (#19712)
Summary:
This PR will add Google maven repo to RN project template that contains com.android.support:appcompat-v7:26.1.0, thus fixes `react-native run-android` using version 0.56.0-rc.1

CI is Green - https://circleci.com/gh/dulmandakh/react-native/235

new Android projects will build and run just fine.
Closes https://github.com/facebook/react-native/pull/19712

Differential Revision: D8433730

Pulled By: hramos

fbshipit-source-id: b7d5a1cd5a97b1c4aad2a307158d6dbfcf9a42a5
2018-06-14 16:21:42 -07:00
Jens Panneel 75e49a0637 Feature/add decimal pad to android (#19714)
Summary:
For a current use-case we need the a keyboard with characters 0-9 and a decimal point (or comma depending on language settings)

This exists on iOS as UIKeyboardType "decimalPad" and this is what react-native maps to for both "numeric" and "decimal-pad". This also exists on Android as inputType "numberDecimal", but is currently not accessible through react-native.

This PR maps the value "decimal-pad" of the keyboardType property of TextInput to the Android inputType "numberDecimal", effectively making "decimal-pad" cross platform without breaking anything.

* https://facebook.github.io/react-native/docs/textinput.html#keyboardtype
* https://developer.apple.com/documentation/uikit/uikeyboardtype
* https://developer.android.com/reference/android/widget/TextView#attr_android:inputType

There is this bug in some Samsung keyboards where both the - sign and decimal sign disappear when the keyboardType is set to "number" and both the "signed" and "decimal" flags are set. (Like is the case when using the react-native keyboardType prop "numeric".) https://androidforums.com/threads/numeric-soft-keyboard-missing-minus-sign-in-android-8-0-samsung-a5.1272628/

For developers that need decimal numbers but not negative ones, using "decimal-pad" will provide a workaround. I reproduced this on a Samsung A5 only, but maybe other phones have this exact issue. https://github.com/facebook/react-native/issues/12988 https://github.com/facebook/react-native/issues/12977 https://github.com/facebook/react-native/issues/17473 https://github.com/facebook/react-native/issues/17474

* Added testcase consistent with existing keyboardType tests
* Also added testcase for the related, but missing number-pad

This PR follows the same approach as the recently merged PR introducing "number-pad" b638847a46

Documentation PR: https://github.com/facebook/react-native-website/pull/405

 [ANDROID] [ENHANCEMENT] [TextInput] - Added "decimal-pad" keyboard type
Closes https://github.com/facebook/react-native/pull/19714

Differential Revision: D8429185

Pulled By: mdvacca

fbshipit-source-id: 6b56da2088f2be427ebffa04c4e17c91ffb9f7d9
2018-06-14 14:01:51 -07:00
Héctor Ramos 0858300f74 Publish releases automatically, update docs (#19715)
Summary:
Now that tests are green, we can return to automatic publishing to npm based on git tags. As long as all tests are passing, deploying a new release of React Native is as easy as tagging a commit. I've updated `Releases.md` to reflect today's release process.

Future Work: Include information about updating the website, as this is no longer done automatically.
Closes https://github.com/facebook/react-native/pull/19715

Differential Revision: D8429834

Pulled By: hramos

fbshipit-source-id: 2c6f2c80ac43c4e6d20c01e06ba14a7e4b16180d
2018-06-14 14:01:51 -07:00
Tim Yung e8087eccdb YellowBox: Restore ES5 Compatibility
Reviewed By: sahrens

Differential Revision: D8421561

fbshipit-source-id: c2b8d430f4d0c9ce0d5177f0af5eb5f404916024
2018-06-14 09:02:18 -07:00
Vojtech Novak e3d3533bc5 improve NativeModuleRegistryBuilder.java (#16402)
Summary:
I met the error `Native module xyz tried to override xyz for module name xyzModuleName. If this was your intention...` after something went wrong during `react-native link` - one module somehow ended up being included twice in the `getPackages` method, as in:

```java
Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage(),
            new WowPackage(),
            new WowPackage(),
```

Since I have > 20 native modules it took me a little while to find out what the problem was. The improved error message should make the problem clearer to anybody who may encounter it. I did try to refactor the code a little more, by extracting the whole part of:

```java
        String name = moduleHolder.getName();
        if (namesToType.containsKey(name)) {
          Class<? extends NativeModule> existingNativeModule = namesToType.get(name);
          if (!moduleHolder.getCanOverrideExistingModule()) {
            throw new IllegalStateException(getModuleOverridingExceptionMessage(
              type.getSimpleName(),
              existingNativeModule.getSimpleName(),
              name
            ));
          }

          mModules.remove(existingNativeModule);
        }

        namesToType.put(name, type);
        mModules.put(type, moduleHolder);
```

out into a separate method since there were two places where nearly identical code was written.

I have built RN from source and used it in a very simple app with RN vector icons (the package creates a native module as can be seen [here](https://github.com/oblador/react-native-vector-icons/blob/master/android/src/main/java/com/oblador/vectoricons/VectorIconsPackage.java#L19)).

After including the module twice, ie.

```java
        Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                    new MainReactPackage(),
                    new VectorIconsPackage(),
                    new VectorIconsPackage()
            );
        }
```

I get the improved error description, as seen in the screenshot.

<img src="https://user-images.githubusercontent.com/1566403/36340960-3289d9d0-13e7-11e8-8d17-e1651da17841.png" height="500">

[ANDROID] [MINOR] [NativeModuleRegistryBuilder] - Improve error message and refactor putting native modules to module maps
Closes https://github.com/facebook/react-native/pull/16402

Differential Revision: D8421392

Pulled By: hramos

fbshipit-source-id: 719bd37b4681933d35858621b402ae73dd460a5b
2018-06-14 08:25:39 -07:00
Miguel Jimenez Esun ef4c42d284 Bumping Metro to 0.39.1
Reviewed By: rafeca

Differential Revision: D8418105

fbshipit-source-id: 66032deb53f46a388b81233e8d00d7af6a2c7fa7
2018-06-14 06:19:03 -07:00
Mattijs Fuijkschot 8baaacb664 - Keyboard layout now updates when changing keyboardType while it has focus (#19027)
Summary:
This PR makes sure that changing the `keyboardType` props of `<TextInput>` is reflected while the text field has focus. It is something that is also discusses in #13782. The workaround mentioned in that issue using `key` causes the TextInput to re-render itself which has some undesired side-effects.

Fixes #13782

```javascript
export default class KeyboardTypeApp extends Component {
  state = { keyboardType: 'default' };

  toggleKeyboardType = () => {
    this.setState({
      keyboardType: this.state.keyboardType === 'default' ? 'numeric' : 'default'
    });
  }

  render() {
    return (
      <View style={{ padding: 40 }}>
        <TextInput autoFocus value="Press Toggle :)" keyboardType={this.state.keyboardType} />
        <Button title="Toggle" onPress={this.toggleKeyboardType} />
      </View>
    );
  }
}
```

![video](https://user-images.githubusercontent.com/706368/39268429-3e331440-48d0-11e8-947c-7d334e3cec50.gif)

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

 [IOS] [ENHANCEMENT] [TextInput] - Keyboard layout now updates when changing `keyboardType` while it has focus

<!--
  **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/19027

Differential Revision: D8416007

Pulled By: PeteTheHeat

fbshipit-source-id: c4f89ab3dc0819bca52feddbc9c7a9f62fd96794
2018-06-13 22:47:47 -07:00
Tim Yung f6da9e1a9a YellowBox: Define in __DEV__ Only
Summary: This makes it so that `YellowBox` and its dependencies are completely stripped from production bundles.

Reviewed By: sahrens

Differential Revision: D8402545

fbshipit-source-id: 6993521280a02dfe5eab8863d12c46781f35444f
2018-06-13 18:08:25 -07:00
Eli White 3e3b10f404 Support animated values for border dimensions
Summary:
The flow types for these were too restrictive.

Fixes https://github.com/facebook/react-native/issues/19093

Reviewed By: yungsters

Differential Revision: D8409550

fbshipit-source-id: e4774e8856efc998ff1fa6cdcbe7b0cb6db2c4e3
2018-06-13 17:34:47 -07:00
Dulmandakh 065c5b6590 use android build-tools 26.0.2 and set compileSdk to 26 (#19662)
Summary:
Android Target API Level 26 will be required starting from August 2018, it's so soon 😄.Read https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html

This PR uses android build tools 26.0.2, support library 26.1.0 (with android lifecycle) and setting compileSdkVersion to 26, but leaving minSdkVersion and targetSdkVersion intact, which will make targeting 26 easy.

Circle CI: https://circleci.com/gh/dulmandakh/react-native/209

Everything will build and work just fine.

[ANDROID] [ENHANCEMENT] [TOOLS] - Use android build-tools 26.0.2 and set compileSdk to 26, and use support library version 26.1.0.
Closes https://github.com/facebook/react-native/pull/19662

Differential Revision: D8398855

Pulled By: hramos

fbshipit-source-id: a4066eb04cb5f947efe1f3202b638c1092b79aae
2018-06-13 10:39:55 -07:00
Tim Yung 4f0b9e2554 YellowBox: Apply SafeAreaView in Header
Summary: Uses `SafeAreaView` in the YellowBox inspector header so that it does not collide with the status bar.

Reviewed By: sahrens

Differential Revision: D8374861

fbshipit-source-id: e67358ac9268db8291cacf79df402f3bd5a2173d
2018-06-12 17:48:20 -07:00
Rafael Oleza a7a5b666eb Bump metro@0.39.0
Reviewed By: mjesun, davidaurelio

Differential Revision: D8380199

fbshipit-source-id: 6b9e3aa343e8d0526a3c42d5ea266c44428d31f8
2018-06-12 13:58:10 -07:00