Commit Graph

11464 Commits

Author SHA1 Message Date
Pieter De Baets eb0d99c812 Conditionally export JSTimers (retry)
Reviewed By: davidaurelio

Differential Revision: D5469811

fbshipit-source-id: db7d783d7104123f4402c147d9553f8d393bbf83
2017-07-21 08:16:11 -07:00
Summer Kitahara 794dddc5bd Show RN Dev Menu after 2 rage shakes
Reviewed By: achen1

Differential Revision: D5427430

fbshipit-source-id: cac761c550ff2627f1bbbbde9e9b8d3f122bbb45
2017-07-21 00:02:23 -07:00
Fred Liu 1728a866ef Revert D5465182: creatClass codemod
Differential Revision: D5465182

fbshipit-source-id: a15de76f50294123323e211f8e11106b90fff911
2017-07-20 19:32:33 -07:00
Brian Vaughn 500d5e23a6 creatClass codemod
Reviewed By: acdlite, flarnie

Differential Revision: D5465182

fbshipit-source-id: 084d364abb7bf74e799dbf24a4c1c01a3bf7cd46
2017-07-20 18:18:56 -07:00
Sandro Machado bdd46aa283 Fix `HEAD` http requests in Android
Summary:
Closes https://github.com/facebook/react-native/issues/7463.

This PR fixes the `HEAD` http requests in Android.
In Android all the HEAD http requests will fail, even if the request succeeds in the native layer due to an issue in the communication with the `OkHttp`.
Closes https://github.com/facebook/react-native/pull/14289

Differential Revision: D5166130

Pulled By: hramos

fbshipit-source-id: a7a0deee0fcb5f6a645c07d4e6f4386b5f550e31
2017-07-20 16:34:38 -07:00
Nat Mote 8e8fecdcf8 Upgrade to Flow v0.50.0
Reviewed By: gabelevi

Differential Revision: D5438335

fbshipit-source-id: 7a96f68e7147e984c6f0cb84f957e639d36ca6b3
2017-07-20 14:48:56 -07:00
Krzysztof Magiera b8fafb46c1 Stop native driver animations when value is set.
Summary:
This diff changes the behaviour of natively driven animations in case the node that they are being run for has its value changed using `setValue` or as a result of an incoming event.

The reason for changing that is to match the JS implementation of `setValue` which behaves as described above (see relevant code here: 7cdd4d48c8/Libraries/Animated/src/AnimatedImplementation.js (L743))

**Test Plan:**
Use this sample app: https://snack.expo.io/B1V7RX9r-
Change: `USE_NATIVE_DRIVER` const between `true` and `false`.
See the animation stops regardless of the state of `USE_NATIVE_DRIVER` unlike before when it would stop only when `USE_NATIVE_DRIVER` was set to `false`
Closes https://github.com/facebook/react-native/pull/15054

Differential Revision: D5463750

Pulled By: hramos

fbshipit-source-id: e164c5299588ba8cac2937260c9ba9f6053b04e5
2017-07-20 14:20:30 -07:00
Marc Horowitz 2334899dfe in RCT_DEBUG mode, make the js stack bigger
Reviewed By: javache

Differential Revision: D5459755

fbshipit-source-id: 169cb542c92ea6d5e438c4bbe35879e7a097a3aa
2017-07-20 12:16:21 -07:00
Rex Rao f32627f890 Fix cropImage crash with float displaySize
Summary:
On Android, using `ImageEditor.cropImage` with `displaySize` option may causes crash with exception below:

```
FATAL EXCEPTION: mqt_native_modules
                                                   Process: me.sohobloo.test, PID: 11308
                                                   com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `double'
                                                       at com.facebook.react.bridge.ReadableNativeMap.getInt(Native Method)
                                                       at com.facebook.react.modules.camera.ImageEditingManager.cropImage(ImageEditingManager.java:196)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
                                                       at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:141)
                                                       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                       at android.os.Handler.handleCallback(Handler.java:815)
                                                       at android.os.Handler.dispatchMessage(Handler.java:104)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                       at android.os.Looper.loop(Looper.java:194)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                       at java.lang.Thread.run(Thread.java:818)
```

This is caused by getInt from `number` type of JS.

```javascript
      ImageEditor.cropImage(
        uri,
        {
          offset: {x: 0, y: 0},
          size: {width: 320, height: 240},
          displaySize: {width: 320.5, height: 240.5}
        }
      );
