Commit Graph

9910 Commits

Author SHA1 Message Date
Emil Sjolander 702564fb60 Pass the parent size to YGNodeCalculateLayout instead of the node size
Reviewed By: astreet

Differential Revision: D4611417

fbshipit-source-id: 2fb0eedffa17f0ec89b601722a1717a72e216b9e
2017-02-28 08:14:51 -08:00
Lukas Wöhrl f52d66c311 Fix percentage in flexing parent
Summary:
If we don't measure exactly, percentage values aren't exactly either. Fix for #414.
Closes https://github.com/facebook/yoga/pull/416
Closes https://github.com/facebook/yoga/pull/414

Reviewed By: astreet

Differential Revision: D4604729

Pulled By: emilsjolander

fbshipit-source-id: 66880230073209cbe89668b838c2a82e7f9b34df
2017-02-28 07:02:32 -08:00
Jean Lauliac 2030b6befe packager: terminal: split status too big to fit in screen
Reviewed By: cpojer

Differential Revision: D4627512

fbshipit-source-id: 6e7b5f3a6e2d012a44373014f93ab17ef4f290a2
2017-02-28 06:45:56 -08:00
Alexey Lang 1744639ad7 Log ReactContext counters
Reviewed By: AaaChiuuu

Differential Revision: D4501870

fbshipit-source-id: 97a5ece611a8d0d4049c63306382f56cac90434b
2017-02-28 06:32:43 -08:00
Daniel Fischer 0097ab98a7 Update UsingAScrollView.md
Summary:
Simple spacing update for consistency.

Super simple PR. I'm just fixing the spacing in the documentation to be consistent with the other docs.
Closes https://github.com/facebook/react-native/pull/12549

Differential Revision: D4608409

Pulled By: hramos

fbshipit-source-id: 9df0e3e0260d292e6788f32a713552c30240da47
2017-02-28 06:23:58 -08:00
Jean Lauliac f117533f82 packager: simplify fs.stat mocks
Reviewed By: davidaurelio

Differential Revision: D4620080

fbshipit-source-id: f78b20d2f728ddd32413f27dba85cb825ec7c9a9
2017-02-28 06:23:58 -08:00
Marcel Kalveram a8bbb98805 Add Prepd app to showcase
Summary:
This app is written entirely in React Native, and available on the iOS and Google Play app stores.

Blogpost: https://logbook.hanno.co/prepd-pros-cons-react-native/
Case study: https://hanno.co/work/prepd/
Closes https://github.com/facebook/react-native/pull/12434

Differential Revision: D4601147

Pulled By: hramos

fbshipit-source-id: b00ddc4d99574405c2c78a9e89e41d4ebc352f1c
2017-02-28 06:01:31 -08:00
Andy Street 0884c3e3d1 Revert D4620034: [react-native][PR] Fix: set underlineColorAndroid properly
Differential Revision: D4620034

fbshipit-source-id: edb589ace310008866d8d4df5fbf00e785976402
2017-02-28 03:32:55 -08:00
Spencer Ahrens 2a1ab36257 Breaking API change - abandon `ItemComponent` in favor of `renderItem`
Summary:
After a fair bit of use, we have concluded that the `ItemComponent` mechanism is not worth the
hassle. Flow has trouble type checking it thoroughly, requiring an 'item' prop is annoying, and it
is very common to need to capture `this` anyway, e.g. for an `onPress` handler. A common pattern was
something like:

  _renderItem = ({item}) => <MyItem foo={item.foo} onPress={() => this._onPress(item)} />};
  ...
  ItemComponent={this._renderItem}

which wouldn't flow check the props and doesn't benefit from reusing components.

If we find some specific patterns that would benefit from the `ItemComponent` pattern, we can create
a new component that provides that API and wraps `FlatList` under the hood.

I'm going to do `SectionList` in a stacked diff.

Reviewed By: bvaughn

Differential Revision: D4625338

fbshipit-source-id: a4901f1c9d77e0115b0b8032b8c210f624e97ea3
2017-02-28 02:17:23 -08:00
Spencer Ahrens f7d1060418 Missed some viewablePercentThreshold references
Reviewed By: yungsters

