Commit Graph

1561 Commits

Author SHA1 Message Date
Valentin Shergin 98798a06ae More accurate implementation of `RCTRootView`'s `sizeThatFits:`
Reviewed By: mmmulani

Differential Revision: D4672788

fbshipit-source-id: 780487f2264916349e32785808a93ed6f957e471
2017-03-13 13:30:31 -07:00
Pieter De Baets 41f3d0cf2d Expose getter for 'flex' property
Summary: Helps mitigate part of https://github.com/facebook/react-native/pull/12245 while we wait for a more comprehensive solution.

Reviewed By: emilsjolander

Differential Revision: D4571776

fbshipit-source-id: 185cd1b0d3af37724136a37471df412c2000dfe4
2017-03-13 06:00:19 -07:00
Douglas Lowder 02a6621e23 Add systemJSCWrapper.cpp to React-tvOS target
Summary:
**Motivation**: Fix Apple TV build breakage

**Test plan**: This fixes Travis test that builds tvOS targets.
Closes https://github.com/facebook/react-native/pull/12869

Differential Revision: D4692883

fbshipit-source-id: 3babfe4ab6d80143e15410bff7cae41ada3bf09f
2017-03-10 16:30:33 -08:00
Martin Konicek a8bd4621af Try to fix tvOS and podspec builds
Summary: Closes https://github.com/facebook/react-native/pull/12866

Differential Revision: D4691348

Pulled By: ericvicenti

fbshipit-source-id: df7d611aa4ed3fed6158d2210a0403c90875b7c3
2017-03-10 13:17:18 -08:00
Theo Yaung acb9fa8f66 Refactor dependencies
Reviewed By: mkonicek

Differential Revision: D4689351

fbshipit-source-id: 35e6939379dcb6723e7749883ad9613459f9787b
2017-03-10 09:15:50 -08:00
Martin Konicek 5c24a9110a Update Boost dependency to 1.63 on iOS
Summary:
We use this version internally.
Closes https://github.com/facebook/react-native/pull/12838

Differential Revision: D4688982

Pulled By: mkonicek

fbshipit-source-id: d8a6f8168b9e71ff4f53a8c18d55dc5a759a9183
2017-03-10 05:45:28 -08:00
Valentin Shergin 264d60b979 Setting `availableSize` for `RCTRootShadowView` on earlier stage
Summary:
Moving setting `availableSize` for `RCTRootShadowView` on earlier stage allows to prevent situations where `availableSize` is not specified yet, but Yoga layout is already happening.
Because `availableSize` equals {infinity, infinity} by default (in this case), Yoga returns a lot of nodes with infinit metrics, which confises UIKit.

Reviewed By: mmmulani

Differential Revision: D4672170

fbshipit-source-id: f9d8c84799dcbdb6b9230ddef6284d84df268833
2017-03-08 19:00:14 -08:00
Adam Comella 22b3faf1ad iOS: Expose fontScale to JavaScript
Summary:
A related Android PR is #11008.

Font scale was exposed through:
  - The `getContentSizeMultiplier` method
  - The `didUpdateContentSizeMultiplier` event

These are now deprecated. The reason is that there was already an API that exposed font scale. However, it was Android only. We now expose font scale through that API on iOS as well. Specifically:
  - Font scale is now available as `PixelRatio.getFontScale()`.
  - The `change` event on the `Dimensions` object now fires when font scale changes.