```
Closes https://github.com/facebook/react-native/pull/13312

Differential Revision: D5462709

Pulled By: shergin

fbshipit-source-id: 42cb853b533769b6969b8ac9ad50f3dd3c764055
2017-07-20 11:15:57 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Chirag Jain bf752014a9 use propTypes directly
Summary:
Just noticed this commit creates a new variable for propTypes instead of using it directly. c2c97ae4b1

Should be straighforward.
Closes https://github.com/facebook/react-native/pull/15113

Differential Revision: D5460980

Pulled By: javache

fbshipit-source-id: 7446be8af22557d4bd4eddb711272b914ca48112
2017-07-20 03:19:45 -07:00
Shir Levkowitz ced1513b62 Pass actual loaded image size to load (iOS).
Summary:
Motivation: The JavaScript image component's onLoad callback optionally
accepts dimensions width and height, allowing the parent of the image to
obtain the native size (without an extra bridge call). It was found that
the dimensions passed into this callback on iOS are frequently (0,0),
not the true native dimensions. This change ensures that the image's
dimensions are passed to the callback. (Examination of the initializer
for RCTImageSource, + (RCTImageSource *)RCTImageSource:(id)json,
indicates that not all code paths produce a size other than CGSizeZero.)
Closes https://github.com/facebook/react-native/pull/15116

Differential Revision: D5460979

Pulled By: javache

fbshipit-source-id: 2dca03c3aae974ef70e981039aa6a804b8e128c8
2017-07-20 03:05:11 -07:00
Guichaguri bc0717c6cc Android: Added support to arrays in toBundle
Summary:
The support for `ReadableArray` in `toBundle` was never implemented, throwing an `UnsupportedOperationException` when trying to convert an array.

* Created `toList` -- A method that converts a `ReadableArray` to an `ArrayList`
* Modified `toBundle` to support arrays using `toList`
* Created `fromList` -- A method that converts a `List` to a `WritableArray`
* Modified `fromBundle` to also support lists using `fromList`

This PR allows `toBundle` and `fromBundle` (as well as `toList` and `fromList`) to work consistently without loosing information.

**Test Plan**

I've created three different arrays: one full of integers, one full of strings, and one mixed (with a integer, a boolean, a string, null, a map with a string and a boolean array), putting all of them inside a map.

After converting the map to a `Bundle` using `toBundle`, the integer array was retrieved through `Bundle.getIntegerArrayList`, the string array through `Bundle.getStringArrayList` and the mixed array through `Bundle.get` (casting it to an `ArrayList`)

After checking whether each value from the bundle was correct, I converted the bundle back to a map using `fromBundle`, and checked again every value.

The code and results from the test can be found in [this gist](https://gist.github.com/Guichaguri/5c7574b31f9584b6a9a0c182fd940a86).
Closes https://github.com/facebook/react-native/pull/15056

Differential Revision: D5460966

Pulled By: javache

fbshipit-source-id: a11b450eae4186e68bed7b8ce7dea8e5982e689a
2017-07-20 02:44:12 -07:00
Janic Duplessis 3ce36698de Validate the content type of the bundle returned by the packager
Summary:
When using the packager behind something like an http tunnel it is possible something else than JS is returned, in that case throw an error instead of trying to parse it.

This is useful for Expo since the packager runs behind ngrok. This allows to intercept that error and show a more meaningful error message based on the ngrok response.

**Test plan**
Tested by changing the packager to return text/html content type and validate that the error shows up properly.
Also tested that it works when multipart response is disabled.

<img width="354" alt="screen shot 2017-07-19 at 8 01 58 pm" src="https://user-images.githubusercontent.com/2677334/28394905-39e86d52-6cbe-11e7-9059-13a85816a57e.png">
Closes https://github.com/facebook/react-native/pull/15112

Differential Revision: D5459395

Pulled By: shergin

fbshipit-source-id: aaea7ab2e1311ee8dc10feb579adf9b9701d8d4c
2017-07-19 19:10:00 -07:00
Hector Ramos b6454e948f How to Contribute updates
Summary:
Rename "Testing" guide. Add docs for several new GitHub bot commands. Format commands table.

Built website and verified everything looks good.
Closes https://github.com/facebook/react-native/pull/15111

Differential Revision: D5458660

Pulled By: hramos

fbshipit-source-id: 151ea0cbd18489bc527193682464ca291d6ab467
2017-07-19 17:47:01 -07:00
Valentin Shergin 42d6323fe0 TextInput: Actual `reactAccessibilityElement` implementation
Summary: Because of some rebase issue `reactAccessibilityElement` was implemented with old invalid name, which breaks some accessibility features.

Reviewed By: mmmulani

Differential Revision: D5458283

fbshipit-source-id: 1e66a2f54c1f1a85118c9432b68895679a10059c
2017-07-19 17:21:02 -07:00
Tieme van Veen 94b6cda8a7 Docs: Updated iOS Component Guide
Summary:
Follow up on https://github.com/facebook/react-native/issues/14436

hramos:
>  MapViewIOS was removed a couple of versions ago. No one has touched this guide in a while, so unless someone volunteers to get it back up to date, we'll probably end up removing it from the docs.

I'm volunteering to get it back up to date!

- Fixed broken code examples
- Swapped out `pitchEnabled` for `zoomEnabled`, needs less explaining and it's easier to test on a simulator.
- Renamed RNTMap to RNTMapView for clarity.
- Renamed inconsistent `onChange`s to onRegionChange`.
- Swapped out 'vending' for 'exposing'.

