Commit Graph

10498 Commits

Author SHA1 Message Date
Emil Sjolander c3dc6a0f0e Revert D4878875: [yoga][PR] Fix sizing of non strech items
Differential Revision: D4878875

fbshipit-source-id: 8927438e7a1969deb617434369af53f71f625638
2017-04-13 10:01:55 -07:00
William Durand 6a1e0516e9 Add Geolocation API Jest mock
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
2017-04-13 09:35:22 -07:00
Lukas Wöhrl 62360e8981 Let measure behave more like on the web
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. Fix facebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499

Differential Revision: D4850458

Pulled By: emilsjolander

fbshipit-source-id: be5e35a670ddcbf3cd426fc3c2a0c9b60a874cdc
2017-04-13 08:49:43 -07:00
Georgiy Kassabli 831ad4adc6 Correct fix for flexing grandchildren
Reviewed By: emilsjolander

Differential Revision: D4875343

fbshipit-source-id: 634e961f9798dff43eae2c6564b28c6629b816e0
2017-04-13 08:49:43 -07:00
Lukas Wöhrl a82de9509f Fix sizing of non strech items
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
2017-04-13 07:57:21 -07:00
ZauberNerd 469acbaa9d fix mock for AsyncLocalStorage
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
2017-04-13 06:32:47 -07:00
Victor Ilyukevich 0d58669c81 Fix typo in documentation: "…controls how rows…"
Summary: Closes https://github.com/facebook/react-native/pull/13482

Differential Revision: D4883387

Pulled By: javache

fbshipit-source-id: fab3ce3136b18079a566e93fb3d388abc27dd41c
2017-04-13 05:52:45 -07:00
Kathy Gray 8e382fd006 Find hasConstant status via preprocessing
Reviewed By: javache

Differential Revision: D4867563

fbshipit-source-id: 66e4505d142fc4776cd727a025005b43d500b167
2017-04-13 05:30:14 -07:00
Vojtech Novak ea89af53cd fix typo
Summary: Closes https://github.com/facebook/react-native/pull/13418

Differential Revision: D4883386

Pulled By: javache

fbshipit-source-id: aa6195d4015ae5eb240b135a3c265be823652b11
2017-04-13 05:00:53 -07:00
Pieter De Baets 8dcef96fd8 Log to console in RCTTestRunner
Reviewed By: fkgozali

Differential Revision: D4875352

fbshipit-source-id: 68f9caf4f350d34b2fd180ff19353c698bfce452
2017-04-13 04:49:51 -07:00
Spencer Ahrens eeddef18b8 Use separators API in UIExplorer list
Summary: Clean up code and polish UI.

Reviewed By: yungsters

Differential Revision: D4872739

fbshipit-source-id: e7977c94e744cef30fad2832cf41d7a7b5ec2b2e
2017-04-12 17:01:03 -07:00
Spencer Ahrens 76307f47b9 add separator highlighting/updating support to `SectionList`
Reviewed By: thechefchen

Differential Revision: D4833604

fbshipit-source-id: cc1f85d8048221d9d26d728994b61237be625e4f
2017-04-12 17:01:03 -07:00
Spencer Ahrens f25df504ed Add support for updating adjacent separators on row highlight to FlatList
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
2017-04-12 17:01:03 -07:00
Nicholas Tate 926bfdb9f4 Container Testing Updates
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
2017-04-12 16:31:35 -07:00
Andy Trevorah 01d4a1c6f4 fixed typo in "linking" docs
Summary:
Fixing a typo found via https://facebook.github.io/react-native/docs/linking.html

