Commit Graph

9142 Commits

Author SHA1 Message Date
Jhen 2249af16b7 Fix the `path.sep` replacement of node-haste for Windows
Summary:
Fix the `path.sep` replacement for Windows, currently it just replace one segment:

```js
// Result: './lib/random\random-byte.js'
'./lib\\random\\random-byte.js'.replace(path.sep, '/')
```

Change to regex will work fine:

```js
// Result: './lib/random/random-byte.js' (correct)
'./lib\\random\\random-byte.js'.replace(new RegExp('\\' + path.sep, 'g'), '/')
```
Closes https://github.com/facebook/react-native/pull/11641

Differential Revision: D4368402

fbshipit-source-id: 46f456359d1cd2ca790881773e8a76af8616cd21
2016-12-27 14:43:32 -08:00
Mehdi Mulani 199d64083c Stop throwing yellew boxes when we warn from native
Summary: This caused a bunch of stuff to break, reverting and will fix the problems before committing next time.

Reviewed By: fkgozali

Differential Revision: D4363398

fbshipit-source-id: 55146c9da998f6a3883307c36422a9d440ea7f52
2016-12-27 10:43:33 -08:00
Michal Srb 1b694f43ba Update docs on TextInput:style to point to relevant issue
Summary:
Bandaid for #7070. Until this is fixed, the docs should at least be honest the state they're in, so people don't have to go search and wonder.
Closes https://github.com/facebook/react-native/pull/11626

Differential Revision: D4366925

Pulled By: mkonicek

fbshipit-source-id: 082a8a9916ad0f8fbb2955cffbf61142fa2a98a1
2016-12-26 03:58:30 -08:00
Michal Srb 5dfc007af3 Fix Running On Device guide for iOS
Summary:
Doing this from web so won't be able to screenshot the results. (also inadvertently deleted a line, oh well...)
Closes https://github.com/facebook/react-native/pull/11625

Differential Revision: D4366928

Pulled By: mkonicek

fbshipit-source-id: 966a3d8b90dde49b1de06e0249df110245943825
2016-12-26 03:43:31 -08:00
desmondyao bc285de799 Not re-calculate value in Step1.
Summary:
Not re-calculate `paddingAndBorderAxisMain`/`paddingAndBorderAxisCross`/`paddingAndBorderAxisRow`/`paddingAndBorderAxisColumn` in Step1 of `YGNodelayoutImpl`.

They can be figure out by values calculated before.
Closes https://github.com/facebook/yoga/pull/298

Reviewed By: dshahidehpour

Differential Revision: D4365533

Pulled By: emilsjolander

fbshipit-source-id: 6caf60bc6ef3addd49915b39b48f01a8b4926e9c
2016-12-23 10:28:26 -08:00
Tomas Roos 8680681a3d Updated imports to libyoga*.a in HelloWorld
Summary:
Fixes #11605

HelloWorld refers to CSSLayout even thought master has moved on and the library is now called Yoga.
Closes https://github.com/facebook/react-native/pull/11606

Differential Revision: D4365469

fbshipit-source-id: e0eaac400449f0ba767bf98f3bd8e8185fb6fd12
2016-12-22 23:58:28 -08:00
Héctor Ramos 94d4db720d Add iOS permission information to CameraRoll.js
Summary:
As of iOS10 permission is required to access user photos and their galleries, I felt this really needed to be addressed. I hope to create a section dedicated to iOS permissions soon.
Closes https://github.com/facebook/react-native/pull/11259

Differential Revision: D4364354

Pulled By: hramos