I wasn't really sure about the last 3 points. I think it's more clear like this, but please review.

I'll add some review comments as well.
Closes https://github.com/facebook/react-native/pull/14991

Differential Revision: D5416319

Pulled By: hramos

fbshipit-source-id: bc70942a66acc5e3967b245af8271a1d2465ab60
2017-07-19 15:31:29 -07:00
Brian Vaughn c2c97ae4b1 Ran PropTypes -> prop-types codemod
Reviewed By: gaearon

Differential Revision: D5453511

fbshipit-source-id: 6abe3dfa6d8cf70cc49ce2b6a7d3e94679398c5e
2017-07-19 15:02:05 -07:00
Trevor Brindle dcd5ace645 add tabrindle to Issue Task Force
Summary:
Per hramos - adding myself to React Native GitHub Issue Task Force.
Closes https://github.com/facebook/react-native/pull/15110

Differential Revision: D5456159

Pulled By: hramos

fbshipit-source-id: 9d0be71ef5a2a2e324b78902cb88604cd83829f4
2017-07-19 14:46:22 -07:00
Marc Horowitz 05c4de0b51 Add a delegate hook for providing a different JS implementation
Reviewed By: javache

Differential Revision: D5404876

fbshipit-source-id: d86ca9943b4b45616fc90bf14e8b0607d3cdb93c
2017-07-19 13:49:32 -07:00
Hector Ramos d5fe05fd67 Exclude the dangerfile from eslint.
Summary:
Before:

```
$ npm run lint

> react-native@1000.0.0 lint /Users/hramos/git/react-native
> eslint .

Cannot find module 'ljharb/eslint-config'
Referenced from: /Users/hramos/git/react-native/danger/node_modules/extend/.eslintrc
Error: Cannot find module 'ljharb/eslint-config'
Referenced from: /Users/hramos/git/react-native/danger/node_modules/extend/.eslintrc
    at ModuleResolver.resolve (/Users/hramos/git/react-native/node_modules/eslint/lib/util/module-resolver.js:74:19)
    at resolve (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:515:25)
    at load (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:532:26)
    at configExtends.reduceRight (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:424:36)
    at Array.reduceRight (native)
    at applyExtends (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:408:28)
    at Object.load (/Users/hramos/git/react-native/node_modules/eslint/lib/config/config-file.js:566:22)
    at loadConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:63:33)
    at getLocalConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:130:29)
    at Config.getConfig (/Users/hramos/git/react-native/node_modules/eslint/lib/config.js:260:26)

```

After:

```
$ npm run lint

> react-native@1000.0.0 lint /Users/hramos/git/react-native
> eslint .

/Users/hramos/git/react-native/babel-preset/configs/internal.js
  11:5  warning  'resolvePlugins' is assigned a value but never used  no-unused-vars
  16:2  warning  Missing semicolon
...
✖ 5047 problems (1001 errors, 4046 warnings)
```
Closes https://github.com/facebook/react-native/pull/15109

Differential Revision: D5455350

Pulled By: hramos

fbshipit-source-id: e76dae2804018ccb3da526f14cc0df2424e0d6b4
2017-07-19 13:49:32 -07:00
Arnold Noronha 2639e7f123 Revert D5446953: [react-native] Conditionally export JSTimers
Differential Revision: D5446953

