Summary:
Related to #22100
Enhance TouchableWithoutFeedback with press and target event types.
There are still work to do to update `UNSAFE_componentWillReceiveProps` and `touchableGetHitSlop` to make Flow not complain about `DeprecatedEdgeInsetsPropType` inexact type.
Pull Request resolved: https://github.com/facebook/react-native/pull/22479
Reviewed By: RSNara
Differential Revision: D13310764
Pulled By: TheSavior
fbshipit-source-id: 9002e542378491fb800c8e81c63f4fbe125b563c
Summary:
iOS-specific.
For languages with complex input (such as Japanese or Chinese), a user has to type multiple characters that are then merged into a single one.
If `-[UITextView setAttributedString:]` is used while the user is still typing, it resets the input and characters are not being treated as typed together.
This PR avoids calling this method if possible, replacing it by just copying the attributes if the string has not been changed. That preserves the state and user can continue to type Korean or Chinese characters.
Fixes#19339
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
<!--
Required: Write your test plan here. If you changed any code, please provide us with
clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->
Essentially, the steps to reproduce are described in [the issue](https://github.com/facebook/react-native/issues/19339):
1. Type some Korean characters in TextInput, such as "하늘" (buttons `ㅎ`,`ㅏ`,`ㄴ`,`ㅡ`,`ㄹ`).
2. Then move the cursor to the beginning of the text, type "파란" (buttons `ㅍ`,`ㅏ`,`ㄹ`,`ㅏ`,`ㄴ`) this time.
**Behaviour before this fix (broken)**
Actual text: `ㅍㅏㄹㅏㄴ하늘`.
Expected text: `파란하늘`.
Characters aren't combined properly.

**Behaviour after this fix (correct)**
Actual text: `파란하늘`.
Expected text: `파란하늘`.
Characters are combined, the same behaviour is in vanilla iOS `UITextView`.

<!--
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] [TextView] - Fix Korean/Chinese/Japanese input for multiline TextView on iOS.
<!--
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAL ] [ BUGFIX ] [ {Component} ]
[ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19809
Differential Revision: D13326614
Pulled By: shergin
fbshipit-source-id: 6a5cab3f7290f0f623a6f4c29353a573eb321b0b
Summary:
Use Xcode 10.1 and iOS 12.1 SDK to run iOS tests on an iOS 12.1 iPhone XS Simulator, all of which are available on a default Xcode 10.1 install.
Note that we were previously running iOS tests using Xcode 10.1 and the 12.1 SDK in a separate `test_xcode10` workflow on Circle CI. This was in place to allow us to track Xcode 10 compatibility during the Xcode 10 beta. Now that Xcode 10 has been public for a while, we can drop the compatibility check and use Xcode 10 in our main iOS test workflow.
Reviewed By: TheSavior
Differential Revision: D13317891
fbshipit-source-id: 04c17bf3a2e9d3617f14a46b4ed30a5491a4f4a4
Summary: It was made dead by the previous revisions
Reviewed By: amnn
Differential Revision: D13313263
fbshipit-source-id: b8c8402b5427dc5d3efbbd2ee871aebf1e14ee0d
Summary:
This avoids an intermittent reentrancy bug in JSC on iOS 11
(https://bugs.webkit.org/show_bug.cgi?id=186827). It also makes the
code more consistent with android.
Reviewed By: amnn
Differential Revision: D13313265
fbshipit-source-id: f42476b2f660e127ecfc9c72584554817eea1010
Summary:
In the version of JSC on iOS 11, creating a JSContext on one
thread and using it on another can trigger subtle and nearly
impossible to debug reentrancy-related crashes in the VM (see
https://bugs.webkit.org/show_bug.cgi?id=186827). In !NDEBUG builds,
check for this case and throw an exception, so it can be detected
early.
Reviewed By: amnn
Differential Revision: D13313264
fbshipit-source-id: ee85435c20e23c8520495ce743d2f91f2eeada5c
Summary:
I think a common pattern is to use async functions with the onRefresh prop to reload data. I made the type `mixed` since we don't care about what the function returns. Could also be `void | Promise<void>` I haven't really seen a pattern for those in the codebase.
Pull Request resolved: https://github.com/facebook/react-native/pull/22376
Differential Revision: D13310372
Pulled By: TheSavior
fbshipit-source-id: 445f28cf2c37f9c937e72d76716002deaf9d9c94
Summary: Computing things like "page faults since this thread was created" or "cpu time spent on this thread since it was created" is pretty easy - just measure it when you want it. However, if you want to know "how much wall time has elapsed since this thread was created" you need to record some timing info when the thread is created. This diff adds a an API for querying that from the RN thread holder abstraction.
Reviewed By: alexeylang
Differential Revision: D13246235
fbshipit-source-id: d36af61dbe27f662980fe508b2644e9d5255bb7e
Summary:
Trivial. Coveralls expects CI_BRANCH to be set. Circle uses CIRCLE_BRANCH instead. Without this, Coverals will attribute coverage reports to a "patch-1" branch.
Pull Request resolved: https://github.com/facebook/react-native/pull/22489
Differential Revision: D13306787
Pulled By: hramos
fbshipit-source-id: 70ad525168f249f4ca7f0370ba941632c33da8c5
Summary: This is one more step to remove `fbjs` from `react-native-github`. This changes both the internal and external code to use `invariant` from zertosh instead of the copy in fbjs.
Reviewed By: yungsters
Differential Revision: D13195941
fbshipit-source-id: 73564ca1715110e7da9c7ef56dc57374d61377e0
Summary:
Continuation of https://github.com/facebook/react-native/pull/22174 with an exception that `local-cli` folder is left in React Native repository to keep Facebook internal and React Native calls still working.
Separate strategy should be developed to remove all uses of `local-cli` in favor of dedicated utilities.
Pull Request resolved: https://github.com/facebook/react-native/pull/22337
Reviewed By: TheSavior
Differential Revision: D13172898
Pulled By: cpojer
fbshipit-source-id: 0217867f9944648307475ebe629eb729da7bfaaf
Summary:
This was in the wrong section
[Internal]
Reviewed By: yungsters
Differential Revision: D13285234
fbshipit-source-id: 1c3b3825a0f99028efe1f1f002d5519ad6ab4494
Summary:
Currently, if you load an animated gif using the standard `Image` component, it will not correctly respect the loop count property found in the Netscape App Extension block of the file. The issues are as follows:
1) If the App Extension isn't present, the animated gif loops indefinitely when it should not loop at all.
2) If the App Extension is present, the animated gif loops one less time than it should.
The other issue is that once the looping completes, the image doesn't pause at the last frame but instead, loops back to the beginning of the animation e.g. frame 1.
The fix does a few things:
1) If there is _no_ App Extension present, the image doesn't loop at all
2) If there _is_ an App Extension present, it loops the correct amount of times. For instance, if the loop count is 1, it means the gif should loop _once_ after it finishes playing, for a total of _two_ total loops.
3) Once the number of loops completes (assuming loop count isn't set to 0 which means infinite), the animation pauses on the last frame.
Pull Request resolved: https://github.com/facebook/react-native/pull/21999
Differential Revision: D13287005
Pulled By: hramos
fbshipit-source-id: f7210ad40e0e76c9ec454953b8a067569d3feaaa
Summary:
Adds a new step to the test suite. Test coverage is now collected and sent to Coveralls.
Initial configuration is limited to the Libraries/ and local-cli/ directories. Please let me know if additional directories should be considered.
I have enabled this repo on the coveralls service. The coveralls token has been added to React Native's Circle CI environment variables.
- Track coverage on PRs, and fail PRs that lower the coverage %
- Increase coverage :)
[INTERNAL] [ENHANCEMENT] [.circleci/config.yml] - Start tracking code coverage (JS)
Pull Request resolved: https://github.com/facebook/react-native/pull/21017
Differential Revision: D9724396
Pulled By: hramos
fbshipit-source-id: 61da4478877805f9a9a3c9670b54ddc4e40e958b
Summary:
This diff fixes a NPE happening in StatusBarModule when the style passed by parameter is null.
Even if JS shoulnd't send a null value, this method should not crash with an NPE. I'm not changing behavior, only avoiding NPE when status is null
Reviewed By: RSNara
Differential Revision: D13287057
fbshipit-source-id: cc5ac4e97083d63f2bf65c03bac0dc9bce976423
Summary:
Detox was failing because of build errors due to the new xcode10 build system. These errors were fixed by RSNara in b7349f9857 but this callsite was missed.
Pull Request resolved: https://github.com/facebook/react-native/pull/22468
Reviewed By: RSNara
Differential Revision: D13287386
Pulled By: TheSavior
fbshipit-source-id: 8a2df9801c69d851eabe7074ffc12b29c03a636a
Summary:
Fixes#22421
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22423
Differential Revision: D13287099
Pulled By: TheSavior
fbshipit-source-id: e4ac0fb930107dde092541fd17d4c81907c8cc34
Summary:
`ShadowTree` class is already thread-safe, so we don't need to (we should not) guard concurent access to it.
We should guard concurrent write-access to the collection of them though.
Note that unordered_map is "thread-compatible" collection, so concurrent reading access is okay.
Reviewed By: mdvacca
Differential Revision: D13269745
fbshipit-source-id: 4779626018da0e42b81a835e538f6c1d1a8e25f7
Summary: Trivial diff that cleans up measure function in C++ and Android
Reviewed By: shergin
Differential Revision: D13200340
fbshipit-source-id: 6c0888439640241cdedf514898a1ba3dac231d6a
Summary: Right now JSBundleLoader is tightly coupled to CatalystInstanceImpl; this diffs adds an interface, JSBundleLoaderDelegate, that CatalystInstanceImpl implements so that we can use the bundle loader with other classes.
Reviewed By: mdvacca
Differential Revision: D13216752
fbshipit-source-id: fc406ef30f12ed9d3ed13a062dedd7b33f3b7985
Summary: This change attempts to fix a crash within RCTImageCache's new dateWithHeaderString method. This is a speculative fix as there aren't any concrete repro steps.
Reviewed By: hramos
Differential Revision: D13278666
fbshipit-source-id: cdb69b1296c946d89e14c074329280994d87ddcd
Summary: Added more information to ending tags so that they can be connected with the starting tags.
Reviewed By: mdvacca
Differential Revision: D7121038
fbshipit-source-id: 72d51952955e22a4c8d66c4f9e75a3fd9d34df7f
Calling -[UIScrollView setContentOffset] with NaN values can cause a crash. That's not clear why exactly the computation returns NaN sometime, but the implemented sanitizing should help to detect this problem during development (and this also prevents the app from crashing).
See attached task for more details.
Reviewed By: fkgozali
Differential Revision: D13242729
fbshipit-source-id: 747bf1b42e02597e9f1300eee24547563ab29b27
Summary:
`JSBigString` is using functions from `unistd.h`, like `getpagesize`, `dup`, `open`, etc. but was not directly including it.
It was being included from inside the glog `logging.h` header, which in turn was getting included by the Folly headers `JSBigString` was using.
This was discovered while building CxxReact with a custom shimmed Glog.
Pull Request resolved: https://github.com/facebook/react-native/pull/22330
Differential Revision: D13115346
Pulled By: shergin
fbshipit-source-id: 9fe4e3b28f74c0ca351ac6308484e375eace4db4
Summary:
Adding an “UNSAFE_” prefix to `componentWillMount`.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
- [x] yarn test
- [x] yarn flow
- [x] yarn flow-check-ios
- [x] yarn flow-check-android
[General] [Fixed] - adding an UNSAFE_ prefix
Pull Request resolved: https://github.com/facebook/react-native/pull/22125
Differential Revision: D13237831
Pulled By: mmmulani
fbshipit-source-id: b4ca1e4628f93e89fd5680c40b0e3f7c7db6ad38
Summary:
The reasoning behind this change is that right now, having both added and modified modules inside of a single `modules` field doesn't allow for basic operations like combining two deltas.
For instance, say I have three different bundle revisions: A, B and C.
Module 42 was added in B, and then removed in C.
A->B = `{modules: [42, "..."], deleted: []}`
B->C = `{modules: [], deleted: [42]}`
A->C = `{modules: [], deleted: []}`
However, were we to compute A->C as the combination of A->B and B->C, it would result in `{modules: [], deleted: [42]}` because we have no way of knowing that module 42 was only just added in B.
This means that the `deleted` field of delta X->Y might eventually contain module ids that were never present in revision X, because they were added and then removed between revisions X and Y.
The last time I changed the delta format, we had a few bug reports pop out from people who had desync issues between their version of React Native and their version of Metro. As such, I've tried to make this change backwards compatible in at least one direction (new RN, old Metro). However, this will still break if someone is using a newer version of Metro and an older version of RN. I created T37123645 to follow up on this.
Reviewed By: rafeca, fromcelticpark
Differential Revision: D13156514
fbshipit-source-id: 4a4ee3b6cc0cdff5dca7368a46d7bf663769e281
Summary: Fixes a minor Flow type error when `minimist` is typed via `flow-typed`.
Reviewed By: TheSavior
Differential Revision: D13188680
fbshipit-source-id: 9ad35a3222c8937163a998a2751efd95945af3c7
Summary: Upgrades to `chalk@^2.4.1`. Verified no dependencies to the breaking changes in `chalk@2.0.0`.
Reviewed By: cpojer
Differential Revision: D13192150
fbshipit-source-id: 27a1a53d50a3c7628528a4f21e7166d452b2f205
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `TouchEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123042
fbshipit-source-id: 594b89b6e3986d6a04846194701e3a727b152cec
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `ScrollViewEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123049
fbshipit-source-id: 2839976d0119c48fa2538dbaa53afbc24982c598
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in ViewEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123048
fbshipit-source-id: 3c323912d3e65b684f99df6cda99c785876164af
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in SwitchEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123046
fbshipit-source-id: f2e4905a96191540ceec633bae1871c93be724db
Summary:
Now the event delive pipeline supports `JSI::Value`-based payload. Instead of passing `folly::dynamic`, now we are passing `std::function<jsi::Value(jsi::Runtime &runtime)>` as factory that can build a `JSI::Value` with given `jsi::Runtime` and any captured data.
The old (now legacy) way of calling `EventEmitter::dispatchEvent(..., const folly::dynamic &payload, ...)` is also supported.
Reviewed By: sahrens
Differential Revision: D13123043
fbshipit-source-id: d65348bb215013042abb2fcfe5083a8c697333d0
Summary: Now instead of passing `reactTag` through the whole event pipeline, we store it inside `EventTargetWrapper` (and it does not leave `UIManagerBinding`). It helps with reducing the complexity of `EventEmitter` and will help us in migrating to JSI.
Reviewed By: sahrens
Differential Revision: D13123045
fbshipit-source-id: aa9ee94d5660ff3090369c1e55cf748d2e72b987
Summary:
That's generally better because:
* Avoids exposing ShadowNode to mounting layer;
* Enables hashing and comparing the AttributedString based on actual meaningful data (not on just a pointer to ShadowNode).
Reviewed By: mdvacca
Differential Revision: D13205230
fbshipit-source-id: 7b79c1aad97b10d81e3faa10408be61b74f815cf
Summary: Trivial. We need this for future use as part of AttributedString's hash.
Reviewed By: mdvacca
Differential Revision: D13205231
fbshipit-source-id: 14a3decae72741030284a30abdb936616bafb3fe
Summary:
ShadowView, ShadowViewMutation, and Differentiator were decoupled to separate module.
That enables us to use ShadowView more widely without facing a circular dependency problem.
Reviewed By: mdvacca
Differential Revision: D13205229
fbshipit-source-id: 7373864bf153a7813c2f97edb263a41454ce0b88
Summary: Pretty straightforward wiring UIManager and the new feature in ShadowTree: we get the node, clone with the new props and then replace this.
Reviewed By: sahrens
Differential Revision: D13114788
fbshipit-source-id: 3a34fb879f3ec564c26278034a19b88518302de8