Summary:
Note: if this changeset causes some breakage, consider disabling rather than reverting. To disable, the call to `_preprocessPotentialDependencies` in `ResolutionRequest` can be removed.
It's a bit of an experiment. I couldn't see any particular regression caused by this, but I could see net improvement of the global cache performance, as it unlock much, much stronger batching: indeed, instead of discovering dependencies progressively, we synchronously figure out the list of all potential modules of a bundle, and kick-off cache fetching and/or transformations. So when it comes to fetching from the global cache, it'll do less requests, and each requests will ask for considerably more keys at a time.
Potential problem caused by this changeset: if a module's dependencies completely changed, then the first time we try to build the bundle it'll start transforming modules that we probably don't care at all anymore, spending precious CPU time for nothing. I've been thinking about it and I cannot see such a case happening much often. Even if it happens, it should not cause any bug or corruption, it would just take additional time.
Other potential problem: that this new code doesn't handle some types of edge cases. It's quite hard to figure out what could possibly break in the `ResolutionRequest` code (and I think it would benefit from a larger refactor). We do have a good test coverage for `DependencyGraph` and it seems to work smoothly, so I'm relatively confident we're not breaking edge cases.
Reviewed By: davidaurelio
Differential Revision: D4875467
fbshipit-source-id: 2dfcc755bec638d3d1c47862ec1de5220953e812
Summary:
Hello!
The [Geolocation API](https://facebook.github.io/react-native/docs/geolocation.html) is currently not mocked in Jest, which often leads to an `Invariant Violation: Native module cannot be null` error. This patch adds a basic Jest configuration similar to the existing ones for the other modules.
None unfortunately, but this patch makes my test suite all green 😉
Thanks,
William
Closes https://github.com/facebook/react-native/pull/13442
Differential Revision: D4883830
Pulled By: javache
fbshipit-source-id: c2a976834cca7537bd832a698e8cd25cf877705b
Summary:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Differential Revision: D4850458
Pulled By: emilsjolander
fbshipit-source-id: be5e35a670ddcbf3cd426fc3c2a0c9b60a874cdc
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Differential Revision: D4878875
Pulled By: emilsjolander
fbshipit-source-id: ab1174ac7a76dcf20aae7b29a3bc396e11077c4d
Summary:
The current mock of `AsyncLocalStorage` seems to mock parts of the
`AsyncStorage` API that can't be found on the `AsyncLocalStorage`
object itself and therefore it doesn't work as expected.
What it should do is mock the API of `AsyncLocalStorage` which is a
`NativeModule` so that the `AsyncStorage` module can be used in tests
and it will require the mocked methods.
In order to enable behaviour in unit tests it is possible to replace or
overwrite the mock implementation, see the [jest guide on mocks](https://facebook.github.io/jest/docs/mock-functions.html).
By doing something similar to:
```javascript
import { NativeModules } from 'react-native';
const { AsyncLocalStorage } = NativeModules;
// mock 'multiGet', in order to allow 'AsyncStorage.getItem('myKey')'
AsyncLocalStorage.multiGet.mockImplementationOnce((keys, callback) => {
callback(null, [['myKey', 'myValue']]);
});
// execute unit tests for code that makes use of 'AsyncStorage'
```
Closes https://github.com/facebook/react-native/pull/13433
Differential Revision: D4883389
Pulled By: javache
fbshipit-source-id: 92a0ee94480b3022acc748e306ee2d4ee7a9869d
Summary:
A nice bit of polish for apps is to update the separators between list items
when press actives the highlight (things get especially noticeable/ugly when
the separators are not full width and don't adjust). This can be difficult to
coordinate and update efficiently, so we bake the functionality into
`VirtualizedList`.
The approach taken here is a little different from `ListView`. We pass a new
`separators` object with `renderItem` that has easy-to-use callbacks for toggling
the 'highlighted' prop on both adjacent separators - they can be wired up
directly to the `onShow/HideUnderlay` props of `TouchableHighlight` (pit of
success and all that - we want those RN apps to be polished!), but we also
provide a more generic `separators.updateProps` method to set any custom
props. This also passes in `leadingItem` so more custom wiring can be done on
initial render (e.g. linking the highlight state with `Animated`).
This also moves the separator rendering into the `CellRenderer`. I think this might
also fix some subtle measurement bugs with the `onLayout` not capturing the
height of the separator, so that's nice too, but the main reason is to have
an easy place to store the state so we don't have to re-render the entire list
like `ListView` does. Instead we track references to the cells and call update
only on the two we care about so the feedback is instantaneous even with big,
heavy lists.
This diff also messes with a bunch of flow and updates the example to be more
like a standard list.
`SectionList` support is coming in a stacked diff.
**TestPlan**
Video demo:
https://youtu.be/uFE7qGA0mg4
Pretty sure this is backwards compatible....
Reviewed By: thechefchen
Differential Revision: D4833557
fbshipit-source-id: 685af46243ba13246bf280dae8a4223381ce8cea
Summary:
ericvicenti Here is the latest updates and fixes for the container testing. Everything should be good to go now, the update for `inotify.max_user_watches` should fix the E2E test issues you were seeing locally.
The update to the packer prevents excessively large filename lengths due to the hash used in the name and splits them into directories instead. I was getting errors locally on the E2E because the hash filename was over 248 characters which was causing issues on the base image file system. It might not have appeared in circle due to another file system being used with different limits. I can separate it out into another PR if you want though.
* Turned jenkins instrumentation parallelism up to 3
* Disabled various instrumentation tests that seemed to have inconsistent results from
Jenkins by default
* Install google-chrome in the android base image so the chrome debug E2E test does not fail
* Turned back on E2E tests
cc normanjoyner
Closes https://github.com/facebook/react-native/pull/13417
Differential Revision: D4876137
Pulled By: ericvicenti
fbshipit-source-id: 31e033c1e34b02acb5484478414197ac9eb11f95
Summary:
**Motivation**
Without this change, unit tests and integration tests won't build and run for Apple TV.
**Test plan**
Run `scripts/objc-test-tvos.sh` after uncommenting the TEST line.
Closes https://github.com/facebook/react-native/pull/13456
Differential Revision: D4875309
Pulled By: javache
fbshipit-source-id: 9b6fa3b7107924ba0346bf8be63bba5fe45acb53
Summary:
I'm not sure why we rely on react-dom, so this is an attempt to remove it.
Closes https://github.com/facebook/react-native/pull/13425
Reviewed By: gaearon
Differential Revision: D4862718
Pulled By: ericvicenti
fbshipit-source-id: b9fb9937bff445311880fb923e0b5eb362ca291b
Summary:
If a min constraint exists. It incorrectly reduces the available space by that amount. This adds a test and fix for this.
Closes https://github.com/facebook/yoga/pull/501
Differential Revision: D4867146
Pulled By: emilsjolander
fbshipit-source-id: ceafe070bfe7f501929d316656ac44c4e1753059
Summary:
If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477.
Closes https://github.com/facebook/yoga/pull/502
Differential Revision: D4867144
Pulled By: emilsjolander
fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
Summary:
I have been working on integrating React Native into an existing app and realised that the source folder for android code is currently hardcoded as `app`. Being a legacy codebase we can't really change that. So I wanted to be able to customise this folder name so that I can integrate RN seamlessly and start it from the CLI without having to run it from Android Studio.
- Create a barebones RN app
- `react-native run-android` works successfully
- Refactor the name of the app folder inside the android directory to `TestFolderName` using Android Studio
- `react-native run-android` now fails
- Changing this command to `react-native run-android --appFolder=TestFolderName` works successfully
Closes https://github.com/facebook/react-native/pull/13273
Differential Revision: D4833396
Pulled By: ericvicenti
fbshipit-source-id: 4c62cee6aaa2cc78eede5c7756459430022fffde
Summary: The original code wasn't very readable. Better with this change, I think.
Reviewed By: davidaurelio
Differential Revision: D4851335
fbshipit-source-id: 210309d4b727aff58bea48d0ab324256234cd941
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.
- [ ] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.
So other Mac users wont have to dig around to look for the link.
What existing problem does the pull request solve?
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the 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.
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
Closes https://github.com/facebook/react-native/pull/13434
Differential Revision: D4866808
fbshipit-source-id: 9259eff382d9440754e672ad05828342091877d2
Summary:
Corresponding iOS PR: #12275
Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains.
This should fix#5347.
This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument.
**Test plan (required)**
Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12276
Differential Revision: D4673646
Pulled By: ericvicenti
fbshipit-source-id: 924c230c9df72071b3cf9151c3ac201905ac28a5
Summary:
- depends on #496
- For memory leak unit test
- Expose the API for C#
Closes https://github.com/facebook/yoga/pull/497
Reviewed By: emilsjolander
Differential Revision: D4796190
Pulled By: splhack
fbshipit-source-id: 99e4e78e8dfb3d459cf6cd7103ab252c3748e5a6