fbshipit-source-id: 8275e1b71b8fac9b120c8ddff486f9cd88b7939d
2017-07-19 13:06:02 -07:00
Miguel Jimenez Esun 737abe3b76 Revert D5388655: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5388655

fbshipit-source-id: 2f92d6ae69f4772195aeca7493f53209388b3ad0
2017-07-19 12:08:38 -07:00
Paco Estevez Garcia 0d16c7c982 Add app name to inspector device url
Reviewed By: bnham, Hypuk

Differential Revision: D5443705

fbshipit-source-id: 8c924948dd512be077e2f566da0cfc4110d5f843
2017-07-19 11:47:44 -07:00
Paco Estevez Garcia 90fad3c68b Add app name to PageInfo
Reviewed By: dcaspi

Differential Revision: D5436099

fbshipit-source-id: 73be706fbb36fe7c16b206de7ca3ba0cc3fa019b
2017-07-19 11:47:44 -07:00
Miguel Jimenez Esun 3103258ca0 BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5388655

fbshipit-source-id: dc403f3d5e2d807529eb8569a85c45fec36a6a3e
2017-07-19 11:04:33 -07:00
Hector Ramos d1c9746902 Move CONTRIBUTING guidelines to a standalone doc in the website.
Reviewed By: TheSavior

Differential Revision: D5448961

fbshipit-source-id: c8491b003413e8af22987ea578d6f7bbe1552b31
2017-07-19 10:23:06 -07:00
Valentin Shergin 2605024dcf Selfishly add myself and Pieter to CODEOWNERS
Summary:
Trivial changes in CODEOWNERS.
Closes https://github.com/facebook/react-native/pull/15092

Differential Revision: D5452441

Pulled By: shergin

fbshipit-source-id: c9b33750a69f944a6d4eff16233f35ef6ef8bc6c
2017-07-19 09:15:35 -07:00
Pieter De Baets a68f6fab0f Conditionally export JSTimers
Reviewed By: fkgozali

Differential Revision: D5446953

fbshipit-source-id: c08bd873024d591f5186a3a6767f319de3b6b6d8
2017-07-19 05:45:08 -07:00
sm2017 7e29b1fc77 Update WebSocketModule.java
Summary:
Convert to base64 not utf8

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15046

Differential Revision: D5451398

Pulled By: javache

fbshipit-source-id: b8c6c7b0fb50ca9558e92d3f63a088e343791b7f
2017-07-19 02:34:56 -07:00
Hector Ramos c7a596534f Update Dangerfile, fix flagging IssueCommands.txt changes
Summary:
The bot was incorrectly flagging PRs that do not touch IssueCommands.txt. This PR fixes the Dangerfile rule.

Verify the warning is generated on a PR that touches IssuesCommands.txt:

```
$ DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger pr https://github.com/facebook/react-native/pull/15087

> @ danger /Users/hramos/git/react-native/danger
> node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/15087"

{
  fails: [],
  warnings: [
    {
      message: "📋 Test Plan - <i>This PR appears to be missing a Test Plan.</i>"
    },
    {
      message: " Bots - <i>This PR appears to modify the list of people that may issue commands to the GitHub bot.</i>"
    }
  ],
  messages: [],
  markdowns: []
}

```

Verify it does not warn on a PR that does not modify IssueCommands.txt:

```
$ DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger pr https://github.com/facebook/react-native/pull/15089

> @ danger /Users/hramos/git/react-native/danger
> node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/15089"

{
  fails: [],
  warnings: [],
  messages: [],
  markdowns: []
}
```
Closes https://github.com/facebook/react-native/pull/15090

Differential Revision: D5451092

Pulled By: hramos

fbshipit-source-id: 54f0426871391153db81ab02d3d1b3b7f1e75fac
2017-07-19 01:52:45 -07:00
Ranjan Shrestha 1afee0bc0e Native Animated - Override __makeNative in AnimatedInterpolation
Summary:
Fixes the error `Trying to update interpolation node that has not been
attached to the parent` in android which occurs when using multiple
Animated.Values along with interpolation and an animation is run before
another one that uses interpolation. On ios, no error is thrown in such
case but the animation also doesn't work as expected.

You can check the snack code here which works properly without
useNativeDriver: true. But fails on android and skips the first stage
of animation on ios.
  https://snack.expo.io/HyD3zdjSZ

**Test Plan**
The animations worked properly after the __makeNative override made
the parent node native as well.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15077