n/a (they're docs)
Closes https://github.com/facebook/react-native/pull/13440

Differential Revision: D4875315

Pulled By: javache

fbshipit-source-id: 919cf263dba5fb3e8eda6b5181b7b88e1698ef6f
2017-04-12 16:31:35 -07:00
sunnylqm a6df7a6ce7 fix broken link
Summary:
fix broken link
Closes https://github.com/facebook/react-native/pull/13459

Differential Revision: D4875311

Pulled By: javache

fbshipit-source-id: 73f6dc03a088237f660dcea9f3444746373d8ff9
2017-04-12 16:15:15 -07:00
Douglas Lowder a97f494bf1 Add missing header to tvOS build
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
2017-04-12 16:15:15 -07:00
Brian Vaughn 6564edce5e Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github
Reviewed By: acdlite

Differential Revision: D4876709

fbshipit-source-id: 3a5e92bfc74287b7a9054546c438580bed0147af
2017-04-12 16:15:15 -07:00
Eric Vicenti 8085ceca6a Remove unused react-dom dependency from react-native
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
2017-04-12 10:30:48 -07:00
Brian Vaughn 00330987c8 Adding prop-types package and disabling auto-mock for Jest
Reviewed By: spicyj

Differential Revision: D4874587

fbshipit-source-id: 5c4c3d96a003d271fd5755191681ea7f729db235
2017-04-12 10:02:05 -07:00
Christoph Pojer abcd1b6370 Use escape hatch for mocked modules
Reviewed By: davidaurelio

Differential Revision: D4869222

fbshipit-source-id: d2cf66296a26710630f0d0f6c8efc7ff3ed97bc5
2017-04-12 09:47:34 -07:00
Jean Lauliac 3c85a6b902 packager: stronger option types
Reviewed By: davidaurelio

Differential Revision: D4868612

fbshipit-source-id: 50d72ce56d8e3ef0d917ee5bbe3dd42faf075584
2017-04-12 04:31:24 -07:00
Christoph Pojer deebf15a56 Move formatBanner into packager folder
Reviewed By: davidaurelio

Differential Revision: D4868954

fbshipit-source-id: 7a28019c781262bcf4aab0ad2e67868d35ebf9fb
2017-04-12 02:44:51 -07:00
Aaron Chiu 625b4940ee FLog.w ==> Flog.d
Reviewed By: yungsters

Differential Revision: D4874628

fbshipit-source-id: ae39a7105145f11b749822f3c98db973cfe613eb
2017-04-12 00:42:57 -07:00
Andrew Y. Chen 8290cd7ce2 Fix ARTShape arc
Reviewed By: AaaChiuuu

Differential Revision: D4871406

fbshipit-source-id: 7f777048c6756399b309e34cf3341c4263467b0b
2017-04-11 19:35:09 -07:00
Andrew Y. Chen 6b900dc7fb Fix withCredentials test failure
Reviewed By: AaaChiuuu

Differential Revision: D4870817

fbshipit-source-id: d741eb21d4c7092f89d5a8461b9ec92e3df49120
2017-04-11 18:30:35 -07:00
Lukas Wöhrl f26a99764a Fix min constraint incorrectly reducing available space
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
2017-04-11 13:09:38 -07:00
Lukas Wöhrl f7fe9a6219 Fix position on root node with RTL direction
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
2017-04-11 13:09:38 -07:00
Eric Vicenti 7da07fa9f3 Upgrade react-docgen to use new babylon parser
Reviewed By: mkonicek

Differential Revision: D4855504

fbshipit-source-id: 30c2d956242be5e8f01eb4ebc7e7afd77a72cd36
2017-04-11 12:32:49 -07:00
Naman Goel b7d873b1a0 Flow type improvements to accept co-variant types
Differential Revision: D4848918

fbshipit-source-id: b8d4628431c57c8fda12fc7e2e38e5b2dab9b1ad
2017-04-11 12:25:39 -07:00
Janic Duplessis 18525ce8c5 Remove unused react-addons dependencies
Summary:
We don't export addons anymore so we can remove those.

cc bvaughn
Closes https://github.com/facebook/react-native/pull/13244

Reviewed By: hramos

Differential Revision: D4836676

Pulled By: ericvicenti

fbshipit-source-id: 430ebd2b049e90f3e27e2420c8316bbbe2274baa
2017-04-11 12:25:39 -07:00
Karan Thakkar 840dc0cc82 Allow configuring the app source folder for android
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
2017-04-11 12:25:39 -07:00
Pieter De Baets 9d1c62669b Add extra guards to DispatchMessageQueueThread
Reviewed By: bnham

Differential Revision: D4868432

fbshipit-source-id: 23d6c996aa97db82ea5e0e166e1988f4ce378b6f
2017-04-11 12:25:39 -07:00
Alex Kotliarskyi ea7c5ab04b Add mock for BackHandler
Reviewed By: fkgozali

Differential Revision: D4861901

fbshipit-source-id: b1b74e63731328d2235bf86794aa481a8275ed8c
2017-04-11 12:25:38 -07:00
Andrew Y. Chen 21819f1a99 Add support for async callbacks in ReactFindViewUtil
Reviewed By: AaaChiuuu

Differential Revision: D4841500

fbshipit-source-id: 16620d72bd636ad13085c15c38862e16da6c42d2
2017-04-11 10:45:35 -07:00
Jean Lauliac 8fc3b48c65 packager: worker: remove `extern` option
Reviewed By: davidaurelio

Differential Revision: D4867367

fbshipit-source-id: ebe5fa860566e87bd6d042ee41b9a7aa9c777fc6
2017-04-11 08:15:57 -07:00
Jean Lauliac fabf833c3f packager: Module.js: fix Haste name code
Summary: The original code wasn't very readable. Better with this change, I think.

Reviewed By: davidaurelio

Differential Revision: D4851335

fbshipit-source-id: 210309d4b727aff58bea48d0ab324256234cd941
2017-04-11 08:15:57 -07:00
David Aurelio 7f706e824d Use exact types for options
Summary: Make option types exact to prevent stale options in our code base.

Reviewed By: jeanlauliac

Differential Revision: D4867773

fbshipit-source-id: 6aa06649735d6105f4b6ff2af7f699cf8ba336c7
2017-04-11 08:02:24 -07:00
David Aurelio eabc9cecd6 Push handling of missing parent module to `resolve`
Reviewed By: jeanlauliac

Differential Revision: D4863235

fbshipit-source-id: 857814cb25ee661db5e2cbdeac7175d9276044db
2017-04-11 08:02:23 -07:00
David Aurelio 3bcf4acfc7 Allow resolution without a parent.
Reviewed By: jeanlauliac

Differential Revision: D4862926

fbshipit-source-id: 18f98b6db98e9f937632bd5d00e0b0acfcff9de5
2017-04-11 08:02:23 -07:00
Alex Dvornikov abd148fa21 Show redbox window on JS errors for debug builds
Reviewed By: javache

Differential Revision: D4860613

fbshipit-source-id: 255202df9401ffd1dfb48224dd89255eac76874e
2017-04-11 06:00:42 -07:00
Jean Lauliac cb88df00ae packager: TransformCache: do not include basename in hash
Reviewed By: cpojer

Differential Revision: D4867411

fbshipit-source-id: ece5214ee9cf152e23790c70f7a8b12060725150
2017-04-11 05:31:26 -07:00
Pieter De Baets 3184f314ad Fix NPE in StackTraceHelper
Reviewed By: AaaChiuuu

Differential Revision: D4860056

fbshipit-source-id: 68865d8d8d1c2a678970f10e99d2ae5bc31ea5f8
2017-04-11 04:29:55 -07:00
Tim Yung dd7aa3659d Lists: Fix RCTJSONStringify Breakage on Infinity
Reviewed By: jingc

Differential Revision: D4867026

fbshipit-source-id: dfe98d5012ced80fbe10bf069c58f45d00da388b
2017-04-11 00:45:35 -07:00
Ho Chin Chee a41292d9c4 Update HAXM installation link
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
2017-04-10 23:34:04 -07:00
Adam Comella e544563bd2 BREAKING: Android: Support withCredentials flag in XHRs
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
2017-04-10 22:46:12 -07:00
Kazuki Sakamoto ecd0df01af Add YGConfigGetInstanceCount
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
2017-04-10 14:24:25 -07:00
Valentin Shergin ca6e0b37cf `reactRespondsToTouch:` was removed
Summary:
* It complicates Touch Handling mechanism.
* The same functionality can be (and should be) implemented via overriding standard `hitTest:` method.
* It was marked as deprecated a while ago.

Reviewed By: mmmulani

Differential Revision: D4667776

fbshipit-source-id: 2e047c3308563a2849ea351a242270f0800fead2
2017-04-10 12:32:31 -07:00
Satyajit Sahoo 1d270081d8 Add ability to customize CLI path
Summary: Closes https://github.com/facebook/react-native/pull/13248

Differential Revision: D4861273

fbshipit-source-id: 420a9dde94e888baab226e3c0d8d20e6f1464ae5
2017-04-10 12:16:03 -07:00
Hilke Heremans 2ab840522c Ignore all loopback addresses for ip detection
Summary:
There is a bug with IP detection on Macs that have (1) multiple ethernet interfaces, (2) are using the second or third interface as their primary connection and (3) have extra loopback IPs configured (for example when running OpenVPN, running some Docker configurations or other more exotic applications). In those cases, automatic IP detection will falsely detect the IP as something like `127.94.0.1`, which will make it impossible to run debug builds from a physical device.

The underlying network configurations looks something similar to this (irrelevant parts omitted):
```
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000
	inet 127.94.0.1 netmask 0xff000000
	nd6 options=201<PERFORMNUD,DAD>
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
	ether xx:xx:xx:xx:xx:xx
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
Closes https://github.com/facebook/react-native/pull/13415

Differential Revision: D4859654

Pulled By: javache

fbshipit-source-id: 3c5d06201c48a2dfe1c274ff433423e5d7f2cded
2017-04-10 11:00:31 -07:00