Summary:
In the current implementation of the `VirtualizedList` the `onViewableItemsChanged` callback wouldn't trigger if the underlying list data changes. (see example snack https://snack.expo.io/Hk5703eBb)
I added a method in the `ViewabilityHelper` to invalidate the cached viewableIndices, which gets triggered when the list-data changes.
Closes https://github.com/facebook/react-native/pull/14922
Differential Revision: D5864537
Pulled By: sahrens
fbshipit-source-id: 37f617763596244208548817d5b138dadc12c75d
Summary:
Thanks for submitting a PR! Please read these instructions carefully:
- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.
<!-- What existing problem does the pull request solve? -->
Indentation of package.json including Jest is a hard tab. Since package.json generated by npm has two spaces, I want to make it the same.
<!--
A good test plan has the exact commands you ran and their output, provides screenshots or videos if t[he pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.
If you have added code that should be tested, add tests.
-->
![package.json diff](https://cloud.githubusercontent.com/assets/12539/24228268/80421416-0fb6-11e7-9af3-d034c1756379.png)
Sign the [CLA][2], if you haven't already.
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.
For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.
[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13099
Differential Revision: D4770208
Pulled By: ericnakagawa
fbshipit-source-id: 13f91068e40610473cd7b65e182a0fdc59af03ba
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
I was quite lost when the documentation told me to go figure the event mapping out myself. It took me quite a while to figure out that i needed to register the names in the `ViewManager`.
This code snippet just makes it way easier to figure out what you need to do to add events.
Closes https://github.com/facebook/react-native/pull/16293
Differential Revision: D6060595
Pulled By: ericnakagawa
fbshipit-source-id: c4755cdb8d99797ff5248ec4eb7e58e2f7ac2588
Summary:
The title speaks for itself. Docs regarding secureTextEntry of TextInput were not descriptive enough. Owing to that, it took me more than an hour of debugging to find the issue of why the TextInput in my app was not hiding the input with secureTextEntry.
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/16272
Differential Revision: D6060614
Pulled By: ericnakagawa
fbshipit-source-id: 419ad6956e67b9adefae8d789b3fd76181c4194b
Summary:
`Jest` allows to use fake timers and according to https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame the return value should be `A long integer value, the request id, that uniquely identifies the entry in the callback list`. This allows to use `cancelAnimationFrame`.
In current implementation of `jest/setup.js`, the return value is undefined. Therefore it's not possible to cancel the animation frame request.
```
let id = null;
const registerCallback = (callback) => {
clearCallback();
id = requestAnimationFrame(() => {
id = null;
callback();
});
};
const clearCallback = () => {
if (null !== id) {
cancelAnimationFrame(id);
id = null;
}
};
```
```
jest.useFakeTimers();
const callback = jest.fn();
registerCallback(callback);
clearCallback();
jest.runAllTimers();
expect(callback).toHaveBeenCalledTimes(0); // Will be error in current implementation, since nothing is cleared. And test will pass, after MR is merged
```
This is fake example, but the real usage is when the animation frame request should be removed on `ComponentWillUnmount`.
[JEST] [BUGFIX] [requestAnimationFrame] - return request id
Closes https://github.com/facebook/react-native/pull/16367
Differential Revision: D6060578
Pulled By: ericnakagawa
fbshipit-source-id: c785a3380f5e267b48ae16fcf34dbbf95fa54178
Summary:
References #7070
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Docs are incomplete, start filling them out
N/A
Closes https://github.com/facebook/react-native/pull/16346
Differential Revision: D6057501
Pulled By: hramos
fbshipit-source-id: c30d3369fa1a73ef6a93c2ed8f8c53af5a1af7ee
Summary:
Removing remaining references to Travis, which is removed in #16354.
Test Plan
None
Closes https://github.com/facebook/react-native/pull/16364
Differential Revision: D6057590
Pulled By: hramos
fbshipit-source-id: 574a5cbbddbc09b48307d70555901b6ab5940e40
Summary:
The first code block already uses the new `connectionChange` event instead of
the deprecated `change` event, so change this example code block as well to use
the new event.
I came across this while upgrading my RN version. In the debug-console I saw a deprecation warning, despite I was using the example-code. Looking at the source, I saw the example code block still used the deprecated event, so update it to use the new one.
Closes https://github.com/facebook/react-native/pull/16357
Differential Revision: D6054428
Pulled By: hramos
fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
Summary:
Doc update to clarify how to prevent `Animated.loop` and other animations from pre-empting `VirtualizedList` rendering as discussed in #16092.
Closes https://github.com/facebook/react-native/pull/16136
Differential Revision: D6057466
Pulled By: hramos
fbshipit-source-id: 946bcde97b364c623b48ddaeb643309630c072c9
Summary:
unbundle is a useful feature, and it should be exposed. In order to get the most use out of
we expose it as an option at build time in the Build Phase on XCode and the project.ext.react
config in the build.gradle.
Because it is best used with inline requires we add a section under performance that describes
how inline requires can be implemented and how to use with the unbundling feature.
Testing:
- Added a section of the doc which explains how the feature can be enabled
- Use the instructions, build a build on iOS + android (using release so that the bundle is created) and confirm that the bundle has the binary header information.
Closes https://github.com/facebook/react-native/pull/15317
Differential Revision: D6054642
Pulled By: hramos
fbshipit-source-id: 067f4d2f78d91215709bd3e3636f460bc2b17e99
Summary:
This pull request migrates Travis to Circle and pre-starts iOS simulators / tvOS ones as advised in documentation to speed up builds. It also uses Xcode 9.0 to build and test apps.
Note that podspec test is failing and it's been failing for a while on Travis as well (since podspec has been changed to use Cxx bridge by default). I've notified few folks here of that and we are looking to fix this test, but it's not related to the scope of this PR.
Also, previously, podspec tests were only runninng on master (disabled for PR builds) where I think it makes more sense to run them on PR builds as well (all in all, we want to prevent breakage before merging). That said, I've removed `if` check to make it run on all builds.
Other small changes:
- cache `node_modules` properly (previously defined as restore_cache and save_cache but not referenced in following jobs)
Closes https://github.com/facebook/react-native/pull/16354
Differential Revision: D6054858
Pulled By: hramos
fbshipit-source-id: 5165bef0985f4257febced14873be5bcb80b9f51
Summary:
grabbou has to write release notes for every release, and that's getting ridonc. Have you seen the changelog from 0.48?
PR writers need to do their own, hopefully in a standardized format so it can be scripted.
Just a PR template change, just proofreading needed. Please mention if have missed or added any extra Categories, Types, or Where columns.
Here's a sample:
[GENERAL] [ENHANCEMENT] [PULL_REQUEST_TEMPLATE.md] - added release notes/changelog requirement to PR Template
Closes https://github.com/facebook/react-native/pull/15874
Differential Revision: D6054557
Pulled By: hramos
fbshipit-source-id: 5741b98a0efdb1a6aaaeedaa292403b82ce713f6
Summary:
Hi there!
I set up the repo because I want to do a little contribution to the Android side but ran into trouble [running tests](https://facebook.github.io/react-native/docs/contributing.html). The Android environment validation kept failing. While the messages were a little helpful, it would have saved me a bit of time and research if I had some helpful examples to copy-and-paste. In my case, I'm using Android SDK Tools on the command line. Hopefully, this will help others when setting up!
Run `./scripts/run-android-local-unit-tests.sh` with each of the following to see the expanded help messages:
* Make sure `$ANDROID_HOME/platforms/android-$MAJOR` is _not_ present.
* Make sure `$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION` is _not_ present.
* Make sure `JAVA_HOME` is _not_ set and/or is _not_ in `PATH`.
Closes https://github.com/facebook/react-native/pull/16222
Differential Revision: D6044875
Pulled By: ericnakagawa
fbshipit-source-id: febacbd08fb632b349c352035f24eed891fbd154
Summary:
Rebased version of #12842 that was reverted because of failing fb internal tests.
Closes https://github.com/facebook/react-native/pull/15919
Differential Revision: D5823956
Pulled By: hramos
fbshipit-source-id: 4ece19a403f5ebbe4829c4c26696ea0575ab1d0e
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html
Happy contributing!
-->
Cxx module code swallows c++ exception details with sarcastic comment let native developer figure it out.
Now instead of swallowing it, we print as much information as we can for different exception types.
Still not ideal but way more informative.
Have a crash in your c++ module and try to figure it out without this change.
Closes https://github.com/facebook/react-native/pull/16193
Differential Revision: D6040038
Pulled By: javache
fbshipit-source-id: 3fbe838383ca13395e21f74c9549474f6329cfeb
Summary:
- [x] Explain the **motivation** for making this change.
It fixes#14313
Closes https://github.com/facebook/react-native/pull/14495
Differential Revision: D6042094
Pulled By: hramos
fbshipit-source-id: d70e42bfee0a22882bad91cb885fb0cfc91c7d38
Summary:
Trivial.
That's okay that sometimes shadowNodes and views hierarchies have lack of synchonization.
Reviewed By: sahrens
Differential Revision: D6040022
fbshipit-source-id: 6b49a82317b620b66a87441719fddcafb1f27934
Summary:
Metro Bundler ships with `react_native_fb` flow annotations whereas our repo is set to ignore `react_native_oss` flow issues.
For now, a hot fix is to make our repo ignore both.
Detailed discussion happens here: 87cfc05ea6 (commitcomment-24884835)
Those changes have been applied to `0.50.0-rc.0` in order to make it green.
Closes https://github.com/facebook/react-native/pull/16310
Differential Revision: D6031378
Pulled By: hramos
fbshipit-source-id: 491d866bb35bd6c30a27dbc04586b15144a8efb2
Summary:
I've submit few PRs for bug fix in recent releases and I've been working actively on some commercial react-native projects. I'd like to contribute the project with issues management and PR reviews.
Closes https://github.com/facebook/react-native/pull/16328
Differential Revision: D6040721
Pulled By: hramos
fbshipit-source-id: 61347fe53112c5ed89c6d58d2c7fec341db974be
Summary:
Fails on my machine due to fact that `replace` returns an instance of a String, rather than an instance of ShellString (that includes `to` on its prototype).
Solution is to use an explicit `writeFileSync`. You can see that change in the wild on 0.50-stable branch.
CC janicduplessis (edit by hramos)
Closes https://github.com/facebook/react-native/pull/16303
Differential Revision: D6031331
Pulled By: hramos
fbshipit-source-id: 41c583d53df75bea1a55fa19174d912e414209c0
Summary: When we built packager asset system we were mostly concerned about images. However, this system can also be used to work with videos, animations and other binary resources. The code that sorts assets into Android resource folders currently just shoves all non-drawable resources under `drawable-mdpi`, which is not ideal. Talking to Android experts on the team, `raw` seems like a much better place for other resources.
Reviewed By: jeanlauliac
Differential Revision: D6026633
fbshipit-source-id: cc2199f60da411ea432972a02f52c459ff5c490a
Summary:
This is first PR from the series I am going to be sending as a result of fixing 0.50-stable test suite. This one removes `mockFS` dependency that has been causing failures on Node 6.x container.
Here's build before this change: https://circleci.com/gh/facebook/react-native/22529
Here's build after this change: https://circleci.com/gh/facebook/react-native/22538 (green)
Note that the CI may be still red as there are other PRs to be addressed. You can see this in the wild on 0.50.
Closes https://github.com/facebook/react-native/pull/16301
Differential Revision: D6031352
Pulled By: hramos
fbshipit-source-id: 5c97ae6c87864c094e29e5d8987521071c67f5bd
Summary:
We're spreading this in via `...ViewPropTypes` also. Having both confuses
flow when you try to pass style (even though they're identical), when the
types are defined via `React.ElementProps`
Reviewed By: jingc
Differential Revision: D6028659
fbshipit-source-id: 203e29682d34f1648a47d9ddbaef0c9630fbcb99
Summary:
Recent changes that introduced Circle 2 (thanks ide and hramos for work on this) include special step for analyzing code. It takes PR number and processes the build.
Unfortunately, that breaks all non-PR builds (including ones scheduled by me as a part of release step).
This PR simply checks if such env variable is set and stops executing in case it's undefined.
Also, I have updated the order of the tests so that most important (unit tests) are no longer shadowed by temporary eslint and flow breakage. The reason for this change is that flow has been broken for ~20 days which shadowed breakage in unit tests (addressed in my other PR).
You can see build breaking before this change: https://circleci.com/gh/facebook/react-native/22391
And being green after: https://circleci.com/gh/facebook/react-native/22530
Closes https://github.com/facebook/react-native/pull/16302
Differential Revision: D6031348
Pulled By: hramos
fbshipit-source-id: f1127a87faa872f413e9fcb780bdc1d5d587de2c
Summary:
`visible-password` represents a very basic keyboard, typically only
letters and numbers. Backed by InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
it is useful for things like password and code entry fields. It can also be more
effective than autoCorrect={false} for disabling autocompletion on some keyboards
(like Gboard).
Note `secureTextEntry` also affects `TYPE_TEXT_VARIATION_*` flags internally, so there
may be some undefined behavior when combining `secureTextEntry` with
`keyboardType="visible-password"`
Also, while here, improve the documentation on TextInput to explicitly enumerate
which keyboardType applies to Android vs. iOS (since this is the first android-specific)
Reviewed By: shergin
Differential Revision: D6005353
fbshipit-source-id: 13af90c96353f714c0e106dd0fde90184a476533