Differential Revision: D5449066

Pulled By: shergin

fbshipit-source-id: 2f0b6ea712a0ab12c1c545514a3686a9a6aeebed
2017-07-18 18:02:22 -07:00
JSON Deppen af48b4855b Remove typo
Summary:
<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15089

Differential Revision: D5448987

Pulled By: shergin

fbshipit-source-id: eb240517dc94475744f1bda2652f8aff994c0bcd
2017-07-18 17:46:33 -07:00
Valentin Shergin 8760b938a2 Unified usage of RCTAssertUIManagerQueue
Reviewed By: javache

Differential Revision: D5440518

fbshipit-source-id: fe0df85aa3361402f9bdaa800fc3b1f10162814b
2017-07-18 15:15:59 -07:00
dlowder-salesforce f082e6cffd Apple TV Cocoapods support
Summary:
**Motivation**

Support Apple TV for people adding React Native to their projects using Cocoapods.

**Test plan**

Working test project at https://github.com/dlowder-salesforce/react-native-tvos-cocoapods-test
Closes https://github.com/facebook/react-native/pull/15065

Differential Revision: D5443791

Pulled By: javache

fbshipit-source-id: dc46a72df0d73a0049f1c3f9368658e5f3d1ecb8
2017-07-18 15:15:59 -07:00
Pieter De Baets 6e68f2d954 Update podspec integration instructions
Summary:
You need to add CxxBridge or BatchedBridge as a dependency while we have both. When we stop shipping the BatchedBridge in OSS, this requirement will disappear again.
Closes https://github.com/facebook/react-native/pull/15084

Differential Revision: D5446885

Pulled By: javache

fbshipit-source-id: aa0023cc08e97fc59e2071a3750f98026e34fd0d
2017-07-18 15:04:44 -07:00
Valentin Shergin 603cc48ceb TextInput: Refined contentSize calculation
Summary: This fixes pretty bad issue when contentSize is calculated based on an intrinsic horizontal (width) limitation, not on a real/current horizontal (width) one.

Reviewed By: mmmulani

Differential Revision: D5422114

fbshipit-source-id: 0eb582aeb59d29530990d4faabf2f41baa79c058
2017-07-18 14:46:22 -07:00
Valentin Shergin f5d9b5210e ScrollView: Couple of unnecessary checks was removed from RCTCustomScrollView
Summary:
* Now `setFrame:` is called by autoresizing masks, so it is safe.
* Nobody calls `setBounds:`, so it is also safe.

Reviewed By: javache

Differential Revision: D5414441

fbshipit-source-id: 6fc51c7598c4817301db51f627aa1e9840642fec
2017-07-18 14:46:22 -07:00
Valentin Shergin 7da5ef372c TextInput: Simplified `selectTextOnFocus` logic
Summary: Previous implementation was not quite correct (because it was framed by hacky event handling) and caused some issues with new ScrollView improvements (autoscroll to focused TextInput).

Reviewed By: javache

Differential Revision: D5414439

fbshipit-source-id: 72d1f23170340c453b939dca8b72422822acc1d7
2017-07-18 14:46:22 -07:00
Valentin Shergin 1d22f8fb27 ScrollView: Smart `contentOffset` preserving
Summary:
Previous `contentOffset` can be invalid for a new layout and overscroll the ScrollView, so the diff fixes that.
Also documented here: https://github.com/facebook/react-native/issues/13566

Reviewed By: mmmulani

Differential Revision: D5414442

fbshipit-source-id: 7de1b4a4571108a37d1795e80f165bca5aba5fef
2017-07-18 14:46:22 -07:00
Valentin Shergin 301830dc2a ScrollView: Use autoresizing masks for layouting actual UIScrollView
Summary:
Surprisingly enough, even if semantically the code remains identical, layouting via autoresizing masks applies changes to subviews a bit earlier than iOS calls `layoutSubviews`.
This allows us to avoid situations where we already explicitly set calculated by Yoga frames and want to scroll to some subview, but actual layout have not done yet and internal views has wrong frames.

Reviewed By: javache

Differential Revision: D5414440

fbshipit-source-id: d4152c9c68dc17f6827832dcb45e5ba86fb82831
2017-07-18 14:46:22 -07:00
Valentin Shergin fa1d4e8d81 ScrollView/TextInput: The amnesty of `scrollRectToVisible`
Reviewed By: javache

Differential Revision: D5414438