fbshipit-source-id: 97bdeb09deba01995eebd038e00ccc84b08281c9
2016-12-22 17:13:31 -08:00
Horcrux 5f8d7ac618 fix Touchables inspector
Summary:
Fix TouchableWithoutFeedback throw error when touchables inspector is shown in react@15.4.0:
`Attempted to assign to readonly property`
![image](https://cloud.githubusercontent.com/assets/7693239/20824463/14f7bfc8-b898-11e6-9bc3-50434492ee40.png)

Convert children into an array by using React.Children.toArray.
Closes https://github.com/facebook/react-native/pull/11262

Differential Revision: D4329147

fbshipit-source-id: 38c9f78b5a81964efccacc7a08b66dda7acb7dc5
2016-12-22 16:28:34 -08:00
Héctor Ramos 68f62596a3 Cleanup showcase titles
Summary:
- Use the same format when listing apps in a language other than English.
- Remove app (Calor) that is not actually available in the App Store.
- Remove subtitles from app names.
Closes https://github.com/facebook/react-native/pull/11551

Differential Revision: D4364185

Pulled By: hramos

fbshipit-source-id: 98901e60b5d81a53aad0651be46f195a33102071
2016-12-22 16:13:31 -08:00
Chris Hopman a8affb838d make the RN packager output more deterministic
Reviewed By: davidaurelio

Differential Revision: D4357109

fbshipit-source-id: bc9ef04d81223299fe7708aeb0fe654647330ab7
2016-12-22 15:58:30 -08:00
Kevin Lacker 0b27d2e22f reenable circle e2e tests
Summary:
We turned them off on Wednesday Dec 14 when both CIs were busted. Once Circle runs on this PR it'll demonstrate they are functional again.
Closes https://github.com/facebook/react-native/pull/11547

Differential Revision: D4364177

Pulled By: hramos

fbshipit-source-id: 8a3b24a2795d0fcf4255cb3174acedc10ff6fbe7
2016-12-22 15:28:32 -08:00
Dan Hassin c8a7f9e2d1 Support custom card style interpolators
Summary:
Transition animations are not very customizable right now with NavigationExperimental, unless I am missing something big. This PR allows NavigationCardStack to receive the `horizontalCardStyleInterpolator` and `verticalCardStyleInterpolator` props to override the default interpolators.

See the gif, transition animation changes from the default one (with scale) to a custom one (without scale) when passing in a custom interpolator. (The custom interpolator is an exact copy of the one in `NavigationCardStackStyleInterpolator.forHorizontal`, minus the scale transform.)

![cmz0gagoec](https://cloud.githubusercontent.com/assets/1389312/20552499/af33667c-b119-11e6-97e7-bea9986a58e0.gif)

Let me know if there's a robust way to test, but I couldn't find anything.

**To address**
The new `canUseNativeDriver` function on NavigationCardStackStyleInterpolator, which returns `true`, is dependent on the interpolator, so custom interpolators may need to falsify this. Didn't include it on the first pass since I wasn
Closes https://github.com/facebook/react-native/pull/11082

Differential Revision: D4362540

Pulled By: ericvicenti

fbshipit-source-id: 2ebd0047c147ac3d6c43ce880661c99de8fd0880
2016-12-22 11:13:27 -08:00
Rob Hogan 59276468f2 Fix CLI Error when there is no windows project
Summary:
Running `master` (at 260d68bf8b) I noticed `react-native link` fails when there is no windows project due to a bug in the code that fetches windows project configs (introduced 445182c707).

There's a guard to return early if `csSolution` (the relative path of the windows solution) is null but it needs to be a line earlier, because `path.join` errors when passed a non-string.

Tested locally on a non-windows project, `react-native link` errored previously and now succeeds.
Closes https://github.com/facebook/react-native/pull/11590

Differential Revision: D4362419

fbshipit-source-id: b3b9f6784d8b1d1a7c53abe0ee421b1dc6048571
2016-12-22 10:58:36 -08:00
Emil Sjolander f625437ee9 Declaratively initialize default values of nodes
Reviewed By: passy

Differential Revision: D4356994

fbshipit-source-id: ebbe52163e0c86230bfa4131b657941afe16fbf1
2016-12-22 02:58:59 -08:00
David Hart c1aff605ed Transform the Count enum values into private constants
Summary:
Hides implementation details for the C, Objective-C and Swift APIs.
Closes https://github.com/facebook/yoga/pull/292

Differential Revision: D4351523

Pulled By: emilsjolander

fbshipit-source-id: 18a1149d169f0d52bd078714295000b5d07434dd
2016-12-22 02:58:59 -08:00
Emil Sjolander 05e0b6719b Convert max cache count into a define
Differential Revision: D4346529

fbshipit-source-id: 8641c4c5017d915d64e5884cae09ac8f01861337
2016-12-22 02:58:59 -08:00
Emil Sjolander b8e79d171a BREAKING - Increase priority of AspectRatio to override flex, align stretch, and fixed sizes if specified.
Summary: AspectRatio is a new addition and soon after introduction we noticed use cases which is did not support. Specifically we wanted to support a node being as large as possible within a container while maintaining an arbitrary aspect ratio. This was not possible due to the low priority of AspectRatio, by increasing the priority of AspectRatio this is now possible as FlexGrow will grow an item to fit its parent unless the AspectRatio makes it too big in the cross axis, the AspectRatio will now override the FlexGrow in the main axis in that case.

Differential Revision: D4346720

fbshipit-source-id: 1f15613604190e3ad5ff4a467ba57db4bcfd2741
2016-12-22 02:58:59 -08:00
Emil Sjolander 710391597b BREAKING - Change aspect ratio to always be width/height
Summary: Aspect ratio being defined as width/height or height/width depending on the situation it was used in turned out to be very confusing. This diff makes aspect ratio always be defined as width/height irregardless of the usage.

Differential Revision: D4339132

fbshipit-source-id: e5da32750b55ddaf6acaf1cbd7662d86f2b480c3
2016-12-22 02:58:59 -08:00
Emil Sjolander 18a2c2322b Correctly check if child is flex by also accounting for undefined
Differential Revision: D4346712

fbshipit-source-id: 69ef0bb3fe5b4fcd3b3e2fe5aa348529be40252a
2016-12-22 02:58:58 -08:00
Ahmed El-Helw 008ad0200f Fix measurement of virtual nodes
Summary:
Virtual nodes do not have backing Yoga nodes, so measure
their first non-virtual parent instead of measuring them.

Reviewed By: sriramramani

Differential Revision: D4360540

fbshipit-source-id: 505d35fec74dddf67b002d29268acc29d2651b13
2016-12-21 17:58:34 -08:00
Riku Ayanokoji 260d68bf8b add yarn-error.log to gitignore
Summary:
Due to react-native-cli use yarn if yarn is available, we need to add yarn-error.log to .gitignore.
Closes https://github.com/facebook/react-native/pull/11583

Differential Revision: D4359507

fbshipit-source-id: 0c7582215a31e0d03dced138c8275225910713ee
2016-12-21 15:28:39 -08:00
Andrej Badin c65aa545f2 add import for Promise interface
Summary:
Missing import might be misleading for less skilled devs.
Closes https://github.com/facebook/react-native/pull/11550

Differential Revision: D4358540

Pulled By: hramos

fbshipit-source-id: 1dada9f2ad179a64006c556c6e08e936fcc8f231
2016-12-21 12:13:32 -08:00
Georgiy Kassabli 67628d5407 Test for minHeight with flexing
Reviewed By: emilsjolander

Differential Revision: D4313632

fbshipit-source-id: 35be7d86b50a9ae08c81891a889a74e4b61f2d27
2016-12-21 11:43:30 -08:00
Theo Yaung e64618374b Fail-Fast on Redundant Java Callback Invocations
Reviewed By: dcaspi

Differential Revision: D4354731

fbshipit-source-id: d23351f23c8c5962da60af77340166fcb1314d78
2016-12-21 10:58:31 -08:00
Mike Grabowski 8305743725 Fix jest tests
Summary: https://www.facebook.com/groups/reactnativeoss/permalink/1627334037563224/

Differential Revision: D4357483

fbshipit-source-id: 32e9d91c2348e4046a5cfaa08eab34d1f4dd2f7e
2016-12-21 07:58:25 -08:00
Jean Lauliac 3d12ddb1db packager: TerminalReporter: properly reporting bundle updates
Reviewed By: cpojer

Differential Revision: D4357298

fbshipit-source-id: 89c70bb4bee103ad5a6301ac2b0c8712f190ba73
2016-12-21 05:58:32 -08:00
Jean Lauliac 04fdf40c61 packager: TerminalReporter: remove underline/emoji
Reviewed By: cpojer

Differential Revision: D4357225

fbshipit-source-id: 05d6b4fd9b79616a68e5fa3c4700aeac2f3552a9
2016-12-21 05:58:32 -08:00
Jean Lauliac efc12cd5bf packager: Fix typing of more Resolver options
Reviewed By: davidaurelio

Differential Revision: D4351879

fbshipit-source-id: aab3eb031ae3137d43d88ad1853aa7e6f5d165c5
2016-12-21 03:43:36 -08:00
Jean Lauliac b1132a91ab packager: Fix typing of Resolver options
Summary:
`declareOpts` is weakly typed. Since the callsite of Resolver constructor is itself flowifyed, we can get rid of `declareOpts`, and this provides us with much better typing.

Eventually I'd like to get rid of most of the defaults in the packager's inner code (ex. `watch` being false, `dev` being true). The reason is that defaults everywhere are prone to causing inconsistencies (for ex. some other code could have `dev` as false by default), problems that cannot be caught by Flow. Instead of having non-required options, I believe it is more sensible to provide helper functions that build sets of default options.

Reviewed By: davidaurelio, cpojer

Differential Revision: D4351874

fbshipit-source-id: 38653063f8939b4282c7c27cb6d5e3f3a25a9484
2016-12-21 03:43:36 -08:00
dlowder-salesforce fd5af61e5c Apple TV support 5: adjustments after manual import of #10427
Summary:
**Motivation**

After reviewing changes between my PR https://github.com/facebook/react-native/pull/10427 and what was eventually manually imported to master, found two minor adjustments needed.

**Test plan**

Existing tests should still pass.
Closes https://github.com/facebook/react-native/pull/11548

Differential Revision: D4357216

Pulled By: javache

fbshipit-source-id: 571794cda104210bf5236462c0700e07a2a51d29
2016-12-21 03:28:28 -08:00
Ahmed El-Helw d73746774b Fix SurfaceView not redrawing when it should
Summary:
Like its non-Nodes counterpart, FlatARTSurfaceViewShadowNode
should redraw when extra updates are collected.

Reviewed By: sriramramani

Differential Revision: D4355702

fbshipit-source-id: 6e7b90360958481f5bef9b806eca9fa888cb6a32
2016-12-20 18:28:38 -08:00
Emmanouil Konstantinidis 797506f09f Jest - Support Immutable Objects for ListViewDataSource mock
Summary:
Currently the jest mock for `ListViewDataSource` has a property called `items` which returns the number of items of the data source. Example from a snapshot:

    ListViewDataSource {
      "items": 6,
    }

If the datablob includes immutable Maps like:

    const dataBlob = {
      'alpha': immutable.Map({ name: 'Alpha' }),
      'beta': immutable.Map({ name: 'Beta' }),
    };

then the result is:

    ListViewDataSource {
      "items": NaN,
    }

This PR checks if the properties of the `dataBlob` are immutable Maps and then checks whether they are empty.

The result for the above dataBlob would be:

    ListViewDataSource {
      "items": 2,
    }
Closes https://github.com/facebook/react-native/pull/11567

Differential Revision: D4354977

Pulled By: cpojer

fbshipit-source-id: 9f6bd6ea9896eebd9373344a43ffe97deee5015b
2016-12-20 16:58:29 -08:00
Héctor Ramos 977acb9b68 Add Blink App in Showcase
Summary:
We have made a Companion app for our Blink smart watch in React Native. Currently, It's available only in the Play store. It will be launched in App Store soon. It is under review by apple team with our hardware.

If you want to know more about the company, You can checkout Mashable ( http://mashable.com/2016/09/30/blink-smartwatch-india/#aAdTEyTkfOqW ) , The Next Web ( http://thenextweb.com/gadgets/2016/09/30/the-blink-smartwatch-takes-the-fight-to-google-and-pebble-with-a-custom-os/ ) , Tech in Asia ( https://www.techinasia.com/witworks-blink-%3E%20smartwatch-apple-competitor ) etc.,

Thanks.,
Closes https://github.com/facebook/react-native/pull/11404

Differential Revision: D4354740

Pulled By: hramos

fbshipit-source-id: 18307d43d93fd442d9ff1c283827f91542253ea3
2016-12-20 16:28:38 -08:00
Spencer Ahrens 5537055bf8 Add some `Fake`s for easier interaction snapshot testing
Summary:
`Fake` components are simplified so snapshots are stable and reliable, and references are exported
so that interactions like `onRefresh` and `onScroll` can be called manually. Currently there is just
one global export for each class, but we may change this in the future if we need to manage multiple
`Fake`s of the same type in one render tree.

Right now these must be installed explicitly, but I might move them into `__mocks__` folders if it
seems reasonable to make them defaults.

Reviewed By: cpojer

Differential Revision: D4318207

fbshipit-source-id: 62802353a98b09ca1c80804ef7201ea63091f94a
2016-12-20 15:58:30 -08:00
Connor McEwen ab89b7195d Fix babelHelpers.typeof is not a function
Summary:
We started encountering the error described in #5747 (`babelHelpers.typeof is not a function) after switching from npm to yarn. [This comment](https://github.com/facebook/react-native/issues/5747#issuecomment-192356656) led to [this comment](https://github.com/facebook/react-native/issues/4844#issuecomment-191282653) which contains a solution we've been using successfully in our production app.

Maybe I didn't look in the right place but it doesn't seem anyone had actually PR'd this change before (if so and I didn't find it, I apologize).

An alternative solution it seems is to add a [different .babelrc](http://stackoverflow.com/questions/35563025/new-react-native-app-has-typeerror-babelhelpers-typeof-is-not-a-function-ios), but this seems easier to me.
Closes https://github.com/facebook/react-native/pull/11093

Differential Revision: D4353977

fbshipit-source-id: 3e45de29ef5d0e046219a32df6530dcf838b9fd9
2016-12-20 15:28:29 -08:00
Jean Lauliac 2f1d1bdfe8 packager: Module: remove too-many-misses codepath
Summary:
This code is a bit sloppy, I need to rethink about it. So I prefer to remove it altogether for now.
The problem with this is that it is disabling the global cache "put" operations at the same time, so the script supposed to update the cache actually doesn't do the job past the fist few hundred files. This defeats the purpose of the global cache.

Reviewed By: cpojer

Differential Revision: D4346927

fbshipit-source-id: 5b668e66b1909f53783772c613781753ac605546
2016-12-20 03:13:32 -08:00
Ahmed El-Helw 3998650468 Add a README file for Nodes
Summary:
Add a README file explaining the purpose of Nodes and how to
enable it within an app.

Reviewed By: JoelMarcey, lacker

Differential Revision: D4349517

fbshipit-source-id: ec26ebb37039e7c23ecd2cf4b482fa21ca8beeda
2016-12-19 16:58:30 -08:00
Libin Lu 550469bb82 Expose pressRetentionOffset for Text
Summary:
expose this property to make Text having same property like TouchableHighlight
Closes https://github.com/facebook/react-native/pull/11473

Differential Revision: D4348825

fbshipit-source-id: 941bcc681139d4460f52fed5174be1d2381462c7
2016-12-19 15:58:39 -08:00
Mani Ghasemlou a19c6991c0 Fix for dimensions not updating correctly on iPad due to screen rotation
Summary:
On certain devices (in my case, any iPad Pro model), listening to `DeviceEventEmitter.didUpdateDimensions` would call back *before* the interface change takes places (i.e. calling `Dimensions.get()` in this callback would return wrong values). Turns out that we were listening for the wrong native event.

Edit to add: now using `[RCTSharedApplication() statusBarOrientation]` to get the current orientation. Not yet sure why, but the `userInfo` provided by the notification was returning the wrong orientation *only* on the first time you rotate the device.

This fixes the open issue: https://github.com/facebook/react-native/issues/7340
Closes https://github.com/facebook/react-native/pull/11350

Differential Revision: D4348186

Pulled By: javache

fbshipit-source-id: cb2cfb9cccfc459ad4b46a5af2bec4c973132ae8
2016-12-19 14:58:54 -08:00
Mehdi Mulani ac11eedfb0 Show yellowbox when we fail to load a local image
Reviewed By: achen1

Differential Revision: D4342295

fbshipit-source-id: 9411ffe9a376e1ed51fcadee718326d1d9443fff
2016-12-19 14:07:08 -08:00
Ahmed El-Helw d3d5d7b7c9 Update build scripts for Nodes 2016-12-19 13:41:07 -08:00
Ahmed El-Helw 761089211f Fix drawRect with NaN when drawing borders in Nodes
Summary:
drawRect was sometimes being called with NaN values, which caused
very strange ui behavior on some devices. This patch fixes the problem by
ensuring that we use a default value when the value is NaN.

Reviewed By: AaaChiuuu

Differential Revision: D4338453
2016-12-19 13:40:36 -08:00
Emil Sjolander e9dba410eb Update java package name to yoga
Summary: Update package name of java code to refer to yoga instead of csslayout. Still need to change the name of the folder where this code resides but that requires update github sync scripts etc so it is safer and easier to split these diffs apart.

Differential Revision: D4271420
2016-12-19 13:40:36 -08:00
Emil Sjolander 009a792804 Rename java API
Summary: Rename java api to new use yoga naming

Reviewed By: IanChilds

Differential Revision: D4265345
2016-12-19 13:40:36 -08:00
Ahmed El-Helw c5eb13facd Revert D3754778: Don't double clip images in Nodes
Summary: This reverts commit c5af305fa2b9ab15e2a31287dac4e5a3992aeb0d

Differential Revision: D3754778
2016-12-19 13:40:36 -08:00
Emil Sjolander b7c2cfcb34 Rename enums
Summary: new name, start by renaming enums

Differential Revision: D4244360
2016-12-19 13:40:35 -08:00
Emil Sjolander 75561f7f78 Remove deprecated java code
Summary: Remove deprecated java code and make use of CSSEdge instead of the now removed Spacing class.

Reviewed By: AaaChiuuu

Differential Revision: D4233198
2016-12-19 13:40:35 -08:00
Andy Street 29754eb95d BREAKING [react_native] Don't create CSSNodes for virtual shadow nodes
Summary:
@public

Virtual shadow nodes (e.g. text) don't use CSSNodes so we don't need to create them. This shows large savings in CSSNodes allocated, depending on the app.

This could be breaking if:
- You have virtual nodes that still set and get CSS properties. The setters now no-op for virtual nodes (I unfortunately couldn't remove them completely -- see the comment on LayoutShadowNode), but the getters will NPE. If you see these NPE's, you should almost definitely be using your own datastructure instead of a CSSNode as virtual nodes will not participate in the layout process (and the CSSNode is then behaving just as a POJO for you).

I do not anticipate this to be breaking for anyone, but am including breaking in the commit message since this is a change in API contract.

Reviewed By: emilsjolander

Differential Revision: D4220204
2016-12-19 13:40:35 -08:00
Andy Street 03ac82e387 Recycle CSSNodes
Summary:
@public

Adds a pool to recycle CSSNodes within UIManager. A follow-up diff will hook this up to a memory pressure listener to drop the pool on memory pressure.

Reviewed By: emilsjolander

Differential Revision: D4189532
2016-12-19 13:40:35 -08:00
Andy Street bb8d540cf7 Use markUpdated instead of dirty setPadding in nodes
Summary: setPadding already calls dirty, and we should only be calling dirty on nodes that have measure functions.

Reviewed By: emilsjolander

Differential Revision: D4205148
2016-12-19 13:40:35 -08:00