Commit Graph

10041 Commits

Author SHA1 Message Date
Aymen Mouelhi c4e73ddd92 Fix Issue with network errors
Summary:
When running the Movies Example, the application displays an error message: "Cannot read property 'total' of undefined".
<img width="374" alt="capture d ecran 2017-03-01 a 21 26 50" src="https://cloud.githubusercontent.com/assets/3247607/23479864/2871c52a-fec6-11e6-9266-8a5fe44adfe4.png">

This is due to the fact that the API call raised an error, and the catch block is followed by a then block, which means that the code in the second then bloc will be executed.

The fix is to move the catch at the last position, to prevent any further execution in case of network error.
Closes https://github.com/facebook/react-native/pull/12641

Differential Revision: D4657739

Pulled By: ericvicenti

fbshipit-source-id: bdc58d2b89a7d2a53de716773e7bc8a735fa2e45
2017-03-05 19:02:54 -08:00
Konrad Reiche 4d4028d8d6 Inherit WebSocket protocol scheme in case of http and https
Summary:
**Motivation**

Currently, when supplying a URL with protocol scheme `http` or `https` to the WebSocket module:

```
new WebSocket("http://10.0.2.2:8080")
```
it will result in the following error:

![Unable to get cookie from http://10.0.2.2:8080](https://cloud.githubusercontent.com/assets/661993/23584771/f3f9573e-011f-11e7-839e-eb100c8cb5d2.png)

When a WebSocket URL with protocol scheme `http` or `https` is used the method [`getDefaultOrigin`](be4afdde37/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java (L274-L301)) will fail to substitute it and just returns a URL with empty protocol scheme leading to this opaque exception.

Thus, in case of `http` or `https` it should just inherit the protocol scheme since the WebSocket is responsible for upgrading the HTTP/HTTPS connection to the WebSocket protocol.

**Test plan**

If anything this change makes the method more robust. The WebSock
Closes https://github.com/facebook/react-native/pull/12713

Differential Revision: D4657738

Pulled By: ericvicenti

fbshipit-source-id: 8835b539e94713355e063a2639b7293c764b084b
2017-03-05 18:37:58 -08:00
Alexey Kureev c97c1e5516 Fix symlink resolving for examples in the repo
Summary:
Motivation:
Few days ago gaearon [filed an issue](https://github.com/facebook/react-native/issues/12406) that examples in the react-native repo doesn't work after the [recent changes in local-cli](bce6ece5f6). This PR fixes reported bug.

**Test plan (required)**
- No UI changes
- [x] Run UIExplorer from XCode (no package.json in the folder) and check if packager/application runs correctly

cc davidaurelio satya164 grabbou
Closes https://github.com/facebook/react-native/pull/12435

Differential Revision: D4657370

Pulled By: ericvicenti

fbshipit-source-id: 72ee4b96cae37c7ed2794ed4490ce7b4fbbd66c3
2017-03-05 17:34:41 -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
Esa Juhana Lahikainen cdcd620480 Improve iOS' running on device instructions
Summary:
Add missing step needed to run your project on a device

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob
Closes https://github.com/facebook/react-native/pull/12718

Differential Revision: D4657289

Pulled By: ericvicenti

fbshipit-source-id: f73736027d3872c63046c8a46307e9b486b4d444
2017-03-05 11:46:46 -08:00
Janic Duplessis c708234f66 Native Animated - Support multiple events attached to the same prop
Summary:
Fixes a bug that happens when trying to use ScrollView with sticky headers and native `Animated.event` with `onScroll`. Made a few changes to the ListViewPaging UIExplorer example to repro https://gist.github.com/janicduplessis/17e2fcd99c6ea49ced2954d881011b09.

What happens is we need to be able to add multiple events to the same prop + viewTag pair. To do that I simple changed the data structure to `Map<prop+viewTag, List<AnimatedEventDriver>>` and try to optimize for the case where there is only one item in the list since it will be the case 99% of the time.

**Test plan**
Tested by reproducing the bug with the above gist and made sure it was fixed after applying this diff.
Closes https://github.com/facebook/react-native/pull/12697

Differential Revision: D4656347

Pulled By: sahrens

fbshipit-source-id: b5c36ba796f478e56028c7a95bc0f86bc54cb2ce
2017-03-05 10:16:57 -08:00
Jeff Morrison 59257d6976 fbobjc
Reviewed By: gabelevi

Differential Revision: D4652687

fbshipit-source-id: 6069c8bc24f0b88da3537ada877cdb7d1d4eccfd
2017-03-04 19:30:34 -08:00
David Adams e3ef69548c VirtualizedList - trigger this.props.onContentSizeChange
Summary:
Have tested this and works fine
```
<SectionList
    onLayout={this.onLayout}
    ref={thisRef => this.listView = thisRef}
    ListFooterComponent={this.renderFooter}
    renderItem={this._renderRow}
    onScroll={this._onScroll}
    onContentSizeChange={this.contentSizeChanged}
    renderSectionHeader={this._renderSectionHeader}
    sections={this.props.data}
/>
Closes https://github.com/facebook/react-native/pull/12708

Differential Revision: D4656338

Pulled By: sahrens

fbshipit-source-id: a2b585aa80247ff0dc2261b740003a6e77cb7a97
2017-03-04 19:15:19 -08:00
Jan Kassens 6378333b1d upgrade to babylon@6.16.1
Reviewed By: yungsters

Differential Revision: D4654335

fbshipit-source-id: 2913c3b4b04db140adc06b484ea2a64c673c6ad0
2017-03-04 17:30:02 -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
Sung Won Cho 7e2d7f0c98 Replace the outdated flag
Summary:
**Motivation**

Documentation was referring to an outdated command line flag for building a signed APK. https://github.com/facebook/react-native/issues/12698

**Test plan**

This PR does not contain any code changes.
Closes https://github.com/facebook/react-native/pull/12699

Differential Revision: D4655915

fbshipit-source-id: fdad86e0be60929525172022980f1950c8b0188d
2017-03-04 00:16:29 -08:00
Spencer Ahrens 500dd2cff3 Fix bug with sticky headers that listen to onLayout
Summary:
Wrapping them in ScrollViewStickyHeader broken the onLayout and would always give y = 0
because it is now relative to the wrapper.

This uses some not-so-great react magic, but fixes the bugs with no aparent side-effects.

Note we also need to kill the StaticRenderer wrapper that ListView introduces. I think this was
probably a premature optimization anyway since there are usually not many headers and they are
usually pretty cheap to render. If people care, they can use `shouldComponentUpdate` with the
rendered components.

Reviewed By: yungsters

Differential Revision: D4654622

fbshipit-source-id: 1ea557ef64327d1f4df53b22fedd678da1549288
2017-03-03 20:15:38 -08:00
Spencer Ahrens 94a333a2ea Fix crash with js-based sticky headers
Summary:
We're seeing ` inputRange must be monotonically increasing -1,0,0,-33,-32 ` which happens when we
have zero height headers, wherever those come from...maybe rendering null?

The math was also off and didn't handle variable height headers correctly, and it was confusing
because it was `setNextHeaderY` with the header y _minus it's height_, which only works
if the prev height was also the same height.

Reviewed By: furdei

Differential Revision: D4649404

fbshipit-source-id: c2c2d438fa0d0b979c2cbdfa5752eaf86c14768b
2017-03-03 20:01:13 -08:00
Spencer Ahrens f6aad8b995 Default sticky headers enabled on ios only.
Summary:
They aren't normal for android, so don't make that the default.

some more context: https://github.com/facebook/react-native/pull/11315#issuecomment-283816468

Reviewed By: furdei

Differential Revision: D4648714

fbshipit-source-id: 3232a6914e3db82c2b300409663ce63412d892a6
2017-03-03 15:29:48 -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
Spencer Ahrens 2022b1eee6 Improve docs
Reviewed By: hramos

Differential Revision: D4649351

fbshipit-source-id: 06cbd735bdb51b6d9d4997a348cbc191193485aa
2017-03-03 13:15:28 -08:00
Jack Stevens 8174a0dc08 Remove semi-colons after class definition
Summary:
None of the preceding code examples have semi-colons after the class definition (because they're not necessary):

- https://facebook.github.io/react-native/docs/tutorial.html
- https://facebook.github.io/react-native/docs/props.html
- https://facebook.github.io/react-native/docs/state.html
- https://facebook.github.io/react-native/docs/style.html

For consistency, I removed them 👍
Closes https://github.com/facebook/react-native/pull/12616

Differential Revision: D4651704

fbshipit-source-id: e59fa37c82d61728bc8ee28c7109717bd10635c2
2017-03-03 12:30:25 -08:00
Jean Lauliac 3e9dedf1ac packager: minimize terminal.log() work
Reviewed By: davidaurelio

Differential Revision: D4650441

fbshipit-source-id: 2de2c8e5bea29179fd04ef8db67ac385b3f0a06b
2017-03-03 11:14:53 -08:00
Lukas Wöhrl e596217d99 Added bool config to YGConfig to configure using web defaults
Summary:
Added bool config to YGConfig to configure using web defaults. See #445.
Closes https://github.com/facebook/yoga/pull/449

Reviewed By: astreet

Differential Revision: D4642272

Pulled By: emilsjolander

fbshipit-source-id: 4f35bd17b7f764f42295052a4a8b4ae46c192d7e
2017-03-03 11:01:00 -08:00
Lukas Wöhrl 495fb54058 Mark all children as dirty if display changes
Summary:
If we set ```display:none``` all children are set with layout sizes/values of 0. We need do mark all those children as dirty to force a relayout if we toggle the display on a higher parent node. This fixes #443
Closes https://github.com/facebook/yoga/pull/448

Reviewed By: astreet

Differential Revision: D4642273

Pulled By: emilsjolander

fbshipit-source-id: dfdb920e2049952bd6c7f48cfa53b1448e1f3e8f
2017-03-03 10:42:07 -08:00
Lukas Wöhrl a1406c4824 Explicitly set new experimental and a small other improvement
Summary:
This sets the new ```YGExperimentalFeatureMinFlexFix``` explicitly to false in the config.

It also a changes a stretch reason to reflect that it is the strech in a multiline.
Closes https://github.com/facebook/yoga/pull/447

Reviewed By: astreet

Differential Revision: D4642275

Pulled By: emilsjolander

fbshipit-source-id: 26777db7008ff6ee86da72ca9ea19e979b916cc9
2017-03-03 10:42:07 -08:00
Lukas Wöhrl 1b79e5557d Use floats to prevent double calculation + float casting on scale
Summary:
Use ```float``` for calculation, as we would calculate with ```double``` and cast to float afterwards otherwise. So this removes the warning.
Closes https://github.com/facebook/yoga/pull/450

Reviewed By: astreet

Differential Revision: D4642267

Pulled By: emilsjolander

fbshipit-source-id: 184ef24474f2b8a42654a71a8e98839296648b2b
2017-03-03 10:42:07 -08:00
Andy Street dfe09db990 Safely fix underline TextInput
Summary: Resubmit of https://github.com/facebook/react-native/pull/12493 factoring in the AOSP bug here: https://code.google.com/p/android/issues/detail?id=191754

Reviewed By: achen1

Differential Revision: D4627575

fbshipit-source-id: 8a984852db54be98bd6e781a4d00854d7d0dca68
2017-03-03 03:49:47 -08:00
Spencer Ahrens 32d753164d Fix OSS Website generation
Summary: flow existentials aren't supported yet.

Reviewed By: yungsters

Differential Revision: D4649184

fbshipit-source-id: c1294edd4bf15559d7a277816361af9bcca9ad48
2017-03-03 00:15:04 -08:00
Aaron Chiu d2050a35dd log onHostResume and onHostPause times
Reviewed By: alexeylang

Differential Revision: D4640631

fbshipit-source-id: fe55368b152c96ce631280143d59923aa2e628d3
2017-03-02 22:46:52 -08:00
Martin Konicek ee122be97e Android: Remove dependency on recyclerview
Summary:
Removing unused code. We used to have this dependency for the RecyclerViewBackedScrollView, which has been removed.

**Test plan (required)**

Tests pass on Circle CI.
Closes https://github.com/facebook/react-native/pull/12636

Differential Revision: D4646561

Pulled By: ericnakagawa

fbshipit-source-id: 285de78debec306078eb9ad34a2339f95bc42a9c
2017-03-02 16:16:49 -08:00
Aaron Chiu 9f68d95943 log native module initialization time
Reviewed By: alexeylang

Differential Revision: D4640369

fbshipit-source-id: 9d1ec353d9b8c4bccb5eedea1fc5d0f6cb414985
2017-03-02 16:01:52 -08:00
Aaron Chiu f9a3ed3793 in non-lazy mode, log instantiation time for each native module
Reviewed By: alexeylang

Differential Revision: D4640157

fbshipit-source-id: cfc1c3114ef97b8ba12839c3814a72b8ece869d6
2017-03-02 15:45:13 -08:00
Luke Miles 13b4c2d77b <WebView>: Add propType for injectJavaScript
Summary:
Small fix. Adds a proptype for the injectJavaScript function, added in da9a712a9e.
Closes https://github.com/facebook/react-native/pull/12665

Differential Revision: D4645803

Pulled By: hramos

fbshipit-source-id: 863e5bf82b853914ac08f9f5b2c141d35882afc7
2017-03-02 15:31:19 -08:00
Janic Duplessis 77b8c09727 Implement sticky headers in JS using Native Animated
Summary:
This re-implements sticky headers in JS to make it work on Android.

The only change that was needed was to expose a way to attach a an animated value to an event manually since we can't use the Animated wrapper and `Animated.event` to do it for us because this is implemented directly in the `ScrollView` component. Simply exposed `attachNativeEvent` that takes a ref, event name and event object mapping. This is what is used by `Animated.event`.

TODO:
- Need to check why momentum scrolling isn't triggering scroll events properly on Android.
- Remove native iOS implementation
- cleanup / fix flow

**Test plan**
Test the example list in UIExplorer, test the ListViewPaging example.
Closes https://github.com/facebook/react-native/pull/11315

Differential Revision: D4450278

Pulled By: sahrens

fbshipit-source-id: fec8da2cffce9807d74f8e518ebdefeb6a708667
2017-03-02 15:15:31 -08:00
Eric Vicenti da04a6b1f3 Remove NavigationExperimental examples
Summary: NavigationExperimental is deprecated, so we should avoid documenting it with examples

Reviewed By: lacker, hramos

Differential Revision: D4634484

fbshipit-source-id: 6c8b114d2a7b49c75ec548025384fa6ed75cb2d2
2017-03-02 13:17:35 -08:00
Eric Vicenti a0f49fcbd5 Add deprecation warning for NavigationExperimental
Summary: Starting in RN 0.43, lets start recommending people to move off of NavExperimental, now that a better navigation option is available, and hybrid options on the horizon.

Reviewed By: hramos

Differential Revision: D4634268

fbshipit-source-id: 2f37cc62f9729ae123d85f609a88f84516a5ae92
2017-03-02 11:00:46 -08:00
Jean Lauliac 0cb2bc104f packager: make DependencyGraph.processFileChange private
Reviewed By: davidaurelio

Differential Revision: D4635645

fbshipit-source-id: baf3ec75927dfa2d1b29d6548a13453370f434ba
2017-03-02 08:53:55 -08:00
Jean Lauliac 067496e5f6 packager: ResolutionRequest: use moduleMap instead of hasteMap
Reviewed By: cpojer

Differential Revision: D4605535

fbshipit-source-id: bc8394eb296f3fbeda5d8f0f3c17790db8691033
2017-03-02 08:53:55 -08:00
Jean Lauliac 5d37bfa605 packager: DependencyGraph-test: fix tests
Reviewed By: davidaurelio

Differential Revision: D4635348

fbshipit-source-id: 0130496e20d54f5ddf6546823b7a6cba3118917d
2017-03-02 08:53:55 -08:00
Ludo Fardel 0b348095b6 blurRadius for Image
Summary:
This adds blurRadius support for <Image>, similar to iOS.
The heavy-lifting was done by lambdapioneer in the stack of diffs ending with
D3924013, we're just patching this in.
Two notes: we might need to apply two postprocessors going forward, will tackle
that in a separate diff, so we can ship this asap.
However, we need a new version of fresco to be released in order
to ship this.

Reviewed By: lexs

Differential Revision: D3936438

fbshipit-source-id: 353bf1f1120ebd5f4f8266c5a20188b41478a741
2017-03-02 07:47:21 -08:00
Christoph Pojer 94901b1e1d Bring back polyfill test
Reviewed By: jeanlauliac

Differential Revision: D4642517

fbshipit-source-id: 0882f453eb91c9f12a9e507ccfa60873106d2d71
2017-03-02 05:29:59 -08:00
Matt Mahoney fea8745845 Add missing Immutable-List parameter
Reviewed By: kassens

Differential Revision: D4636523

fbshipit-source-id: 99bbf32005073ef534c8b7d42109d9a1a1c2f945
2017-03-01 23:01:01 -08:00
alejandro garcia dc334b0e55 Improved flow on Picker.Item
Summary:
Flow improvement: Added ColorPropType on color property on Picker component
Closes https://github.com/facebook/react-native/pull/12528

Differential Revision: D4619897

Pulled By: ericvicenti

fbshipit-source-id: 6356d6f4ae6d2db3d93a56882ec51d140f9ac2ab
2017-03-01 22:19:30 -08:00
mlanter f66fba83cf Set initial opacity based on style
Summary:
Set the initial opacity based on the style opacity instead of defaulting to 1.  Without this change, if the opacity on the view is set to 0.5 (for example), the component will render with 1 opacity and then after a press and release it will set to 0.5.  This fixes it to set to the correct value on mount.

**Test plan (required)**
Example code:
```
      <TouchableOpacity
        activeOpacity={1}
        style={STYLES.Button}>
        {...}
      </TouchableOpacity>
```
```
const STYLES = StyleSheet.create({
  Button: {
    opacity: 0.5,
  },
});
```

Before (notice starts out dark and then after click and release becomes light):
![before](https://cloud.githubusercontent.com/assets/19673711/23444255/c120cbb0-fde8-11e6-8c03-ef4f0f25736b.gif)

After (starts out light and is the same light color after a click and release):
![after](https://cloud.githubusercontent.com/assets/19673711/23444254/c106a6e0-fde8-11e6-8181-def45b7bb84f.gif)
Closes https://github.com/facebook/react-native/pull/12628

Differential Revision: D4641509

fbshipit-source-id: 3b6cf653fe837df704007f585c655d4450d14497
2017-03-01 21:46:40 -08:00
Spencer Ahrens d2ed064519 Add to docs
Reviewed By: hramos

Differential Revision: D4638645

fbshipit-source-id: 6a37a5fd4e0d8c7769f6c241142b949dba665c34
2017-03-01 21:15:03 -08:00
Scott Wolchok 906879ed9b BUCK file renaming round 2 (10/13)
Reviewed By: dinhviethoa

Differential Revision: D4641351

fbshipit-source-id: f965d3c55313258934d926f6333e2ba161263882
2017-03-01 21:15:03 -08:00
Hector Ramos cf4891c6bd Update Getting Started instructions.
Summary:
I am starting fresh on a new Mac and took another stab at the instructions.

- Java SDK 7 seems to work just fine.
- Adjusted Custom Android Studio installation instructions to use bare minimum required.
- Updated AVD configuration instructions with necessary changes to run AVD the first time.
- Added note on using real devices.
- Removed notes warning against use of API Level 23, these do not belong on a Getting Started guide.
- Added step to install Xcode Command Line Tools.
- Use `.profile` over `.bashrc` as the latter is shell-specific and is not loaded on login shells (e.g. new Terminal windows). `.profile` will work on bash, however, which is the default macOS shell.
- Added screenshots.

Went through steps for setting up RN for iOS as well as Android on a new Mac. Ended with apps running on the iOS Simulator and a AVD.

Generated website and verified instructions rendered correctly for each of the OS/device permutations.
Closes https://github.com/facebook/react-native/pull/12272

Differential Revision: D4637737

Pulled By: hramos

fbshipit-source-id: 5d322e4d55dbabc70f70471622a2f379ac6230cb
2017-03-01 19:26:28 -08:00
Ke Mao 8bfab2c733 Improve command-line experience for capturing mobile JS heap
Reviewed By: cwdick

Differential Revision: D4612319

fbshipit-source-id: 607a09286abdd83368996ffc553b3ce984b62f34
2017-03-01 19:26:28 -08:00
Spencer Ahrens a7a3922b89 Improve doc generation with flow types
Reviewed By: vjeux, hramos

Differential Revision: D4638610

fbshipit-source-id: 122d6fb68d521b675019a0698b6427960bb2d070
2017-03-01 18:46:32 -08:00
Spencer Ahrens e70cdf0cc1 add to RN OSS package.
Summary: Also fix some bugs with fbjs requires.

Reviewed By: mkonicek

Differential Revision: D4635805

fbshipit-source-id: b0663b727632fe5784f1caa1ff20b160a82a3931
2017-03-01 17:55:30 -08:00
Marc Horowitz 18eb7aea97 Fix the RN OSS gradle build
Reviewed By: ericvicenti

Differential Revision: D4636504

fbshipit-source-id: 89a776902d893c19dff81afcf1cba631c220c9c2
2017-03-01 13:47:31 -08:00
sunnylqm 48a84dffd5 android now supports barStyle
Summary: Closes https://github.com/facebook/react-native/pull/12488

Differential Revision: D4590699

fbshipit-source-id: 003da4b622e8732ab66c6f2c931670a2eae47eae
2017-03-01 13:32:16 -08:00
Hector Ramos 4ee7d9430c Move showcase source data into a JSON file
Summary:
The showcase is displayed in the homepage as well as in a standalone showcase page. The source data for these two pages is embedded in each page, resulting in repetition of data across both.

This PR splits out all of the showcase data to its own file, which is then loaded into the Metadata component during website generation.

`cd website && npm start`, then verified index and showcase loaded successfully
`cd website && node server/generate.js`, confirmed script runs successfully
Closes https://github.com/facebook/react-native/pull/12626

Differential Revision: D4632036

Pulled By: hramos

fbshipit-source-id: 2d1ad890e78e457205179e36c3ef04ffec354ad9
2017-03-01 13:32:15 -08:00
Eric Vicenti 08dbc43fa6 Deprecate NavigationExperimental
Summary:
Docs change to encourage people to use React Navigation over other options.

Explains a bit of history about Navigator and NavigationExperimental.

Remove an intro guide that encourages use of Navigator. Hopefully the existing ReactNav guide fills this void.

Navigator docs are less emphasized but still present.

Reviewed By: mkonicek

Differential Revision: D4634452

fbshipit-source-id: 26763c2f02530009b3dfd20b0590fadcb5ea35ee
2017-03-01 11:50:03 -08:00