Commit Graph

11070 Commits

Author SHA1 Message Date
Valentin Shergin ac3f345b07 Fixed assertion caused by invalid layout of hidden Yoga nodes
Summary:
That's interesting!
If we apply `display: none;` style to some node, Yoga will stop calculation layout for this subtree (which is reasonable).
So, from RN perspective we have to stop applying layout for hidden subtree because it is meaningless and causes another errors.

Note: We do actually not support `display: none;` yet. It stops computing layout, but it does not hide the views!

Reviewed By: javache

Differential Revision: D5168651

fbshipit-source-id: 29a9385c76a0f9d637285fc0d268ccc39879ca0a
2017-06-20 17:16:46 -07:00
Valentin Shergin abfa63c67e Introducing -[RCTShadowView canHaveSubviews]
Summary:
Override `canHaveSubviews` in RCTShadowView subclass to disallow any nested content.
For now, this prop will be checked only in DEV mode for performance reasons.

Reviewed By: javache

Differential Revision: D5189083

fbshipit-source-id: 87087dd806e1fd7320128dab969b13642174f81c
2017-06-20 17:16:46 -07:00
Valentin Shergin d0ad6ad413 Removed support of mysterious "deprecated" scale in RCTImageSource
Reviewed By: fkgozali

Differential Revision: D5197885

fbshipit-source-id: 06b7ee0ed71e07f1db1db053fbbd5f9834d56586
2017-06-20 17:16:43 -07:00
Yu Wang 01adc71ade add cmd+opt+ctrl+D to globally invoke dev menu for Android
Reviewed By: frantic

Differential Revision: D5280788

fbshipit-source-id: ce11d122ee17a2ba8d8aa2e91fc6639610791577
2017-06-20 17:01:46 -07:00
Janic Duplessis a2b0ee0fc3 FlatList - Add dev validation of the object returned by getItemLayout
Summary:
Returning an object that doesn't have all the required properties from `getItemLayout` doesn't cause a flow error (maybe because we are using `createAnimatedComponent`) and caused ALL items to be rendered which caused perf issues that were hard to debug (typo lenght -> length -_-). This adds a simple warning in DEV mode using checkPropTypes.