Differential Revision: D4603767

fbshipit-source-id: b7674324e961ae43ca1ee74c309f4d98d954fbbc
2017-02-28 02:17:23 -08:00
Spencer Ahrens a10dbdaaf6 Rename flow type Viewable -> ViewToken
Summary: `Viewable` is a weird name - I think `ViewToken` is more clear? Also easier to grep for.

Reviewed By: yungsters, bvaughn

Differential Revision: D4600762

fbshipit-source-id: dbfa5eec1b91166c4889dcb6b87d7832090be9e9
2017-02-28 02:17:23 -08:00
Spencer Ahrens dc30203734 minViewTime and waitForScroll viewability config support
Summary:
It's pretty common to want to wait until the user scrolls a view to consider any items
viewable, so `waitForScroll` enables that behavior.

It's also pretty common to want to ignore items that are quickly scrolled out of view, so we add
`minViewTime` to handle that case.

Reviewed By: bvaughn

Differential Revision: D4595659

fbshipit-source-id: 07bc8e89db63cb68d75bdd9bedde3183c38a3034
2017-02-28 02:17:23 -08:00
Valentin Shergin b00c1fa3b6 `accessibilityViewIsModal` property was exposed for any view (iOS only)
Reviewed By: mmmulani

Differential Revision: D4582786