This change also adds support for `Dimensions.get('screen')` on iOS. Previously, only `Dimensions.get('window')` was available on iOS. The motivation is that, [according to this comment](https://github.com/facebook/react-native/pull/11008#issuecomment-275123609), we'd like to deprecate `window` dimensions in favor of `screen` dimensions in the future.

**Test plan (required)**

Verified that `PixelRatio.getFontScale()` and the `change` event work properly in a test app.

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

Differential Revision: D4673642

Pulled By: mkonicek

fbshipit-source-id: 2602204da6998a96216e06f5321f28f6603e4972
2017-03-08 05:59:41 -08:00
Martin Konicek 48f30eca7e Move iOS Maps out of the GitHub repo to internal fb codebase
Summary:
MapView has been deprecated in open source for a while: http://facebook.github.io/react-native/docs/mapview.html
We still want to use it internally. Moving it away from the GitHub folder.

Reviewed By: mmmulani

Differential Revision: D4646199

fbshipit-source-id: f469971e448dbca12afe141b43fa8a2518c7d467
2017-03-08 05:01:36 -08:00
Marc Horowitz cb3a439d17 Upgrade double-conversion to 1.1.5
Reviewed By: ericvicenti

Differential Revision: D4662924

fbshipit-source-id: ecf4a3d8aee8a3def1d8308456ca2551b4669f63
2017-03-07 12:08:40 -08:00
Mehdi Mulani 0a06250d24 Add build-time check that module methods are exported correctly
Summary:
This prevents someone from only putting `RCT_EXPORT_METHOD(...)` around some of the arguments to a method and generally causing confusion. Yes, before this diff it would still compile correctly if you did something like:

```
RCT_EXPORT_METHOD(lol:(NSNumber *)lol)
blah:(id)blah
{
  NSLog(@"%@ %@", lol, blah);
}
```

Reviewed By: fkgozali

Differential Revision: D4660019

fbshipit-source-id: 1829a47e5c8d5e8ce93edca2ac7efd7e2bfdf840
2017-03-07 10:45:36 -08:00
Marc Horowitz d1411f11d3 Drop calls to [RCTCxxBridge enqueueCallback:args:] on an invalid instance
Reviewed By: mmmulani

Differential Revision: D4655339

fbshipit-source-id: a6cb026325a030fa15a25638ebfb17ac9ea53767
2017-03-06 12:03:30 -08:00
Janic Duplessis 7d06c35d1c Run install third party script as part of the xcode build
Summary:
Runs the `./ios-install-third-party.sh` script as part of the build process to avoid having to do it manually when building the cxx bridge with xcode. Also added the third-party dir to gitignore.

**Test plan**
Tested that just building works when the third-party dir is missing.
Closes https://github.com/facebook/react-native/pull/12694

Differential Revision: D4658165

Pulled By: ericvicenti

fbshipit-source-id: 9b51b88eb26637b19266bf85deafa41e3a77a645
2017-03-06 00:00:55 -08:00
Janic Duplessis 5353d39172 Remove unused native iOS sticky headers implementation
Summary:
Remove the native iOS sticky headers implementation that has been replaced by the js Animated one. Also remove a line in JS that made sure we passed null to native so it did not use the native implementation.

**Test plan**
Made sure there were no more mentions of sticky / header in native ScrollView related code.
Tested that sticky headers still work :o
Closes https://github.com/facebook/react-native/pull/12696

Differential Revision: D4657391

Pulled By: ericvicenti

fbshipit-source-id: 16324a45ca4ce5cd143293c61394a0fa7ad0c4a1
2017-03-05 14:21:40 -08:00
Kevin Gozali c04e79e85a iOS: fixed RCTDevSettings executor-override handling
Summary: RCTDevSettings incorrectly assigned "bad" executor-override class to the executor instead of checking if the class exists before assigning it. It should really check if the class exists, and fallback to defaults otherwise.

Reviewed By: mmmulani, yungsters

Differential Revision: D4655926

fbshipit-source-id: 48c8fe28f22aaa8430752411ce5e6e858dbd4b32
2017-03-04 16:47:11 -08:00
Marc Horowitz 218e37dbab Fix missing/renamed files so OSS builds again
Reviewed By: ericvicenti

Differential Revision: D4652383

fbshipit-source-id: 04f816c333aba81d936135d7e5fc29a8f9de3af7
2017-03-03 14:17:14 -08:00
Emil Sjolander 4d69f4b2d1 Add display:none support to react native
Summary:
This diff adds display:none support to React Native. This enables hiding components which still calling their render method and keeping them within the state of your application. This enables preserving state in a component even though the component is not visible. Previously this was often implemented by rendering a component off screen as a work around. See below playground for usage.

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white'}}>
        <View style={{width: 100, height: 100, display: 'none', backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, backgroundColor: 'blue'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4611771

fbshipit-source-id: 0dbe0494d989df42994ab9ad5125d47f3233cc5a
2017-03-01 09:16:05 -08:00
Emil Sjolander 31f848a5fa Expose alignContent to react native
Summary:
This diff adds alignContent (https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) support to React Native. This enables aligning the lines of multi-line content. See below playground for example usage.

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white', flexWrap: 'wrap', alignContent: 'space-between'}}>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 10, marginTop: 10, backgroundColor: 'red'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4611803

fbshipit-source-id: ae7f6b4b7e9f4bc78d2502da948214294aad4dd2
2017-03-01 09:16:05 -08:00
Emil Sjolander cc275557be Add margin auto support to react native
Summary:
This diff adds margin:auto (https://drafts.csswg.org/css-flexbox-1/#auto-margins) support to React Native. This enables layout not previously supported without inserting empty 'spacer' views. See below Playground for usage.

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white'}}>
        <View style={{width: 100, height: 100, backgroundColor: 'red'}}/>
        <View style={{width: 100, height: 100, marginLeft: 'auto', backgroundColor: 'blue'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4611753

fbshipit-source-id: e78335565c193f7fb263129a638b444715ba5ab0
2017-03-01 09:16:05 -08:00
Emil Sjolander 23f2f5f239 default root node to size of parent contraints
Reviewed By: dshahidehpour

Differential Revision: D4634616

fbshipit-source-id: 089eb4313c5bb810a6ff56f158cd19cec71808ec
2017-03-01 07:15:23 -08:00
Marc Horowitz 611661e5fe TODO is done
Reviewed By: AaaChiuuu

Differential Revision: D4614454

fbshipit-source-id: 48d66b26371834e35c43731a22abc015fc234650
2017-02-28 14:15:57 -08:00
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
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
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
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
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
Lukas Piatkowski 0707361b00 Add a RCTPackagerClientMethod handler for pokeSamplingProfiler in DevMenu
Reviewed By: javache

Differential Revision: D4579600

fbshipit-source-id: dfdf2b6ca0690988015873add58c43faa96ab0a6
2017-02-24 08:30:50 -08:00
Ben Roth 6a14f0b449 Add RCTDevSettings module
Summary:
This decouples non-UI logic from RCTDevMenu into a new module RCTDevSettings.

**Motivation**: This allows developers to change dev settings without depending on the built-in dev menu, e.g. if they want to introduce their own UI, or have other devtools logic that doesn't depend on an action sheet.

It also introduces the RCTDevSettingsDataSource protocol for storing dev tools preferences. This could allow a developer to implement alternative behaviors, e.g. loading the settings from some other config, changing settings based on the user, deciding not to persist some settings, or something else.

The included data source implementation, RCTDevSettingsUserDefaultsDataSource, uses NSUserDefaults and is backwards compatible with the older implementation, so **no workflows or dependent code will break, and old saved settings will persist.**

The RCTDevMenu interface has not changed and is therefore also backwards-compatible, though
some methods are now deprecated.

In order to ensure that RCTDevSettings
Closes https://github.com/facebook/react-native/pull/11613

Reviewed By: mmmulani

Differential Revision: D4571773

Pulled By: javache

fbshipit-source-id: 25555d0a6eaa81f694343e079ed02439e5845fbc
2017-02-24 07:00:16 -08:00
Lukas Piatkowski ccc525c5ca Refactor iOS packager webSocket handling to resemble Android's packagerconnection
Reviewed By: javache

Differential Revision: D4572607

fbshipit-source-id: b588d6216f7b84aef5a63454d2d8978783412c7b
2017-02-23 10:03:54 -08:00
Pieter De Baets dba133a291 Merge AndroidConstants and IOSConstants into PlatformConstants
Reviewed By: AaaChiuuu

Differential Revision: D4597790

fbshipit-source-id: 0a54598d6e9cadb75efff4ac17c13899d6785f9b
2017-02-22 15:01:11 -08:00
Benoit VALLON ca2741609a Fix badgeColor for previous iOS 10 versions
Summary:
The actual badgeColor prop causes the following error when run on device with a version inferior to iOS 10 like iPad 2 and iPad mini 1.

`*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarItem setBadgeColor:]: unrecognized selector sent to instance 0x7968be80'`

This PR fixes it by checking at runtime if the selector is available for the current running version.

It also makes the color available at start by using the variable `self.barItem`. Currently, the color appears only after a reload.
Closes https://github.com/facebook/react-native/pull/12354

Differential Revision: D4598036

Pulled By: shergin

fbshipit-source-id: 9f104fc27db51213a54273e33c5a22f1b350c55e
2017-02-22 12:04:10 -08:00
Adam Comella 6fbc2c9972 iOS: Remove leading space from accessibilityLabel
Summary:
In some cases, the accessibilityLabel contains a leading space. This is because `RCTRecursiveAccessibilityLabel` adds a space before every iteration of the loop including the first.

After this change, the contract is that:
  - `RCTRecursiveAccessibilityLabel` always returns a string with a leading space.
  - `accessibilityLabel` never returns a string with a leading space.

**Test plan**

I created a test app with the following code:

```
<View style={{height: 100, width: 100, backgroundColor: 'steelblue'}} accessible={true}>
  <View style={{height: 20, width: 20, backgroundColor: 'red'}} accessibilityLabel='One' />
  <View style={{height: 20, width: 20, backgroundColor: 'yellow'}} accessibilityLabel='Two' />
  <View style={{height: 20, width: 20, backgroundColor: 'green'}} accessibilityLabel='Three' />
</View>
```

Before this change, the accessibilityLabel of the outermost View was " One Two Three" (notice the leading space).

After this change, it is "One Two Three" as desired.

Adam
Closes https://github.com/facebook/react-native/pull/12269

Reviewed By: javache

Differential Revision: D4596761

Pulled By: shergin

fbshipit-source-id: 7d5ff704e858d9f277d1547339a2831ffa90f592
2017-02-22 11:16:13 -08:00
Valentin Shergin e361ce8673 `RCTShadowViews`'s `cssNode` property was renamed to `yogaNode`
Reviewed By: javache

Differential Revision: D4590104

fbshipit-source-id: 7767aaa62bcbdce2746c3a26543052dd46be63e0
2017-02-21 08:45:05 -08:00
Pieter De Baets bdd27f4696 Break apart -[RCTComponentData propBlockForKey:inDictionary:]
Reviewed By: shergin

Differential Revision: D4578549

fbshipit-source-id: 726773fdf8c97cdcc3b0540b32278e36c00b19b5
2017-02-20 05:15:25 -08:00
Pieter De Baets ebe3355de7 Create NSDataBigString
Reviewed By: bnham

Differential Revision: D4559734

fbshipit-source-id: 6766093524ae79ed2a41285d33eb2207993a7d0e
2017-02-20 05:00:58 -08:00
Ashok Menon 1635c02e92 Simplifying Struct definition.
Summary:
Since we are reading from a file, we should make sure this struct is packed, just in case we change it down the line and the compiler decides it might want to introduce padding, we're now protected against that.

There was also a discussion about the fact that people might use `ptr += sizeof(BundleHeader)` as an idiom in their code, which would currently be incorrect, if padding was introduced at the end of the file. Actually, it remains incorrect to do that now, because a RAM bundle header is a different size to a BC Bundle header. If people are properly testing their code, they should spot this pretty quickly, because it will always be an incorrect thing to do with a RAM bundle, so this isn't as bad as previously thought: where the code only succeeds when the compiler deigns to not pad the struct at the end.

This diff also cleans up how headers are initialised. `BundleHeader` has a constructor that explicitly zero-initialises it so we can rely on the default initializer to do the right thing now.

Reviewed By: mhorowitz

Differential Revision: D4572032

fbshipit-source-id: 7dc50cfa9438dfdfb9f842dc39d8f15334813c63
2017-02-20 04:30:19 -08:00
Valentin Shergin c02c78a681 Splitting `RCTRootView.m`, decoupling RCTRootContentView
Reviewed By: javache

Differential Revision: D4570067

fbshipit-source-id: 91305d0c175af135ce2f22d7992bee68c13da80e
2017-02-19 23:19:47 -08:00
Valentin Shergin ba170ec78c Simplifying mess with RCTRootViewSizeFlexibility
Summary:
Now things look much more clear, I hope.
This diff:
 * Introduces new property of `RCTRootShadowView` `availableSize` which represents exactly what we transmit to layout engine;
 * Illuminates conflict between logical `availableSize` and explicitly specified size of DOM node (current `size`);
 * Splits overcomplicated `setSize:forView:` method into two unrelated ones;
 * Changes actual values of `RCTRootViewSizeFlexibility` enum constants for simpler usage;
 * Completely removes `sizeFlexibility` concept from `RCTRootShadowView` (in favor of special values of `availableSize`);
 * Makes the code clearer finally.

This is beginning of big effort to improve `RCTRootView` and co.

Reviewed By: mmmulani

Differential Revision: D4562834

fbshipit-source-id: f5baaf2859ea430d44645a6b5d35f222f15a668e
2017-02-19 23:19:47 -08:00
Mathieu Baudet 4a893ee071 remove unused includes in fbobjc/Libraries
Reviewed By: swolchok

Differential Revision: D4507573

fbshipit-source-id: 7fc6df52bc37c39698c7897be567758469417218
2017-02-19 18:33:49 -08:00
Mehdi Mulani 93a263d874 Make RCTRefreshControl not dependent on order of setting properties
Summary: With the Cxx bridge, properties are not guaranteed to be set it any order (and furthermore, they should not be). RCTRefreshControl previously had its title set first, and would crash otherwise. This fixes that.

Reviewed By: mhorowitz

Differential Revision: D4580253

fbshipit-source-id: 39baecceb8b67c6a851c08ba9cabbf4dc99359cb
2017-02-17 15:16:01 -08:00
Ashok Menon 3148cc09ae Fix CI runs
Summary: I broke Circle CI builds by moving a file, so I am updating the OSS build setup with details of the move. Whilst I was testing the change, I noticed that the UI Explorer build was also already broken, so this diff also changes some of its configuration to make it build again.

Reviewed By: javache

Differential Revision: D4579137

fbshipit-source-id: 4cbb1ef148075280b991cbc5bb47bf96ec3d543a
2017-02-17 09:17:19 -08:00
Pieter De Baets 591de3e278 Move tryBytecode to bundle specifier
Reviewed By: amnn

Differential Revision: D4559898

fbshipit-source-id: 917bef5a1d753b52e9e967f3029eb158935feee6
2017-02-17 06:00:55 -08:00
Alexey Lang ba029becbe Support QuickPerformanceLogger.js in CxxBridge
Reviewed By: javache

Differential Revision: D4573567

fbshipit-source-id: 3ef9da38fb178cf4c1400b4a991a9e85f3ec3755
2017-02-17 06:00:54 -08:00
Pieter De Baets 0c8e925a18 Move initializedExecutorWithContextProvider API
Reviewed By: dcaspi

Differential Revision: D4558591

fbshipit-source-id: 821d6a6d4e42d1c67559fde102a0558eb623733b
2017-02-17 02:30:45 -08:00
Pieter De Baets c529a06cb8 Remove unused RCTMessageQueue
Reviewed By: mhorowitz

Differential Revision: D4564975

fbshipit-source-id: 62cb686fe5fefb4ec4a8f5db44898a95496420be
2017-02-16 15:18:43 -08:00
Pieter De Baets 11e59e3ff4 Move some utilities to RCTCxxUtils
Reviewed By: mhorowitz

Differential Revision: D4551173

fbshipit-source-id: db01d3205ec1feb54c815c0f0fc688fc7a4823d0
2017-02-16 14:02:03 -08:00
Alexey Lang 7c97008fa8 Support QuickPerformanceLogger.js in the old bridge
Reviewed By: javache

Differential Revision: D4566647

fbshipit-source-id: 1a6448b89b14f4ce9f2192e9f7b4e28b8dcb52b7
2017-02-16 11:33:48 -08:00
Emil Sjolander 1b5eb36e2f Fix up some small issues with YGUnitAuto
Reviewed By: wwjholmes

Differential Revision: D4567045

fbshipit-source-id: ace5fd89bd534a6bb5ec7dba0c3afbf13d62d7c9
2017-02-16 06:59:33 -08:00
Pieter De Baets 53b387638e Move JSBigString to its own header
Reviewed By: mhorowitz

Differential Revision: D4551162

fbshipit-source-id: 2374e05e60942211e50af86ed42eb194e5e82bbe
2017-02-16 06:59:30 -08:00
Pieter De Baets 5d4ff693b4 Move RCTFollyConvert to the correct namespace
Reviewed By: mhorowitz

Differential Revision: D4551124

fbshipit-source-id: 40a0a8ca818710a7529798b8244d9c133eb5c22d
2017-02-16 06:59:27 -08:00
Lukas Piatkowski a2addbd932 BREAKING: Change the js1 - packager - RN App protocol to version 2
Reviewed By: cwdick

Differential Revision: D4551991

fbshipit-source-id: 395c38ee5c71ddc24d8743e7ec90cc89de087503
2017-02-16 04:30:00 -08:00
Pieter De Baets 8987d86718 Fix error handling for nested exceptions
Reviewed By: mhorowitz

Differential Revision: D4551110

fbshipit-source-id: e593c1ef0dea27e95a387bcde6250aeb22d2e9cc
2017-02-15 06:15:11 -08:00
Pieter De Baets bbe0c45c19 Prevent deadlock after bridge reload
Reviewed By: dcaspi

Differential Revision: D4551097

fbshipit-source-id: 33b43b2691d4e595d3c09c9a5b101ce458c4d6d7
2017-02-15 06:15:11 -08:00
Pieter De Baets a2000d1200 Replace valueForKey with subscript access in RCTJavascriptLoader
Reviewed By: shergin

Differential Revision: D4559391

fbshipit-source-id: 44cb4900f93f2ac60dae3a461ed5344e1af08f3b
2017-02-15 03:45:55 -08:00
Kevin Gozali a512f6dcf6 ios: exposed 'RCTConvert UITabBarSystemItem:' in the header file
Summary: This method was defined in the .m file already, so we can just expose it to the header for other usages.

Reviewed By: mmmulani, shergin

Differential Revision: D4557942

fbshipit-source-id: a1be8af8e31b88a152cabfab6d4cf82316088572
2017-02-15 02:17:17 -08:00
Valentin Shergin 5263699f90 Introducing RCTRootShadowView.baseDirection property
Reviewed By: dshahidehpour

Differential Revision: D4555904

fbshipit-source-id: 8f0a2a9a38af42334188bc1cc5e0f6dded8592ae
2017-02-14 15:33:15 -08:00
David Hart 67f6b32409 Rename YGUnitPixel to YGPoint...
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375

Reviewed By: dshahidehpour

Differential Revision: D4528518

Pulled By: emilsjolander

fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
2017-02-14 14:31:31 -08:00
Lukas Wöhrl dbaa687518 Feature auto margin
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.

This PR adds an implementation for that.

It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357

Reviewed By: astreet

Differential Revision: D4501142

Pulled By: emilsjolander

fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
2017-02-14 14:31:31 -08:00
Pieter De Baets 4695508826 Remove iOS7 API check
Reviewed By: shergin

Differential Revision: D4551186

fbshipit-source-id: ab5ec3c01bbfe0faca833960431a9739cbc1ea44
2017-02-13 12:17:01 -08:00
Valentin Shergin 7686274e13 Removed RTL workaround in RCTShadowText
Reviewed By: fkgozali

Differential Revision: D4511274

fbshipit-source-id: f658afb4e1c943cc9ecab2dd2a91f251edd3fa36
2017-02-13 12:00:57 -08:00
Ciprian Pãtru dcf7f631f4 Enable perf monitor for CxxBridge
Reviewed By: javache

Differential Revision: D4510939

fbshipit-source-id: f90dc5c97b98ce68cb2c21e5f283790880b032a4
2017-02-09 12:47:04 -08:00
Valentin Shergin d8748233ca Removing `transformMatrix` and `decomposedMatrix` properties
Summary: We deprecated `transformMatrix` and `decomposedMatrix` in D3239960 10 months ago. This revision finally removes remains of this functionality from native code.

Reviewed By: mmmulani

Differential Revision: D4515760

fbshipit-source-id: b4d5b7e834ac4a775f4992b28270b4ff961889a6
2017-02-07 14:02:20 -08:00
Valentin Shergin ec673d0771 Added support of `direction` style property
Summary: Now layout direction (LTR or LTR) can be specified not only for whole app but also for view subtree via `direction` style property.

Reviewed By: mmmulani

Differential Revision: D4510206

fbshipit-source-id: 4e56c5886b6e42f2343165eb76be897e681c5ba4
2017-02-06 21:00:16 -08:00
Valentin Shergin 233015c93e `[-RCTUIManager setFrame:forView:]` was replaced with `[-RCTUIManager setSize:forView:]`
Reviewed By: fkgozali

Differential Revision: D4511712

fbshipit-source-id: 5c51d573bf638cb9b55d5f03b9f1882dc6129510
2017-02-06 11:01:11 -08:00
Valentin Shergin e38679fbc7 Added missing files to React.xcodeproj
Reviewed By: mmmulani

Differential Revision: D4513525

fbshipit-source-id: 40700db4cc8fd8eae1f7b98855a461489adaf86a
2017-02-05 11:43:32 -08:00
Valentin Shergin 54d3e83bbf Fixed crash in RCTScrollView on iOS 8
Reviewed By: javache

Differential Revision: D4508906

fbshipit-source-id: 08955f338879f708d35f4784e858a92b542e8661
2017-02-03 15:28:34 -08:00
Valentin Shergin 91910d87de Better RTL support especially for ScrollView's
Reviewed By: fkgozali

Differential Revision: D4478913

fbshipit-source-id: 525c17fa109ad3c35161b10940776f1426ba2535
2017-02-02 09:58:30 -08:00
Pieter De Baets 4d2512aef9 Replace MethodCallResult with folly::Optional
Reviewed By: AaaChiuuu

Differential Revision: D4481987

fbshipit-source-id: 945dd671eb2482f3c6b626192aa2181c5bfd906f
2017-02-02 05:13:33 -08:00
Marc Horowitz 81b2d69575 Fork UIExplorer.xcodeproj into UIExplorerCxx.xcodeproj
Reviewed By: javache

Differential Revision: D4434102

fbshipit-source-id: 45e128e7d985b58c04dda14f8e692051a552a491
2017-02-01 14:14:33 -08:00
Marc Horowitz aeab15d0aa Fork React.xcodeproj to build the C++ bridge
Reviewed By: javache

Differential Revision: D4434074

fbshipit-source-id: b096b887cdcd5ef900e540bcd6697b5980200add
2017-02-01 14:14:32 -08:00
Marc Horowitz b774820dc2 move C++ bridge into oss directory
Reviewed By: javache

Differential Revision: D4434052

fbshipit-source-id: ff2743eb7fe5d9cabb860752ca3d92d631a2f02b
2017-02-01 14:14:32 -08:00
Valentin Shergin f33f84e75f Deprecating/removing `setFrame`, `setLeftTop`, and co.
Summary:
Motivation:
 * `RCTShadowView`'s `frame` property actually represents computed layout of the view. We must not use it as a setter for yoga node styles;
 * Using `frame` and `setLeftTop` in existing way actually works only for view with absolute positioning, so it is super rare and special case;
 * Internally, setting `frame` only make sense to `RootView`, and in that case there we always must not change `origin` we are introducing `setSize` method.

Changes:
 * `[-RCTShadowView setFrame:]` was removed, `frame` property is readonly now;
 * `[-RCTShadowView setLeftTop:]` was removed; no replacement provided;
 * `[-RCTShadowView size]` read-write property was added;
 * `[-RCTUIManager setFrame:forView:]` was deprecated, use (just introduced) `setSize:forView:` instead;
 * `[-RCTUIManager setSize:forView:]` was added.

If you are still need some of removed methods, you are probably doing something wrong. Consider using `setIntrinsicContentSize`-family methods,
`setSize`-family methods, or (in the worst case) accessing `yogaNode` directly.

Reviewed By: javache

Differential Revision: D4491384

fbshipit-source-id: 56dd84567324c5a86e4c870a41c38322dc1224d2
2017-02-01 13:13:27 -08:00
Valentin Shergin d1990f8fc4 Better (right) implementation of `intrinsicContentSize`
Reviewed By: emilsjolander

Differential Revision: D4486767

fbshipit-source-id: d37ea11f9f48425d4d99c29e8bfb6c8ed2353f04
2017-01-31 16:58:32 -08:00
Max Graey c68195929b Fix skew transform on native side (iOS & Android)
Summary:
According to #11992 fix skew transform in native code as well

janicduplessis vjeux
Closes https://github.com/facebook/react-native/pull/12106

Differential Revision: D4479880

fbshipit-source-id: d84780842b555f6352d84d229b5b6c5c3c6a0647
2017-01-28 12:43:30 -08:00
Rob Hogan 2a5cb9a773 Typo: bagde -> badge
Summary:
Simple typo fix for an Obj-C local variable.
Closes https://github.com/facebook/react-native/pull/12099

Differential Revision: D4477106

fbshipit-source-id: 7626a22981e24946398d5f6299fd7dab664a1419
2017-01-27 14:58:27 -08:00
rh389 9d6d8a24eb RCTConvert: Deprecated NSStringArray typedef
Summary:
Eliminates a build warning related to the use of the deprecated `NSStringArray` typedef.

This fix was more complex than I'd anticipated because `NSStringArray` was also being used as part of a macro-generated selector name, and in two different ways for debug/release. I've added a macro which allows the selector name to be specified explicitly, thus generally allowing for converters which return arrays of templated types.

There's an argument for ditching `RCT_JSON_ARRAY_CONVERTER` in favour of `RCT_JSON_ARRAY_CONVERTER_NAMED` as they're both private, but `RCT_ARRAY_CONVERTER` is in the public API so we'd at least need to retain that. There are also arguments for ditching the use of the macro for the nested array case(s) - since afaik this is the only one at the moment. Feedback appreciated :)

Tested with the `UIExplorer` unit tests and by diffing the preprocessor output of `RCTConvert.m` in both release and debug configs, verifying that they're identical apart from that `NSStringArray` is replaced by
Closes https://github.com/facebook/react-native/pull/11799

Differential Revision: D4441197

fbshipit-source-id: 7535ebe6f8ad4566df742e805b0a64530d1b269f
2017-01-27 13:43:27 -08:00
Martin Konicek 9dee696ed8 Add scrollToEnd to ScrollView and ListView
Summary:
**Motivation**

A basic task of making a React Native ScrollView or ListView scroll to the bottom is currently very hard to accomplish:
- https://github.com/facebook/react-native/issues/8003
- https://github.com/facebook/react-native/issues/913
- http://stackoverflow.com/questions/29829375/how-to-scroll-to-bottom-in-react-native-listview

**NOTE:** If you're building something like a chat app where you want a ListView to keep scrolling to the bottom at all times, it's easiest to use the [react-native-invertible-scrollview](https://github.com/exponent/react-native-invertible-scroll-view) component rather calling `scrollToEnd` manually when layout changes. The invertible-scrollview uses a clever trick to invert the direction of the ScrollView.

This pull request adds a `scrollToEnd` method which scrolls to the bottom if the ScrollView is vertical, to the right if the ScrollView is horizontal.

The implementation is based on this SO answer:
http://stackoverflow.com/questions/952412/uiscrollview-scrol
Closes https://github.com/facebook/react-native/pull/12088

Differential Revision: D4474974

Pulled By: mkonicek

fbshipit-source-id: 6ecf8b3435f47dd3a31e2fd5be6859062711c233
2017-01-27 10:13:29 -08:00
Ryan Gomba 7e869b9d0a Drive any numerical prop via NativeAnimated
Summary:
In theory, we should be able to animate any non-layout property, including custom ones. While there is still work to be done on the native side to fully enable this, we should start by dropping the prop whitelist.
Closes https://github.com/facebook/react-native/pull/10658

Differential Revision: D4379031

Pulled By: ericvicenti

fbshipit-source-id: fe9c30ea101e93a8b260d7d09a909fafbb82fee6
2017-01-26 18:28:53 -08:00
Eric Vicenti 65513e501a Bug fix for nil TVView on pop
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

This change is required when you try to set a focus on a view that doesn't exist and thus cannot be focused. In my specific use case, this occurred when trying to set a focus on a list item in a setInterval when the View (with the specific list item) had been popped. The while loop ran infinitely (eventually freezing the app) since the rootView doesn't exist. This adds that check and breaks out if so.

All obj-c tests ran successfully.

dlowder-salesforce
Closes https://github.com/facebook/react-native/pull/12073

Differential Revision: D4468989

Pulled By: ericvicenti

fbshipit-source-id: 7926c887035722c983c41cb6b6d9df567010c2ee
2017-01-26 09:43:32 -08:00
Pieter De Baets 0fc62eebc3 Revert D4450924: Expose StatusBar height on iOS
Differential Revision: D4450924

fbshipit-source-id: a883a7417e85f0a923d5fcc4d5efff75b99c2272
2017-01-25 17:59:30 -08:00
Pieter De Baets a407ff94ee Add option to start sampling profiler on app launch
Reviewed By: mhorowitz

Differential Revision: D4415989

fbshipit-source-id: 30704c2b618656cb7cc0ccdf87dec315b30b62f3
2017-01-25 14:43:30 -08:00
Valentin Shergin 64041669ee The warning 'cannot calculate shadow efficiently' is not a warning anymore
Reviewed By: fkgozali, yungsters

Differential Revision: D4445304

fbshipit-source-id: 3a37150ae2beaf44b505dc36b575b7d44619e071
2017-01-25 12:28:50 -08:00
Mathieu Acthernoene eebfd33b70 Expose StatusBar height on iOS
Summary:
Following the PR https://github.com/facebook/react-native/pull/6195, this adds a `HEIGHT` constant on `StatusBar` for iOS.

Combined with `statusBarFrameDidChange` and `statusBarFrameWillChange` StatusBar native events, it solves various problems with In-Call cellar bar / Location bar / others 40pt status bars, and offers a correct `keyboardVerticalOffset` value for the KeyboardAvoidingView component.
Closes https://github.com/facebook/react-native/pull/12041

Differential Revision: D4450924

Pulled By: hramos

fbshipit-source-id: 664798260f4226140f3fa3f9222a415a305d0d78
2017-01-23 12:58:34 -08:00
Pieter De Baets 7412340175 Fix passThroughTouches
Reviewed By: mmmulani

Differential Revision: D4438390

fbshipit-source-id: 4e1ec4eaf80ffb48ac7b65ed092402c51d9227d3
2017-01-23 11:28:51 -08:00
Pieter De Baets 9681583cf3 Disable RCTPerfMonitor on new bridge
Reviewed By: mhorowitz

Differential Revision: D4446988

fbshipit-source-id: f36360b1ea049e64e2a6a9bffce0af8d0ab6839a
2017-01-23 10:13:31 -08:00
yueshuaijie 94f71a3884 Add one more parameter(keyboardType) to AlertIOS.promot().
Summary:
Add one more parameter which can specify the keyboard type of first text input(if exists) to AlertIOS.prompt().

Example usage:
`AlertIOS.prompt('Type a phone number', null, null, 'plain-text', undefined, 'phone-pad')`
Closes https://github.com/facebook/react-native/pull/8781

Differential Revision: D4437900

Pulled By: hramos

fbshipit-source-id: 8141cc0d7c70d13603cd5a1d5ea3f1ab1ce437a6
2017-01-19 14:43:37 -08:00
Mehdi Mulani 81c33b542d Switch out DISABLE_YELLOW_BOX for IS_TESTING
Summary: Switch to using IS_TESTING on the Platform module. While IS_TESTING has to be explicitly set in the test harness, this makes it more usable and stops people from relying on brittle variables in the (larger) environment.

Reviewed By: fkgozali

Differential Revision: D4423661

fbshipit-source-id: 27a80867778b9374bcba67b69f9c93d32c0a74b0
2017-01-18 12:28:42 -08:00
Peter Salanki 52d8851fc8 Cache policy control for image source
Summary:
In the context of an app an image exists in three resolutions on the server: `thumb` (30px) `feed` (300px) `full` (900px). When looking at an individual item a user can come either from the feed, via a permalink or from other parts of the app. This allows a situation where the `feed` image might or might not already be loaded somewhere in the app. In the detail view I want to render `thumb` with a blur (to quickly display something), then the `feed` image if it exists to have something decent to display until `full` loads. However it is quite a waste to load the `feed` image if it isn't already in cache, and will slow down the time until `full` is loaded. It is possible to track the navigation from feed->detail and that the `feed` image has actually completed loading by the feed component however as component hierarchies grow this turns into quite a lot of prop passing and bad separation of concerns.

NSURLRequests accepts a [Cache Policy](https://developer.apple.com/reference/fo
Closes https://github.com/facebook/react-native/pull/10844

Differential Revision: D4425959

Pulled By: lacker

fbshipit-source-id: 679835439c761a2fc894f56eb6d744c036cf0b49
2017-01-17 17:13:31 -08:00
Neil Sarkar 302d42da7f Remove deprecated method 'RCTExecuteOnMainThread'
Summary:
**Motivation**

This finishes the job of #11817, removing the previously deprecated method. See https://github.com/facebook/react-native/issues/11736 for more context.

**Test plan**

There were no tests for this method, and I searched the whole project to make sure we weren't relying on it anywhere.
Closes https://github.com/facebook/react-native/pull/11854

Differential Revision: D4421671

Pulled By: javache

fbshipit-source-id: 67e0db8d3c594ad3ccd6ccdae08f8ce49ddb8a34
2017-01-16 15:13:36 -08:00
Valentin Shergin 930010ec91 RCTTouchHandler doesn't delay any touches anymore
Reviewed By: mmmulani

Differential Revision: D4418211

fbshipit-source-id: 07fdd81d975c6b65477e599e2dcb604b64556e9e
2017-01-13 17:43:35 -08:00
Rob Hogan 9e1e52f312 Mark __unused completion block args
Summary:
Catching a couple more build warnings introduced by b50f55026a since https://github.com/facebook/react-native/pull/11797.

Edit: and one more introduced by c68a708621

Tested the build with UIExplorer.
Closes https://github.com/facebook/react-native/pull/11865

Differential Revision: D4415630

fbshipit-source-id: 1384d56770eea8665ede8bd9abe06cf34cd14b33
2017-01-13 12:43:31 -08:00
Mehdi Mulani 91b7499cf6 Expose environment and arguments to JS
Summary:
Right now from JS there's no way to see the environment variables or arguments that the application was started with.
The main use case for this is to help enable/disable features when being run in a testing environment (as environment variables are the easiest way to communicate).

javache is it okay to reference these constants from JS at startup time? I am planning to disable yellow boxes via an environment variable.

achen1 how easy is it expose these two things for Android as well?

Reviewed By: achen1

Differential Revision: D4395091

fbshipit-source-id: fc318e6a60b8829f7eb4491ea8f3258f68f59c8c
2017-01-13 12:28:31 -08:00
Pieter De Baets 8e4f33e669 Dismiss redbox upon pressing reload
Reviewed By: shergin

Differential Revision: D4405376

fbshipit-source-id: 63d624457c6afde3dbe71a66c57b410cf71cbbd3
2017-01-13 03:58:47 -08:00
Pieter De Baets a94418fdd3 Show redbox when no bundle is present
Reviewed By: shergin

Differential Revision: D4405409

fbshipit-source-id: 847fc559121dcde844f1ee3c6d02206e9e27803b
2017-01-13 03:43:35 -08:00
Valentin Shergin c68a708621 New way to handle simultaneously active gesture recognizers in RCTTouchHandler
Reviewed By: majak

Differential Revision: D4385209

fbshipit-source-id: 22746dd93e378a4d9e5feca66bc84c357afb6f36
2017-01-12 12:13:28 -08:00
rh389 4844225eed JavaScriptLoader BCBundle version check
Summary:
Currently a build warning is thrown by `if (header.BCVersion != runtimeBCVersion) ...` because `runtimeBCVersion` is signed, apparently because `-1` is used to mean that the runtime has no support for bytecode bundles.

This PR splits out the error case of the runtime not supporting BC bundles from the case of a version mismatch.

Tested as much as I could by building and running `UIExplorer` - I haven't attempted to use real bytecode bundles.
Closes https://github.com/facebook/react-native/pull/11806

Differential Revision: D4408608

fbshipit-source-id: a1d868bb2064588e6a20827692629a46b6ba1e74
2017-01-11 22:28:43 -08:00
Valentin Shergin f839b58c20 `UIManager.measure()` now respects any `zoom` affected view hierarchy
Reviewed By: mmmulani

Differential Revision: D4396422

fbshipit-source-id: 100c7050bdf9e66b8af27df335343f028a2d4148
2017-01-11 13:43:40 -08:00
Dan Caspi ad0493c6c2 Fixing a crash caused by D4393955
Reviewed By: javache

Differential Revision: D4403858

fbshipit-source-id: c930aa108d27c1bd1b36364530d2953bcd4664ad
2017-01-11 09:43:34 -08:00
Emil Sjolander 3f49e743be Add percentage support to react native
Summary:
Adds support for percentage value in react native.

syntax: property: 100 | property | '100%'

supported properties:
padding
margin
width
height
minWidth
minHeight
maxWidth
maxHeight
flexBasis

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{backgroundColor: 'white', padding: 10, paddingTop: 30, height: '100%'}}>
        <Text>
          If you want to quickly test out something,
          open the Playground.js file and start coding.
        </Text>
        <View style={{backgroundColor: 'red', height: 50, width: 50}}/>
        <View style={{backgroundColor: 'blue', height: '50%', width: '50%'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4376549

fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc
2017-01-11 03:58:37 -08:00