**Test plan**
Tested in RNTester by passing a bad `getItemLayout` function.
![image](https://cloud.githubusercontent.com/assets/2677334/26329030/5b32ba90-3f13-11e7-9190-08f05a5c0682.png)
Closes https://github.com/facebook/react-native/pull/14111

Differential Revision: D5283942

Pulled By: sahrens

fbshipit-source-id: 8909532dfddd8628b7fb3380c198f0dfa88f240a
2017-06-20 10:45:32 -07:00
Janic Duplessis 407ec0023f Disable subview clipping when sticky headers are enabled
Summary:
Subview clipping still causes issues on Android and would be pretty hard to fix properly, I investigated this a bit and sticky header views are getting removed because it doesn't take transform into consideration. It would also require to recalculate subview clipping on every transform change so I think it is better to just disable subview clipping in when there are sticky headers, especially since we seem to be moving away from subview clipping with things like FlatList.

**Test plan**
Tested that sticky headers work in ListView paging example.

Fixes #14000
Closes https://github.com/facebook/react-native/pull/14010

Differential Revision: D5283723

Pulled By: sahrens

fbshipit-source-id: 183b3202765ae09aaae05497694c3f514e969ea1
2017-06-20 09:34:55 -07:00
Rene Weber 75508c12ff Add setNativeProps
Summary:
Curently FlatList does not implement setting native props directly like the old ListView did. This pr introduce the `setNativeProps` function which delegates to MetroListView or VirtualizedList. Thos don't have `setNativeProps` handling either, so, I delegated further to the respective ListView and Scroll components, which do have handling for it, thus, allowing to set the native props through FlatList.

Create a project with a FlatList and change a native property using `setNativeProps`:

```javascript
  componentDidMount() {
        setInterval(() => {
            this.list.setNativeProps({ style: {backgroundColor:"white"} })
        }, 1000)
    }

  render() {
    return (
      <View style={styles.container}>
        <FlatList ref={component => this.list = component}
                  style={{backgroundColor:"black"}}
                  data={[{key: 'a'}, {key: 'b'}]}
                  renderItem={({item}) => <Text>{item.key}</Text>} />
      </View>
    )
  }
```

Fixes #13501
Closes https://github.com/facebook/react-native/pull/13529

Differential Revision: D5283593

Pulled By: sahrens

fbshipit-source-id: 8f96f88e286042d82452fef924689b5a8a783987
2017-06-20 09:34:55 -07:00
Guy Blank 60783aa6ba Expose content-available APS key for iOS silent push
Summary:
<details>
  Thanks for submitting a PR! Please read these instructions carefully:

  - [ ] Explain the **motivation** for making this change.
  - [ ] Provide a **test plan** demonstrating that the code is solid.
  - [ ] Match the **code formatting** of the rest of the codebase.
  - [ ] Target the `master` branch, NOT a "stable" branch.

  Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>

_What existing problem does the pull request solve?
In iOS when sending a silent push notification you need to configure the 'content-available' APS key to the value of 1 (When this key is present, the system wakes up your app in the background and delivers the notification to its app delegate, see [apple docs](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1)).

This PR exposes this property to the notification event handler so app code can handle silent push scenario specifically. Currently this property is not available.

I've updated the PushNotificationIOSExample in the RNTester.

1. Open RNTester in xcode
2. Enable the  push notifications capability
3. run on device
4. Go to PushNotificationIOS
5. click on "send fake notification"
6. verify alert message contains 'content-available' with a value of 1.
Closes https://github.com/facebook/react-native/pull/14584

Differential Revision: D5279181

Pulled By: shergin

fbshipit-source-id: d2288e147d89ba267f54265d819aa0a9969095e7
2017-06-19 16:46:31 -07:00
Mike Lambert ebcf5fd241 Fix initial-render triggering a render of all items.
Summary:
When rendering a large list without a getItemLayout (ie SectionList, where it's hard to compute), it freaks out and attempt to render them all, starving the rendering/layout engine from computing the size (and more accurately figurnge out how few it actually should render.)

Before this change, with <FlatList maxToRenderPerBatch={5} data={objectOfLengthN} />, I essentially saw it doing:
```
{first: 0, last: 0}
{first: 0, last: 5}
{first: 0, last: 10}
....
{first: 0, last: N}
```
(no more hiPri renders since all elements have been rendered)
(actually renders and lays out all N objects, and computes their sizes)
(realizes that it doesn't need to show all N for my current screen size and row size)
```{first: 0, last: 55}```

After this change, that whole first part where it keeps incrementing `last` to try to "keep up with the scrolling" disappears.
Closes https://github.com/facebook/react-native/pull/14563

Differential Revision: D5278796

Pulled By: sahrens

fbshipit-source-id: 5db117b40909ec4bc92fba9b5556c6a2add046ac
2017-06-19 16:04:44 -07:00
Andrew Y. Chen 3c4057cbb4 Revert D5172643: [ReactImageView] Remove useless code from ReactImageView.RoundedCornerPostprocessor
Differential Revision: D5172643

fbshipit-source-id: d8d27586d81479c950fe3dd49b24ad5ee29861fc
2017-06-19 14:46:49 -07:00
Tim Yung a26d87628c RN: Improve Audio for Maintaining Priority
Summary:
The React Native Remote Debugger page (`debugger.html`) contains an embedded silent sound file to maintain tab priority in Google Chrome.

This revision simply replaces the existing one with a better one that has the following characteristics:

- 1s Duration
- 10Hz Frequency
- -48dBFS Amplitude
- Fades in/out to reduce audible clicks on loop.
- 44.1kHz @ 16bit to maximimize compatibility.
- Smaller size.

Much thanks to Stephane Pigeon (http://stephanepigeon.com/) for designing the sound file specifically for this use case.

Reviewed By: mmmulani

Differential Revision: D5273591

fbshipit-source-id: 81668cc0a829e008263907fc1fa7150b72691371
2017-06-19 13:30:51 -07:00
Andrew Y. Chen e82ceb24eb Fix dev loading indicator
Reviewed By: AaaChiuuu

Differential Revision: D5277176

fbshipit-source-id: 04a8af068310490957e8bc1e690e2cdb927e4dff
2017-06-19 13:16:19 -07:00
Tino 3ba8e6a901 Keyboard will show documentation
Summary:
Clarified documentation for keyboardWillShow on Android as seen in issue #14275

Clarifies documentation of keyboardWillShow

None as it is just a comment that changed.
Closes https://github.com/facebook/react-native/pull/14350

Differential Revision: D5275173

Pulled By: shergin

fbshipit-source-id: d4fb08de71e6be40bb363dfc82d38b191570c476
2017-06-19 11:06:33 -07:00
Hector Ramos 8aabce3f1c Clean up the help page
Summary: Closes https://github.com/facebook/react-native/pull/14569

Differential Revision: D5275055

Pulled By: hramos

fbshipit-source-id: 1393da637a970e89fba40ea694641e4c26dfa3d9
2017-06-19 10:30:33 -07:00
Pieter De Baets 3e4a8928b3 Fix reference to invariant
Reviewed By: davidaurelio, bvaughn

Differential Revision: D5274530

fbshipit-source-id: 0b75976bb91b530a371521d5381a3d53f0ad2640
2017-06-19 08:46:32 -07:00
Aleksei Androsov 8377b30b8d ImageBackground: use cached styles
Summary:
Replace object with cached styles from StyleSheet

Create new style object may cause performance problems

Check that ImageBackground position works the same way.
Closes https://github.com/facebook/react-native/pull/14486

Differential Revision: D5274503

Pulled By: shergin

fbshipit-source-id: 09b81e6f7ae2ada7f68854e409909caafd85e56a
2017-06-19 08:46:32 -07:00
David Aurelio 86328e9266 Upgrade `babel-transform-react-native` to `v2.0.0`
Summary: Upgrades `babel-transform-react-native` to v2.0.0, which exposes a factory function. That way, the preset will include/exclude dev tools according to `process.env.NODE_ENV` even when that value changes over time.

Reviewed By: cpojer

Differential Revision: D5246801

fbshipit-source-id: 74a1e7e0fb1476750e1fe21ce4befd475907b415
2017-06-19 08:22:23 -07:00
Andrew Y. Chen 56969d51fa Don't crash if Window permission isn't granted for dev loading view
Reviewed By: AaaChiuuu

Differential Revision: D5263844

fbshipit-source-id: bf10375ddc43158ce77e09682605068e28f690ef
2017-06-19 08:22:23 -07:00
Joe Rickerby fa147f02e5 Update overflow docstring to add note on Android
Summary:
The overflow: visible option does not work on Android. This just add a little note to the docs of that property to make that clear.

See #3198  and https://react-native.canny.io/feature-requests/p/add-overflow-support-to-android .

Make it clear that this property is unavailable on Android. We had to figure this out by trial and error when porting an existing codebase, a small note in the docs would be helpful!

I could not find how to build the website - I tried `cd website && npm install && node ./server/generate.js` but I'm getting an error (*JSDOC_ERROR: There are no input files to process.*). But it is such a small change I can't see how it would break the docs build!
Closes https://github.com/facebook/react-native/pull/14103

Differential Revision: D5225814

Pulled By: shergin

fbshipit-source-id: a3136e791178d2a7090f324041be23628130199e
2017-06-18 19:45:27 -07:00
Tim Yung ce5ae53669 RN: Replace Workaround w/ Upgraded `mock-fs`
Reviewed By: cpojer

Differential Revision: D5271612

fbshipit-source-id: 1579f34d4c4e64706f2f128e848b5f6d3d838097
2017-06-18 01:01:59 -07:00
Tim Yung 398746fa09 RN: Remove lodash (Attempt 2)
Reviewed By: cpojer

Differential Revision: D5268874

fbshipit-source-id: 795bc3fda6c29e514b6149f0bdf4f4aa3f131a6d
2017-06-16 18:15:17 -07:00
Taylor Kline fd34018d08 Use possessive 'its' not 'it's'
Summary:
Very simple documentation grammar update.
Closes https://github.com/facebook/react-native/pull/14567

Differential Revision: D5269433

Pulled By: hramos

fbshipit-source-id: 2cf38166f53d01fa2465da2b25a3247312dabfb7
2017-06-16 17:00:35 -07:00
Naman Goel 0801d94faa Revert D5255886: [JS] Stop using lodash in RN
Differential Revision: D5255886

fbshipit-source-id: 605dd413a579be5321006ffb26ce9e04843bc0f8
2017-06-16 12:17:00 -07:00
Lukas Wöhrl 3b93ba9af7 The total flex factores need to be a minimum of 1 if any
Summary:
The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about:

> For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction.

But at least it seems a required change.

Fixes facebook/yoga#566
Closes https://github.com/facebook/yoga/pull/572

Differential Revision: D5264388

Pulled By: emilsjolander

fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
2017-06-16 07:46:28 -07:00
Christoph Pojer 8fa55ca7b5 Stop using lodash in RN
Reviewed By: yungsters

Differential Revision: D5255886

fbshipit-source-id: 18845785c3192f0ae1d02da0b944bc1b3c2fba52
2017-06-16 04:48:02 -07:00
Christoph Pojer 5d515113e7 Don't require prettyFormat in every single bundle.
Summary:
WTF

(I updated it to the latest version too)

Reviewed By: yungsters

Differential Revision: D5256525

fbshipit-source-id: f3c7d620faf817a0e3c1e4c2bed9370318dff40a
2017-06-16 04:31:56 -07:00
Jonathan Ballerano eaac3b57ee Add a type cast to RCT_ENUM_CONVERTER for C++ compatibility
Summary:
C++ doesn't provide an implicit cast to an enum value from the enum's backing type. When a `.mm` file calls `RCT_ENUM_CONVERTER`, we end up with the following compiler error:
> Error: cannot initialize return object of type `<TypeName>` with an rvalue of type `NSInteger`

Since `RCT_ENUM_CONVERTER` is a macro, this error will appear whenever we try to expand the macro in a C++ context.

The project compiles and runs as expected when this additional cast is added 😃
Closes https://github.com/facebook/react-native/pull/14408

Reviewed By: javache

Differential Revision: D5215584

Pulled By: jballer

fbshipit-source-id: 7f4464afd7cd9dc9a014f646278bae20731f08ba
2017-06-15 19:07:21 -07:00
Marc Horowitz a555551aaf Add some debug logging if tar fails
Summary: This is to help debug the root cause of https://github.com/facebook/react-native/issues/14423

Reviewed By: javache

Differential Revision: D5254713

fbshipit-source-id: 1ca90205144b3a069d927ba6636f0ef0138b51a0
2017-06-15 13:05:05 -07:00
Marc Horowitz 4fd427e249 Remove unused folly/File.{h,cpp} from OSS React Xcode project
Summary: This fixes https://github.com/facebook/react-native/issues/14328

Reviewed By: javache

Differential Revision: D5254711

fbshipit-source-id: e9b81e537cca9d6648f44ed61acd127015d2e1f8
2017-06-15 13:05:05 -07:00
Marc Horowitz f3f44eee59 Work around the broken way CocoaPods/Xcode deals with header maps
Summary:
See https://github.com/facebook/react-native/issues/14326 for the bug
this fixes.  This is a pretty ugly hack to work around what I think is
a CP bug.  Since the C++ dependencies are only needed to build RN
itself, and not applications, don't the conflicting headers as source
files.  Instead, use preserve_paths to get them unpacked into the
source tree under Pods/<Pod>, and arrange for them to get used with
HEADER_SEARCH_PATHS.  This keeps them out of the project, so they
don't get included in the header map, and other (badly structured)
projects don't get confused.

Reviewed By: javache

Differential Revision: D5254716

fbshipit-source-id: cf33dcbcc71b5247843650c33ccf4fb08378e584
2017-06-15 13:05:04 -07:00
Alex Dvornikov c143313a20 Make RCTSamplingProfilerPackagerMethod not depend on RCTBridge
Reviewed By: javache

Differential Revision: D5245899

fbshipit-source-id: a99de4cbf0ddd9c8ee98cbbf438f8930a57e917c
2017-06-15 12:07:34 -07:00
Alex Dvornikov d27ff20588 Make RCTPackagerConnection not depend on RCTBridge
Reviewed By: javache

Differential Revision: D5245497

fbshipit-source-id: 3c41dca98fc39c77d4b3c8932ee2a5b84880cf8c
2017-06-15 12:07:34 -07:00
Alexander Zubko 390c8cf96e Add a section about Platform.Version on iOS
Summary:
The docs don't have a section about `Platform.Version` on iOS, but it's available.

Very simple change. I've used the section for Android as an example.
Closes https://github.com/facebook/react-native/pull/14437

Differential Revision: D5250499

Pulled By: hramos

fbshipit-source-id: 29d1323e443fc1c5710283515c4233a192d354a0
2017-06-15 09:21:18 -07:00
Pascal Hartig 2cc1195035 Fix license headers
Reviewed By: IanChilds

Differential Revision: D5255424

fbshipit-source-id: 23439ac035f74f2fd1c756b8185e39199e748e33
2017-06-15 07:45:46 -07:00
Ethan Lillie 2083516f45 Correct its/it's homophone in NativeModulesIOS.md
Summary: Closes https://github.com/facebook/react-native/pull/14522

Differential Revision: D5254055

Pulled By: javache

fbshipit-source-id: aa764fc15baaeb349573b443ec24bbdea1255de9
2017-06-15 03:30:33 -07:00
Aaron Chiu e48ad9609c tag INITIALIZE_MODULE marker with the non-zero instance key
Reviewed By: javache

Differential Revision: D5255044

fbshipit-source-id: 9bd72970488cfba4271562e83416f6515b9e77b3
2017-06-15 02:50:37 -07:00
Pieter De Baets 559805d0b0 Remove SetBuilder
Reviewed By: AaaChiuuu

Differential Revision: D5237184

fbshipit-source-id: dde09febd0d4a5a42a62c7c6fbda3e6713d26152
2017-06-14 16:48:26 -07:00
Aaron Chiu 7464d5e1a2 use .contains
Reviewed By: achen1

Differential Revision: D5242469

fbshipit-source-id: d666b1264e6e40bb2649ab91bc63ecb6decb1532
2017-06-14 16:31:10 -07:00
Avik Chaudhuri 71401c1185 update xplat/js to flow 0.48.0
Reviewed By: zertosh

Differential Revision: D5243415

fbshipit-source-id: 78ea4f7f29bcd6a70650f24ceb05f06b18b39018
2017-06-14 15:47:21 -07:00
Hector Ramos 0d3b7fe472 Update guidelines.
Summary:
Consolidate tips on CONTRIBUTING.md, and reduce the wall of text when opening a new issue. Hoping this will encourage more people to read through the text.
Closes https://github.com/facebook/react-native/pull/14518

Differential Revision: D5250443

Pulled By: hramos

fbshipit-source-id: 91213c4ceca12225d9f54d1e1e81e020c6e463b3
2017-06-14 15:16:59 -07:00
Viacheslav Radchenko 879edf0d05 Added RCTInspectorDevServerHelper call in FBReactJSExecutor. Added UTF8StringForSourceURL
Reviewed By: javache

Differential Revision: D5246399

fbshipit-source-id: 179ff0b69886c4ff71911fc7b1d3491ff4d5967d
2017-06-14 14:10:10 -07:00
Miguel Jiménez Esún c9a39b3bd3 Move jest to version 20
Reviewed By: cpojer

Differential Revision: D5235642

fbshipit-source-id: eaeee1c5f67cf295fdc9798fb13bd5a83706af10
2017-06-14 12:48:22 -07:00
Pieter De Baets 9250250364 Call Systrace.setEnabled from CxxBridge
Reviewed By: alexeylang

Differential Revision: D5247016

fbshipit-source-id: 7e31e38d7adae8d432a11199a1de572d082169e3
2017-06-14 11:16:05 -07:00
James Burnett 383915caeb use default jest automock config setting
Reviewed By: cpojer

Differential Revision: D5246071

fbshipit-source-id: aec9078a5187621745507c4411c40aa993d9d94f
2017-06-14 10:07:58 -07:00
David Aurelio bc22a4da7e Make preset a function to account for different dev settings
Summary: Makes `babel-preset-react-native` a factory function that allows to include/exclude dev tool transforms per transform.

Reviewed By: jeanlauliac

Differential Revision: D5237158

fbshipit-source-id: aa7be0fc0f471575b4ee1c5a0e266e2ed2477fc6
2017-06-14 09:32:37 -07:00
David Aurelio 5c57601769 Remove `retainLines` and `sourceMaps` options
Summary:
`retainLines` is no longer necessary with the much improved source map generation.
`sourceMaps` is handled by the transformer itself.

Reviewed By: cpojer

Differential Revision: D5237103

fbshipit-source-id: e5c6bf5aa9d553fce9c3f4d59b3ea0057d45cfdc
2017-06-14 09:32:37 -07:00
Pieter De Baets 534bbfac8f Report Java stack from errors from sync native module calls
Reviewed By: mhorowitz

Differential Revision: D5069794

fbshipit-source-id: ede314034a2eb6b063a22dbd6e5d13c8ad66e20c
2017-06-14 09:32:37 -07:00
Pieter De Baets d67628eb5a Revert D5245159: [react-native][PR] Fix broken link in /docs/MoreResources.md
Differential Revision: D5245159

fbshipit-source-id: 3f4f28242512634abae08ebd8e815dfc504b9826
2017-06-14 07:36:18 -07:00
Pieter De Baets c25f356675 Avoid crash when accessing jsContextRef without an executor
Reviewed By: adamjernst

Differential Revision: D5237039

fbshipit-source-id: 6a86da90605b896093e0ef99b0fcf079bf9854bf
2017-06-14 05:32:27 -07:00
Pieter De Baets ce6fb337a1 Breaking - remove unused registration of JS modules
Summary: It's now unnecessary to declare which JS modules you want to expose on your package. To upgrade, remove all overrides of `createJSModules` and keeping calling your JS modules as before.

Reviewed By: AaaChiuuu

Differential Revision: D5229259

fbshipit-source-id: 1160826c951433722f1fe0421c1200883ba1a348
2017-06-14 03:52:17 -07:00