fbshipit-source-id: 0902b8cc762042e772798ea7eaa350bc9d737cfb
2017-02-27 23:46:14 -08:00
Eli Perkins 1b0d8ac43b Use appropriate capitalization of Xcode
Summary:
[Xcode](https://developer.apple.com/xcode/) is spelled with a lowercase `c`. 😄

**Test plan (required)**

ctrl-f project for `XCode`, case sensitive, find-and-replace with `Xcode`.

Make sure tests pass on both Travis and Circle CI.
Closes https://github.com/facebook/react-native/pull/12572

Differential Revision: D4622075

Pulled By: hramos

fbshipit-source-id: d64f0b10254cd624a71844ebaefa6fc29bc1ea57
2017-02-27 22:47:14 -08:00
Héctor Ramos 643925b41d Fix formatting in DatePickerAndroid.open docs
Summary:
Lists need to be separated by a blank line from the preceding paragraph in order to render properly.
Closes https://github.com/facebook/react-native/pull/12521

Differential Revision: D4619863

Pulled By: ericvicenti

fbshipit-source-id: 4d5019af5ad66d8f4360339f007cf7f39427a945
2017-02-27 18:34:19 -08:00
Adam Comella 04790f1a78 Finish AccessibilityInfo implementation
Summary:
This PR is based on files ericvicenti gave me. Specifically, he gave me:
  - AccessibilityInfo.android.js
  - AccessibilityInfo.ios.js
  - AccessibilityInfoModule.java

Before this change, only a native iOS implementation of AccessibilityInfo existed. This change includes:
  - A native Android implementation of AccessibilityInfo.
  - JavaScript wrappers for the AccessibilityInfo module for both iOS and Android.
  - UIExplorer changes to illustrate how to use AccessibilityInfo on iOS and Android.
  - Documentation for the AccessibilityInfo APIs.

**Test plan (required)**

Tested the UIExplorer AccessibilityInfo example on iOS and Android with the screen reader both enabled and disabled.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12273

Reviewed By: mkonicek

Differential Revision: D4527224

Pulled By: ericvicenti

fbshipit-source-id: d04638465ccbdbb35ecfc9504daaeb8e33aab57a
2017-02-27 18:34:19 -08:00
Andrew Clark 41f1bcc5ac Sync React Native with React 16.0.0-alpha.3 (take 2)
Reviewed By: spicyj

Differential Revision: D4623242

fbshipit-source-id: 7ddb057cb47e005dda73070f45d108af40d93c8f
2017-02-27 17:30:30 -08:00
Eric Vicenti 6439f65fcb Switch to OSS buck config for textlayoutbuilder
Reviewed By: ahmedre

Differential Revision: D4623418

fbshipit-source-id: 50bbbb0df89a69b088186bd38e993f659421cef9
2017-02-27 14:45:53 -08:00
Andrew Clark 0a712f5335 Revert D4615201: Sync React Native with React 16.0.0-alpha.3
Differential Revision: D4615201

fbshipit-source-id: e86961f37209c73838b5a4a564bc81eb48a911c2
2017-02-27 14:04:58 -08:00
Eloy Durán 19caaba1d5 Fixes current CI failures and allows tree shaking of native dev support code.
Summary:
* The dev support code moved into a `DevSupport` subspec, meaning that only if the subspec is specified in the user’s Podfile will the packager client, dev menu, etc be included. This is mainly done through checks for header availability.

  It also improves the weird situation where you had to specify the `RCTWebSocket` subspec if you wanted to be able to use the packager client during development.

* I removed hardcoding the release version in the podspec on release, because the podspec still relies on `package.json` when evaluating, so there’s no real point in not also getting the version number from there. This should remove any requirement to perform maintenance of the OSS release script regarding the podspec.
Closes https://github.com/facebook/react-native/pull/12602

Differential Revision: D4621021

Pulled By: ericvicenti

fbshipit-source-id: 6c208371fc40ea607809a6ab05dd3714ed9980cf
2017-02-27 14:04:58 -08:00
Andrew Clark 24a7665df5 Sync React Native with React 16.0.0-alpha.3
Reviewed By: sebmarkbage

Differential Revision: D4615201

fbshipit-source-id: fc62b44aa866e096faa1cb048db361bb8c6ab11f
2017-02-27 14:04:58 -08:00
Javier Olaechea 2d44908afa Don't use 'vertically' when describing a ListView
Summary:
it gives the wrong impression that a ListView has the restriction to only align the items vertically

The problem the PR addresses is that the documentation currently gives the initial impression that a ListView can only stack the items vertically.
Closes https://github.com/facebook/react-native/pull/12564

Differential Revision: D4622096

Pulled By: hramos

fbshipit-source-id: ce634087d143a28904d998a4c7301ca18392714e
2017-02-27 14:04:58 -08:00
Bhuwan Khattar 234f4f538d Introduce HasteImpl
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.

This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations

Reviewed By: davidaurelio

Differential Revision: D4589372

fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
2017-02-27 14:04:58 -08:00
Valentin Shergin 4ba983401f Usage `intrinsicContentSize` property of `RCTRootView` intead of deprecated `intrinsicSize`
Reviewed By: blairvanderhoof

Differential Revision: D4589913

fbshipit-source-id: 6d966e9b90a0cf3e736ac20e2b6f35cbf92ff3f3
2017-02-27 14:04:58 -08:00
Valentin Shergin e7cc1bcbba RCTRootView's `intrinsicSize` property was deprecated in favour of `intrinsicContentSize`
Summary:
Nothing actually changed except the deprecation.
Existed `intrinsicSize` was already implemented as `intrinsicContentSize` and this change only removes redundancy.
Moreover, we do not need `rootViewDidChangeIntrinsicSize` delegate method anymore; this is now mentioned in its description.

Depends on D4577890

Reviewed By: mmmulani

Differential Revision: D4589344

fbshipit-source-id: 16ed62cbf6bf72678bd7f7c11d4812c5aa36c743
2017-02-27 14:04:58 -08:00
Valentin Shergin 9dccff0eda Better support of UIKit layout stuff for RCTRootView an co.
Summary:
Now RCTRootView is much more reliable citizen of UIKit, it got:
 * Implemented `sizeThatFits:`;
 * Implemented `instrinsicContentSize`;
 * Notifying superview via `setNeedsLayout` about changed size.

All it make possible painless integration of ReactNative-powered widgets inside existing native apps.

Reviewed By: javache

Differential Revision: D4577890

fbshipit-source-id: 9897cb002c9d658a97fd436240c2ac947ba2084b
2017-02-27 14:04:58 -08:00
David Aurelio b6ca952eeb Symbolicate stack traces off the main process
Summary:
Moves stack trace symbolication to a worker process.

The worker process is spawned laziliy, and is treated as an exclusive resource (requests are queued).

This helps keeping the server process responsive when symbolicating.

Reviewed By: cpojer

Differential Revision: D4602722

fbshipit-source-id: 5da97e53afd9a1ab981c5ba4b02a7d1d869dee71
2017-02-27 14:04:57 -08:00
Martin Konicek 17c175a149 CLI: Add support for templates fetched from npm
Summary:
This PR allows anyone to publish templates for React Native.

It's possible for people to publish modules for React Native, we should also support custom templates. A suggestion from a Cordova mantainer where they did the same thing suggests this is useful:
https://github.com/mkonicek/AppTemplateFeedback/issues/1

I published a sample template [react-native-template-demo](https://www.npmjs.com/package/react-native-template-demo).

(GitHub: https://github.com/mkonicek/react-native-template-demo)

With this PR anyone can then use that template:

`react-native init MyApp --template demo`

The convention is: if someone publishes an npm package called `react-native-template-foo`, people can use it by running `react-native init MyApp --template foo`.

Use a template called `react-native-template-demo` from npm:

`react-native init MyApp --template demo`

Use a local template:

`react-native init MyApp --template file:///path_to/react-native-template-dem
Closes https://github.com/facebook/react-native/pull/12548

Differential Revision: D4620567

Pulled By: mkonicek

fbshipit-source-id: bb40d457a7fec28edb577f08137e73241072de3a
2017-02-27 14:04:57 -08:00
Christoph Pojer 37b91a63c7 Fix flow errors
Reviewed By: davidaurelio

Differential Revision: D4619990

fbshipit-source-id: 80355b8f0d0c3f84691098a05cdf2ba136c4bf53
2017-02-27 14:04:57 -08:00
desmondyao 20ad2b3fbb support api 15 (use Handler-backed ui driven).
Summary:
Android API 15 still have 1.5~2.0% distribution (refer: [Dashboard - Android Developer](https://developer.android.com/ndk/guides/standalone_toolchain.html#creating_the_toolchain)).

React Native is a good tec but many companies cannot endure loose their consumer. [Choreographer](https://developer.android.com/reference/android/view/Choreographer.html) triggered UI operation is the only reason that React Native Android sdk use minSdkVersion 16, so we can use a backward solution **only in API 15**: [Handler](https://developer.android.com/reference/android/os/Handler.html).

In this PR, the biggest change is :

- Make core operation of ReactChoreographer to an interface: ReactUIDriver;
- Impl ReactUIDriver by Handler => UIDriverHandlerImpl, refactor ReactChoreographer to UIDriverChoreographerImpl;
- Let UIDriverFactory to choose which one impl would be in use. (Only use handler in api 15).
Closes https://github.com/facebook/react-native/pull/12396

Reviewed By: AaaChiuuu

Differential Revision: D4588399

Pulled By: astreet

fbshipit-source-id: 76408e53664314dd926e6a553cde6bafbd37779e
2017-02-27 14:04:57 -08:00
Swordsman-Inaction 8b01508410 Fix: set underlineColorAndroid properly
Summary:
This PR fixes #6332

The issue is that Android Framework will return the same drawable instance for all requests if they request for the same resource. So the changes on the drawable instance will affect all users(`TextInput` in this case). The solution is very easy, call `mutate()` before change it will get a new drawable instance which make sure the change doesn't affect other users.
Closes https://github.com/facebook/react-native/pull/12493

Differential Revision: D4620034

Pulled By: astreet

fbshipit-source-id: a7b10fbc7447e01132b7ca0e1f78413796493e07
2017-02-27 14:04:57 -08:00
Wietse Venema 800dc77172 Fixes type definition of StackFrame
Summary:
**Motivation**
This PR fixes the flow type definition of StackFrame in parseErrorStack.js. The methodName was missing and the column could be `null`. We integrate with it in our codebase and we wanted to use `methodName`, but flow complained.

Refer to this file for possible values: [github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js](https://github.com/errwischt/stacktrace-parser/blob/master/lib/stacktrace-parser.js)

This also allowed me to remove a flow error suppression.

**Test plan (required)**
I ran flow on the project, no errors
Closes https://github.com/facebook/react-native/pull/12499

Differential Revision: D4619885

Pulled By: ericvicenti

fbshipit-source-id: 0bf5a2304cb0dc9f2c6df026a5cee71c8a419c01
2017-02-27 14:04:57 -08:00
Benjamin Dobell 27928f3993 Optional Alert onDismiss callback to support Android default behavior
Summary:
On Android it's generally expected that alerts are dismissible by tapping outside the alert box. This is the default behavior for React Native, but until now there has been no means to listen for the dismiss event.

`Alert.alert` already takes an `options` object, so this pull request simply adds an additional option `onDismiss`, a callback function that will be called when an Alert is dismissed (rather than being closed as a result of a button press).

**Test plan**

Simply pass an `options` object to `Alert.alert` with the `onDismiss` property set to a function.

e.g. Run the following on Android, dismiss the alert by tapping outside the alert view, and monitor console output.

```
Alert.alert(
  'Alert Title',
  'My Alert Msg',
  [
    {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
    {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
    {text: 'OK', onPress: () => console.log('OK Pressed')},
  ],
  { onDismiss: () => console.
Closes https://github.com/facebook/react-native/pull/12594

Differential Revision: D4619862

Pulled By: ericvicenti

fbshipit-source-id: fdd351a7b8e673dab331f0e22dc5ea2e84f24375
2017-02-27 14:04:57 -08:00
James Isaac 64c8f22343 Correct/consistent docs for Touchable components
Summary:
I ran into confusion (#12581) because the docs for TouchableOpacity stated that it doesn't change the view hierarchy, but in fact it does, and the docs are just out of date.

- [20 Feb 2015](efae175a8e/Libraries/Components/Touchable/TouchableOpacity.js (L21)) Docs correctly reflected that the component was cloned so didn't affect hierarchy
- [25 Jul 2015](725053acfe) Component was changed to being wrapped but docs weren't updated.

Went to correct this in the docs and noticed they were a bit inconsistent with each other, so have made them more unified.  Each one now clearly warns about:

- If it adds a view to the hierarchy, which will affect layout.
- If it can only accept a single child.
Closes https://github.com/facebook/react-native/pull/12583

Differential Revision: D4619837

Pulled By: ericvicenti

fbshipit-source-id: 4d1becd9f290cefcb4548a5ea2878be2d2c315fa
2017-02-27 14:04:57 -08:00
Espen Hovlandsdal 9217ff3203 Fix typo in ViewabilityHelper (`itemVisiblePercentThreshold` mistyped)
Summary:
The new `ViewabilityConfig` API has a typo:
`itemVisiblePercentThreashold` should be `itemVisiblePercentThreshold`.

Thought it would be good to fix this before people start depending on a property containing a typo :-)

Updated tests to match.
Closes https://github.com/facebook/react-native/pull/12593

Differential Revision: D4619798

Pulled By: ericvicenti

fbshipit-source-id: 0aa8b6cf9ae7e5638607195759e4bd51140667fe
2017-02-27 14:04:57 -08:00
Ashok Menon bf429f03a9 Get rid of code gated behind `JSC_HAS_EXTERNAL_CACHE`
Reviewed By: bnham

Differential Revision: D4608754

fbshipit-source-id: 9214c4d20720e5aa1cd65381a4837ff06943376e
2017-02-27 14:04:57 -08:00
Bhuwan Khattar cf1bc8d644 s/react-native.js/react-native-implementation.js/
Summary: Renaming since a file with the same name as a package confuses packager

Reviewed By: cpojer

Differential Revision: D4613215

fbshipit-source-id: 5cfae71d0bb1eef2675689b37a9b42596d25678d
2017-02-27 14:04:57 -08:00
Bhuwan Khattar fac21168f6 rename UIExplorerUnitTests/TestBundle to UIExplorerUnitTests/UIExplorerUnitTestsBundle
Reviewed By: cpojer

Differential Revision: D4612650

fbshipit-source-id: 395f540cb33594fc72bfd0177d49fd602a4ce3ca
2017-02-27 14:04:56 -08:00
Bhuwan Khattar a23a3c319c Add @providesModule annotations
Summary: Adding providesModule annotations to files that don't have a `providesModule` annotation but are in directories that packager crawls.

Reviewed By: cpojer

Differential Revision: D4612455

fbshipit-source-id: b23f0d6bbe2d26f480e93b56b67c6c8b1075e9f7
2017-02-27 14:04:56 -08:00
Michael Bolin 48cb932c6e Apply auto-formatter for BUCK files in fbandroid.
fbshipit-source-id: 278ce6f67f5df830b2218e3aca69be103d3c56a6
2017-02-27 14:04:56 -08:00
Eric Vicenti ce3146d618 Update BUCK 2017-02-27 13:58:55 -08:00
Eric Vicenti 288f480b71 Update BUCK 2017-02-27 13:42:01 -08:00
Eric Vicenti 0ca4944222 Update BUCK 2017-02-27 13:20:35 -08:00
Bhuwan Khattar 84a681cea9 Ignore mocks in packager
Reviewed By: cpojer

Differential Revision: D4611759

fbshipit-source-id: 49cf3dbf4a068585b1bb6bca84268bc2631d037f
2017-02-24 13:01:34 -08:00
Gabe Levi 4a60be62bc Deploy v0.40.0
Reviewed By: yungsters

Differential Revision: D4612331

fbshipit-source-id: 3eaa2f99d3181227166064cbee29b9245401a775
2017-02-24 12:45:56 -08:00
Christoph Pojer 2a3fe0625d Fix a bunch of flow annotations
Reviewed By: jeanlauliac

Differential Revision: D4611846

fbshipit-source-id: c2fe468e34a3b1eba7fcd2596020aad136285363
2017-02-24 11:17:48 -08:00
Ryan Florence 843ad50296 remove peculiar web language
Summary:
Nothing about the web prevents people from providing good visual feedback on touch events. I'm not trying to be a punk, just coming across this language (several times now) gives me weird feelings since I come from "the web".
Closes https://github.com/facebook/react-native/pull/12484

Differential Revision: D4608430

Pulled By: hramos

fbshipit-source-id: 9ab72bffb300aa7bd76b6e07470dfe9763e50556
2017-02-24 11:17:48 -08:00
Nicholas Tate fe2ff122dc Docker Testing Environment for Android & JS
Summary:
Created a containerized environment to run unit and integration tests for both javascript and android as well as a Jenkinsfile using the new 2.0 Pipeline syntax for integration into a Jenkins CI cluster.

Here is a quick summary of the changes:

* The android image is built from two separate dockerfiles. There is a base image that handles the heavy lifting of dependencies that are infrequently changed while the secondary image extends the base and allows for much quicker incremental builds on code updates.
* The javascript image is simple and is relatively quick to build, therefore there is no base image for any react specific javascript dependencies and it is all packaged in a single docker image.
* A new `scripts/docker` has been created including some javascript files and shell scripts to aid in the running of the tests
* The instrumentation test runner script can be passed various flags to control which tests run since the entire suite takes a significant amount of time to run synchronously
* Jen
Closes https://github.com/facebook/react-native/pull/11902

Differential Revision: D4609238

Pulled By: ericvicenti

fbshipit-source-id: a317f3ac3be898180b009254a9604ca7d579a8b9
2017-02-24 10:59:53 -08:00
Georgiy Kassabli 387ec8ce37 Add rounding to the pixel grid to Yoga
Reviewed By: emilsjolander

Differential Revision: D4565980

fbshipit-source-id: 9700f6d6ed147f82b19f230fbff2e9ccbd625b25
2017-02-24 10:08:04 -08:00
dlowder-salesforce 7f6f964e18 Add missing websocket headers to React-tvOS target
Summary:
Fix Apple TV breakage.  This should allow scripts/objc-test-tvos.sh to run normally.
Closes https://github.com/facebook/react-native/pull/12565

Differential Revision: D4612182

Pulled By: hramos

fbshipit-source-id: 77fd3eeabc6757b23e4f5efbd46e9948b61b1ab6
2017-02-24 09:45:38 -08:00