fbshipit-source-id: 45b6a32bc2584ed99efd1514d724e2b5ca29d8e9
2017-07-18 14:46:22 -07:00
Valentin Shergin f89e132719 TextInput: textInputShouldEndEditing and textInputDidEndEditing were moved to base class
Reviewed By: mmmulani

Differential Revision: D5395925

fbshipit-source-id: 0c67beccd74d981ab2a89f9cb31990301793b408
2017-07-18 14:46:22 -07:00
Valentin Shergin a50c9c8e22 TextInput: `selection` property was unified
Summary:
This diff unifies `selection` prop between single line and multi line text inputs.
Besides that, this diff improves the selection event handling, makes it more robust and predictable.
(See inline comments.)

Reviewed By: mmmulani

Differential Revision: D5317652

fbshipit-source-id: db5b0d2c0b80268e479ba866980e14b444079386
2017-07-18 14:46:22 -07:00
Valentin Shergin 4ff3e101ac TextInput: Hacks related to missed `textInputDidChange` were moved to adapter
Summary:
iOS has tendency to skip `textInputDidChange` event (irregulary, across all dispatch ways: target-action, delegate, notification center)
when text input looses focus. Usually it happens when autocorrection applies some changes automatically on loosing focus, but I think these are bunch of different cases.
So, the workaround is pretty simple: if there was no `textInputDidChange` event between `shouldChangeText` and `didEndEditing`, we create it manually.

Previously these workaround complicate our business logic, now they was decoupled in separate adapter.

Reviewed By: mmmulani

Differential Revision: D5317651

fbshipit-source-id: 138143213e8752fe9682229c51685aef614c00dd
2017-07-18 14:46:22 -07:00
Valentin Shergin d69e60bb7a TextInput: Unified support of `clearTextOnFocus` prop
Summary: The implementation of `clearTextOnFocus` was unified and moved to baseclass.

Reviewed By: javache

Differential Revision: D5299489

fbshipit-source-id: ff166f9bb0673ff8766f20b677f56810f64d7b2d
2017-07-18 14:46:22 -07:00
Valentin Shergin cb96f1d5d2 TextInput: Unified support of `clearsOnBeginEditing` prop
Summary: The implementation of `clearsOnBeginEditing` was unified and moved to superclass.

Reviewed By: javache

Differential Revision: D5299396

fbshipit-source-id: 98c5494a782cbe4df5b2d6021828eb7b2012f6dc
2017-07-18 14:46:22 -07:00
Valentin Shergin 8f93ce680d TextInput: Unified support of `blurOnSubmit` prop
Summary:
Now the business logic of `blurOnSubmit` is pretty simple and lives inside `RCTTextInput`,
whereas UIKit hacks/workarounds lives inside `RCTBackedTextInputDelegateAdapter`.

Reviewed By: javache

Differential Revision: D5299397

fbshipit-source-id: 6a9d4194324ff9446c74fdb32ad5357e849e471d
2017-07-18 14:46:22 -07:00
Valentin Shergin da9a183e81 TextInput `setSelection` method was moved to base class
Summary: This method was identical between two subclasses, so it was moved to baseclass.

Reviewed By: javache

Differential Revision: D5297401

fbshipit-source-id: 8f56bef33f9ab0184f69da76177b5e8da10d7514
2017-07-18 14:46:22 -07:00
Valentin Shergin ee9697e515 Introducing `RCTBackedTextInputDelegate`
Summary:
Nothing behavioral changed in this diff; just moving code around.

`RCTBackedTextInputDelegate` is the new protocol which supposed to be common determinator among of UITextFieldDelegate and UITextViewDelegate
(and bunch of events and notifications around UITextInput and UITextView).

We need this reach two goals in the future:
 * Incapsulate UIKit imperfections related hack in dedicated protocol adapter. So, doing this we can fix more UIKit related bugs without touching real RN text handling logic. (Yes, we still have a bunch of bugs, which we cannot fix because it is undoable with the current architecture. This diff does NOT fix anything though.)
 * We can unify logic in RCTTextField and RCTTextView (even more!), moving it to a superclass. If we do so, we can fix another bunch of bugs related to RN imperfections. And have singleline/multiline inputs implementations even more consistent.

Reviewed By: mmmulani

Differential Revision: D5296041

fbshipit-source-id: 318fd850e946a3c34933002a6bde34a0a45a6293
2017-07-18 14:46:22 -07:00