Commit Graph

12066 Commits

Author SHA1 Message Date
Peter Ruibal d501713bad Fix npm start in website/
Summary: We can't use spread syntax here.  Prefer Array.concat().

Reviewed By: sahrens

Differential Revision: D6014142

fbshipit-source-id: d2759893ea2df69975843ae821fb08b16b1d5d7c
2017-10-10 01:32:39 -07:00
Masayuki Iwai a541d58bc4 Fix that section headers in SectionList don't stick at correct position.
Summary:
I noticed that section headers in SectionList don't stick at correct position in case of using with contentInset and contentOffset. (See the demo below. It looks that contentInset.top is ignored.)
This is a common case of use of NavigationBar and TableView on iOS.

![](https://user-images.githubusercontent.com/143255/29018708-1e2f98aa-7b97-11e7-9599-19dbb832266d.gif)

Here is a demo and an example code:

![](https://user-images.githubusercontent.com/143255/29018753-4201f660-7b97-11e7-9d31-28413d1b6269.gif)

```jsx
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  SectionList,
} from 'react-native';

export default class RNScrollExample extends Component {
  renderSectionHeader(title) {
    return (
      <View style={styles.sectionHeader}>
        <Text>{title}</Text>
      </View>
    )
  }

  renderItem(content) {
    return (
      <View style={styles.cell}>
        <Text>{`Item ${content}`}</Text>
      </View>
    )
  }

  renderSeparator() {
    return <View style={styles.separator} />
  }

  renderSectionList() {
    const sections = Array.from(Array(10), (e, i) => ({ title: `Section ${i+1}`, data: Array.from(Array(10)).map((e, i) => i+1) }))
    const navigationBarHeight = 64
    return (
      <SectionList
        contentInset={{ top: navigationBarHeight }}
        contentOffset={{ y: -navigationBarHeight }}
        sections={sections}
        keyExtractor={(item, index) => index}
        renderSectionHeader={({ section }) => this.renderSectionHeader(section.title)}
        renderItem={({ item }) => this.renderItem(item)}
        ItemSeparatorComponent={this.renderSeparator}
      />
    )
  }

  renderHeader() {
    return (
      <View style={styles.header}>
        <Text style={styles.headerText}>Contents</Text>
      </View>
    )
  }

  render() {
    return (
      <View>
        {this.renderSectionList()}
        {this.renderHeader()}
      </View>
    )
  }
}

const styles = StyleSheet.create({
  header: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    height: 64,
    paddingTop: 20,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#ffffffcc',
  },
  headerText: {
    fontSize: 16,
    fontWeight: 'bold',
  },
  sectionHeader: {
    paddingHorizontal: 8,
    paddingVertical: 4,
    backgroundColor: '#05bbd3',
  },
  cell: {
    paddingHorizontal: 8,
    paddingVertical: 16,
    backgroundColor: '#82dde9',
  },
  separator: {
    height: 1,
    backgroundColor: '#7d888d',
  },
});

AppRegistry.registerComponent('RNScrollExample', () => RNScrollExample);
```
Closes https://github.com/facebook/react-native/pull/15395

Differential Revision: D5988720

Pulled By: shergin

fbshipit-source-id: d33f6ee943d4f913970e26c322b66b3c9c948a02
2017-10-09 22:45:48 -07:00
Nivetha Singara Vadivelu 9424cd7e8f Handling exceptions in video player
Reviewed By: furdei

Differential Revision: D5958119

fbshipit-source-id: 79b431a8422d60134890d44e99c358a07a5adc5b
2017-10-09 22:45:48 -07:00
Sai Teja Jammalamadaka 4e5d50d6ad Issue #16159 - RCTImageStoreManager's priority
Summary:
RCTImageStoreManager and RCTBlobManager have the same priority, hence in certain cases, both are able to handle the request, but this causes non-deterministic behavior. Hence increased ImageStoreManager's Priority to 1 and thereby increasing RCTImageLoader's Priority to 2 to prevent similar issue of same priorities.

Issue: #16159
Closes https://github.com/facebook/react-native/pull/16160

Differential Revision: D6017931

Pulled By: shergin

fbshipit-source-id: 91f2737af4f2f97197734b696105e1cdc5683365
2017-10-09 22:31:25 -07:00
Gustavo Gard dbe6044074 Correct propTypes for placeholder
Summary:
Proptype mistake, placeholder is a "string" not a "node".

1e8f3b1102/Libraries/Text/RCTBackedTextInputViewProtocol.h (L18)

4d54b48167/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java (L300)
Closes https://github.com/facebook/react-native/pull/16237

Differential Revision: D6017909

Pulled By: shergin

fbshipit-source-id: 75046080a0f33196832f5d4ab58f8b1f4aabad1f
2017-10-09 22:31:24 -07:00
Janis Peisenieks 7a7bdeec3e Omit all line terminators for ImageStore.getBase64ForTag
Summary:
FIX #11142

This fixes #11142 and supersedes #11155 as I was unsure how to add/change commits in that PR.

Wrote up a bunch of unit tests for the ImageStore module. The added tests showed that there was indeed a problem with the flags used for the Base64OutputStream, and they also show that that has been fixed now.
Closes https://github.com/facebook/react-native/pull/13856

Differential Revision: D6017764

Pulled By: shergin

fbshipit-source-id: adf667dc722ddfe31449afd8cd20a0a192eacff6
2017-10-09 22:16:20 -07:00
linh-le 7c89cf37c6 Change attribute mentioned in alignItem
Summary:
Since alignItem works on the secondary axis, in the example, the value heigth: 50 should be deleted so that alignItem: 'stretch' can work. Not width: 50. In fact, width needs to be there, or else no component will be shown at all.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

I'm going through the docs, that's why I found this. It's already tested!

Apologize if I'm contributing the wrong way. I read the instructions, but this is my first time ever, and will try to do it again correctly if needed.
Closes https://github.com/facebook/react-native/pull/16109

Differential Revision: D6017969

Pulled By: shergin

fbshipit-source-id: af37b831f1bb6206dabdaff36d4cb9e88fb1a496
2017-10-09 22:02:09 -07:00
Gustavo Gard 57b4f49db0 Remove broken links
Summary:
Issue https://github.com/facebook/react-native/issues/16255

Remove broken links
Closes https://github.com/facebook/react-native/pull/16262

Differential Revision: D6017751

Pulled By: hramos

fbshipit-source-id: a9465a8a8212dc7b5e1aae21c73b46e60e24c10e
2017-10-09 22:02:09 -07:00
Jimmy Mayoukou 4eccb16935 Add finally method to Promise flow definition
Summary:
The `finally` method definition was missing, while it really exists causing a flow error when using it.

Added the method definition and make sure flow doesn't throw any error anymore on a real-life example.
Closes https://github.com/facebook/react-native/pull/16115

Differential Revision: D6017950

Pulled By: shergin

fbshipit-source-id: 296f3467152eb6eedac817a89cf075e9f906a389
2017-10-09 22:02:09 -07:00
Steffen Forkmann b9da155fd8 Document adb shell input keyevent 82
Summary:
This information could be found already in older docs see https://facebook.github.io/react-native/releases/0.21/docs/running-on-device-android.html#accessing-development-server-from-device. It is missing from latest.

I think it's important alternative since shaking my device all the time borked my USB port
Closes https://github.com/facebook/react-native/pull/16241

Differential Revision: D6017905

Pulled By: shergin

fbshipit-source-id: 9426b4068a6bc60aed50f85b2f596d0494def52a
2017-10-09 22:02:09 -07:00
Julien Moutte bbceb48dbb Direct assignment of the ref to avoid warning when mocking.
Summary:
When Jest is mocking native components that are assigned a ref with an arrow function, a warning is generated about stateless components which can not have a ref. This does not happen when the ref is assigned directly.

Fixes #16045.
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

The test provided in the related issue is used to validate the fix. I don't know how to detect console warnings in a Jest test.
Closes https://github.com/facebook/react-native/pull/16046

Differential Revision: D6017903

Pulled By: ericnakagawa

fbshipit-source-id: a7ed61c39f141a4094f08fc875289a7a79ebe9e8
2017-10-09 21:46:20 -07:00
esbenvb 3eced7faba Updated swift section to match current code base
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Current documentation was outdated.

Follow the swift section with a recent version of RN and see that it works?
Closes https://github.com/facebook/react-native/pull/16260

Differential Revision: D6017759

Pulled By: hramos

fbshipit-source-id: 5d3ea56b08427694016c39b7ace5b2d5c63c1f4c
2017-10-09 21:01:31 -07:00
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
Valentin Shergin 32e5c8e5b5 Deprecated stuff was removed from RCTShadowView
Summary: It was deprecated awhile ago.

Reviewed By: javache

Differential Revision: D5990504

fbshipit-source-id: a218410d17f5f450d573338522b689e035106aba
2017-10-09 17:22:35 -07:00
Valentin Shergin 4342879c92 Deprecated stuff was removed from RCTUIManager
Summary: It was deprecated awhile ago.

Reviewed By: javache

Differential Revision: D5990505

fbshipit-source-id: 68deefb76fee31a49bfe832e281dc8ee11061cb8
2017-10-09 17:22:35 -07:00
Valentin Shergin c0e9936d8e Opensourcing RCTWrapper
Summary:
RCTWrapper is a library that allows turn any UIView/UIViewController-based widget into React Native component
which will respect layout constrains of native (wrapped) view.
So, you don't need to explicitly specify width and hight in styling.

Take a look at examples to see how to use RCTWrapper.

Reviewed By: mmmulani

Differential Revision: D5868763

fbshipit-source-id: 0a503b42be166d547ca6cbf0829eea9c75a8e364
2017-10-09 17:22:35 -07:00
Valentin Shergin aa97c9ac27 Updated project file to fix Apple TV build
Reviewed By: rsnara

Differential Revision: D6015068

fbshipit-source-id: 3c2cd902457e32dab843764267a1475a078eb64d
2017-10-09 16:31:46 -07:00
Valentin Shergin b0c1bd284f `[RCTShadowView localData]` is now only setter.
Summary: It saves 8 bytes per shadowView instance, and it is more logical because it does nothing by default.

Reviewed By: javache

Differential Revision: D5997804

fbshipit-source-id: c985a11aeea881e95911469e10c8c27429a2718a
2017-10-09 10:46:08 -07:00
Valentin Shergin 9e220da397 Using `StyleSheet.hairlineWidth` in TextInputExample
Summary:
This is workaround for blury and thick borders on iOS when specified border size does not multiplier of pixel size.
Original problem is probably related to CALayer border drawing specifics; documented as T22099662 and
https://github.com/facebook/react-native/issues/14106

Before:
https://pxl.cl/9cJ7

After:
https://pxl.cl/9cJ4

Reviewed By: javache

Differential Revision: D5999752

fbshipit-source-id: ad6d1078c6ebf7c8e0a3bc3c150525480a5a7a5c
2017-10-09 09:42:00 -07:00
Valentin Shergin bf3698323d RCTTextInput: Fixed problem with accessory view & 3rd party libs
Summary:
Now RCTTextInput relies on ivar to detect should it reconstruct inputAccessoryView or not.
Previously we checked `inputAccessoryView` directly which breaks some 3rd party libs.

See https://github.com/facebook/react-native/issues/16071 for more details.
cc douglasjunior

Reviewed By: javache

Differential Revision: D5994798

fbshipit-source-id: c086efdd24f5528393a4c734ff7c984e0ed740d1
2017-10-08 21:48:14 -07:00
Valentin Shergin 5e25c0e32f Introducing PseudoUIManagerQueue
Summary:
Queues Problem Intro:
UIManager queue is special queue because it has special relationship with
the Main queue.

This particular relationship comes from two key factors:
 1. UIManager initiates execution of many blocks on the Main queue;
 2. In some cases, we want to initiate (and wait for) some UIManager's work *synchronously* from
    the Main queue.

So, how can we meet these criteria?
"Pseudo UIManager queue" comes to rescue!

"Pseudo UIManager queue" means safe execution of typical UIManager's work
on the Main queue while the UIManager queue is explicitly blocked for preventing
simultaneous/concurrent memory access.

So, how can we technically do this?
 1. `RCTAssertUIManagerQueue` is okay with execution on both actual UIManager and
    Pseudo UIManager queues.
 2. Both `RCTExecuteOnUIManagerQueue` and `RCTUnsafeExecuteOnUIManagerQueueSync`
    execute given block *synchronously* if they were called on actual UIManager
    or Pseudo UIManager queues.
 3. `RCTExecuteOnMainQueue` executes given block *synchronously* if we already on
    the Main queue.
 4. `RCTUnsafeExecuteOnUIManagerQueueSync` is smart enough to do the trick:
    It detects calling on the Main queue and in this case, instead of doing
    trivial *synchronous* dispatch, it does:
      - Block the Main queue;
      - Dispatch the special block on UIManager queue to block the queue and
        concurrent memory access;
      - Execute the given block on the Main queue;
      - Unblock the UIManager queue.

Imagine the analogy: We have two queues: the Main one and UIManager one.
And these queues are two lanes of railway go in parallel. Then,
at some point, we merge UIManager lane with the Main lane, and all cars use
the unified the Main lane.
And then we split lanes again.

This solution assumes that the code running on UIManager queue will never
*explicitly* block the Main queue via calling `RCTUnsafeExecuteOnMainQueueSync`.
Otherwise, it can cause a deadlock.

Reviewed By: mmmulani

Differential Revision: D5935464

fbshipit-source-id: 6a60ff236280d825b4e2b101f06222266097b97f
2017-10-08 21:40:19 -07:00
Yann Pringault 1c24440644 Add TimePicker modes
Summary:
In the spirit of #10932, I added the `mode` option to the `TimePicker` Android API.
There is only one mode available for **Android < 5**, the `spinner` one.
If we are on **Android >= 5** we can choose between `spinner` or `clock`. If we specify `default` it will use the default of the current Android version.

On **Android < 5**, whatever we choose it will be this:
![screen shot 2017-02-14 at 17 05 44](https://cloud.githubusercontent.com/assets/5436545/22937805/024ec67e-f2da-11e6-8b32-a680d9bc2247.png)

On **Android >= 5**, with the `spinner` mode:
![screen shot 2017-02-14 at 16 51 17](https://cloud.githubusercontent.com/assets/5436545/22937803/024e0bbc-f2da-11e6-9f4b-26102ff2eeac.png)

And with the `clock` mode, the default:
![screen shot 2017-02-14 at 16 51 02](https://cloud.githubusercontent.com/assets/5436545/22937804/024e64e0-f2da-11e6-9911-4135049f4726.png)
Closes https://github.com/facebook/react-native/pull/12384

Differential Revision: D6006689

Pulled By: hramos

fbshipit-source-id: fcd37c867c4061b9982b1687f2c10211e54df7cf
2017-10-08 12:38:45 -07:00
Tim Wang f9be64aea0 Use UnimplementedView for CheckBox on iOS
Summary:
`CheckBox` component was introduced in v0.49.0 and not implemented on iOS.

Users who are trying to use `CheckBox` on iOS will get a warning that
> Native component for "AndroidCheckBox" does not exist

We should declare in the document that this component is Android only and use `UnimplementedView` for iOS.

- Use `react-native init` new project
- Apply pull request changes
- Add `<Checkbox />` after welcome text in `App.js`
- Run the app in iOS simulator
Closes https://github.com/facebook/react-native/pull/16211

Differential Revision: D6005393

Pulled By: hramos

fbshipit-source-id: 1c9b68b5e1c933496c4d7c2f487f0500264b603a
2017-10-07 17:24:23 -07:00
Matej Strasek 4ddc931d15 Fixing test by updating snapshot for TouchableHighlight
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Tests were failing due to not updated snapshot about TouchableHighlight.

Run `npm test`.
Closes https://github.com/facebook/react-native/pull/16185

Differential Revision: D6005399

Pulled By: hramos

fbshipit-source-id: eda5009b68ca121250817de448424105aec6f685
2017-10-07 16:40:43 -07:00
Gabriel Weyer c12681c214 Fix warning on SectionList's tutorial
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

I wanted to fix issue #16231 - the warning is not displayed anymore:

![image](https://user-images.githubusercontent.com/2101647/31268083-7e2e0ddc-aac6-11e7-966b-b1e9ffa6cfa8.png)
Closes https://github.com/facebook/react-native/pull/16232

Differential Revision: D6005386

Pulled By: hramos

fbshipit-source-id: 33961ee7cd708c424c2665a38dc5e733f1ea2204
2017-10-07 16:40:43 -07:00
Yann Pringault f66c8f2f7e Fix minor typo in ScrollView doc
Summary:
I don't think a test plan is required here! 😛
Closes https://github.com/facebook/react-native/pull/16243

Differential Revision: D6005196

Pulled By: hramos

fbshipit-source-id: 3b46346e57e0d9971078c4807a4fa0045a8366b1
2017-10-07 15:04:10 -07:00
Paul Brittain 1b80118b66 16111 Webview contentInset docs change
Summary:
Addresses #16111

**No tests needed, non functional change. Test suite ran: PASS**
Closes https://github.com/facebook/react-native/pull/16138

Differential Revision: D6004974

Pulled By: hramos

fbshipit-source-id: 3f47aab417ec0181fe8c3029d72e7729a709a754
2017-10-07 12:22:55 -07:00
Paulo Ricardo Severo 2f2c3ea254 Fix navigation links in documentation.
Summary:
When navigating in the docs, these two links are broken.

The "Continue Reading" in http://facebook.github.io/react-native/docs/more-resources.html page, and "Previous" in http://facebook.github.io/react-native/docs/platform-specific-code.html.

This PR is to fix this.
Closes https://github.com/facebook/react-native/pull/16236

Differential Revision: D5998970

Pulled By: hramos

fbshipit-source-id: b339408eaada612133f6b63bd11967196ff3a039
2017-10-06 13:08:57 -07:00
Matej Strasek 88a79b32b7 Updating blog post about RTL from setAllowRTL to allowRTL (Android).
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Updating blog post about RTL to use updated function `sharedI18nUtilInstance.allowRTL` for Android as mentioned in [this issue](https://github.com/facebook/react-native/issues/16166)

Check [this blog post](https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html).
Closes https://github.com/facebook/react-native/pull/16184

Differential Revision: D5987016

Pulled By: hramos

fbshipit-source-id: 96eb066e0326a550e84d290dc1397fdc2ca5c4f4
2017-10-05 14:38:18 -07:00
Adam Ernst e87904cea5 Redo error handling on iOS
Reviewed By: danzimm

Differential Revision: D5969343

fbshipit-source-id: 376984a6e959349260c54884c0b0b719f4c353d6
2017-10-05 13:31:55 -07:00
Pieter De Baets 1e3a8e2ed4 Remove AdSupport from React.podspec
Summary: Closes https://github.com/facebook/react-native/pull/16168

Differential Revision: D5988522

Pulled By: javache

fbshipit-source-id: ac9c393915c249038eb34c4bd4f34ece58fe7975
2017-10-05 12:32:04 -07:00
Max Sherman 790eabcdff Replace getInt with asInt in native collections
Reviewed By: mhorowitz

Differential Revision: D5904751

fbshipit-source-id: 995412196fd76ea60a65253719e49852322be6e6
2017-10-05 10:07:24 -07:00
Valentin Shergin f8e13868dd Fixed crash in [UIManager setLocalData:]
Summary:
This is pretty normal and harmless case, we should not crash here.
I plan to refactor similar places in this file soon.

Reviewed By: AaaChiuuu

Differential Revision: D5983443

fbshipit-source-id: 922fea8ed12ebef45d249f16739aa81fe3254f19
2017-10-04 19:54:24 -07:00
Alex Dvornikov 7f6a7aec46 remove RCTWebSocketObserver
Summary: Remove RCTWebSocketObserver as it's not used anywhere in the project.

Reviewed By: shergin

Differential Revision: D5960354

fbshipit-source-id: a5b9d128f7cf9384a9fa9ed20e869801023e1d57
2017-10-04 19:17:07 -07:00
Alex Dvornikov afec987e10 Unify sampling profiler and reload logic by leveraging RCTPackagerConnection
Differential Revision: D5951952

fbshipit-source-id: ceea04ebbddb02944717a266a14523be052ab213
2017-10-04 19:17:06 -07:00
Alex Dvornikov 9e01d72103 Unify supplimentary bundle path creation logic between Android and iOS
Differential Revision: D5941546

fbshipit-source-id: c9b8fab887f480faa373c26a1d5ba310e8acde78
2017-10-04 15:16:27 -07:00
Alexey Lang adde2ed5e9 Fix the debug logging regression
Reviewed By: AaaChiuuu

Differential Revision: D5975880

fbshipit-source-id: 39c632ddf84e57c814b54fac465651120e4127da
2017-10-04 15:04:53 -07:00
Naman Goel bee33a4400 Improve Flow Types
Differential Revision: D5963184

fbshipit-source-id: 206f0d52b66f4f1af284445b10a8a4ff7b2cc36d
2017-10-04 14:55:34 -07:00
Gustavo Gard 2d2dfa26bc Correct logo URL
Summary:
Update logo URL
https://facebook.github.io/react/img/logo_og.png (old) to https://facebook.github.io/react/logo-og.png (new)

Check that the old URL shows a "Page Not Found" and the new URL the correct image.
Closes https://github.com/facebook/react-native/pull/16204

Differential Revision: D5978967

Pulled By: TheSavior

fbshipit-source-id: f6af03dfd25d68c96e01054c256d8b6ba9fedba2
2017-10-04 14:38:02 -07:00
Alex Kotliarskyi 9c29ee1504 Standard Flow type for style prop
Reviewed By: sahrens

Differential Revision: D5978082

fbshipit-source-id: bd251ed3ecc1f15595e2f5ee941e3865a225c1fd
2017-10-04 14:38:02 -07:00
Suhair Zain d0260b4f35 Documentation about ABI split in Android Release
Summary:
It leads to a reduction of 5-7MB for an app, which is a considerable saving when it comes to emerging markets. Also, I had written a [comment](https://github.com/facebook/react-native/issues/5037#issuecomment-223758335) on an issue which seems to have helped at least 26 people.
Closes https://github.com/facebook/react-native/pull/16197

Differential Revision: D5978945

Pulled By: TheSavior

fbshipit-source-id: 391a992e2d8e62e59fb20e5d5f8e5f59c00b6295
2017-10-04 14:17:03 -07:00
Ram N 0c234c90a2 Add error customizer for React Native Android
Reviewed By: achen1

Differential Revision: D5954205

fbshipit-source-id: 8b92bf1484a037b333a6f0f4aeddd39ffee25361
2017-10-04 14:06:35 -07:00
Brian Vaughn 678a7f3c39 React sync for revisions b5ac963...5f93ee6f6
Reviewed By: gaearon

Differential Revision: D5950896

fbshipit-source-id: 74aebcee8a64e8552b170223adf59ed4ed905a74
2017-10-04 10:16:15 -07:00
Andrew Chen (Eng) 7677af1d10 Litho UIImplementation
Reviewed By: marco-cova

Differential Revision: D5880274

fbshipit-source-id: e6741579d3de6090dea8d26cd07241d57adba84d
2017-10-04 08:31:04 -07:00
Alex Dvornikov d07279c978 Remove usage of "this" in a callback in RCTNativeModule
Summary: As RCTNativeModule can be destructed at any time, it's unsafe to capture "this" in a callback.

Reviewed By: javache

Differential Revision: D5963728

fbshipit-source-id: c80a01c851d97813e4fead2b31c442eaeb8ae204
2017-10-04 06:00:09 -07:00
Paco Estevez Garcia ef2e29f54c Move URL escaping to Inspector layer
Reviewed By: Hypuk

Differential Revision: D5967544

fbshipit-source-id: d741e6324aff7583778cb13c862505b61ca02a3d
2017-10-04 03:51:33 -07:00
Janic Duplessis eae4fe810f Improve YellowBox output format
Summary:
YellowBox currently assumes the first arg is a printf like format string, this adds support for any arguments so it works more like console in the browser. This also adds `stringifySafe` to format arguments when using printf style.

The main annoyance that this fixes is when trying to log a single object it will currently print [object Object] instead of the fully stringified version.

**Test plan**

Tested a bunch of different log combinations.

```js
console.warn({test: 'a'}); // {"test":"a"} (was [object Object] before this patch)
console.warn('test %s %s', 1, {}); // test 1 {}
console.warn('test %s', 1, {}); // test 1 {}
console.warn({}, {}, {}, {}); // {} {} {} {}
```
Closes https://github.com/facebook/react-native/pull/16132

Differential Revision: D5973125

Pulled By: yungsters

fbshipit-source-id: fc17105a79473a11c9b1c4728d435fc54fb094bb
2017-10-04 00:00:36 -07:00
Frank Manns 09680f71df Return instancetype for shared RCTI18nUtil instance
Summary:
In modern Objective-C you should use the `instancetype` keyword for methods which return an instance of the class they are called on. See Apple's [Adopting Modern Objective-C](https://developer.apple.com/library/content/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html) guide.

Because `sharedInstance` was returning an object of type `id`, the returned value needed to be cast before it could be used in Swift.

I also changed the implementation of `sharedInstance` to use Grand Central Dispatch, which is the generally accepted best way of creating a singleton in Objective-C.

I verified my changes with the "RTLExample" app in RNTester.

| LTR | RTL |
|---|---|
|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155210-6454b4d6-a87a-11e7-9dd7-9a52f3924737.png">|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155233-8702aff6-a87a-11e7-8028-51cf2b3eb0c4.png">|
Closes https://github.com/facebook/react-native/pull/16196

Differential Revision: D5971898

Pulled By: shergin

fbshipit-source-id: dfa375c89248adfc9fd885cacc6a6d4cbfea6e90
2017-10-03 20:11:16 -07:00
Karl Tarvas 59d9f8ca5e Fix Android 4.1-4.3 WebView source baseUrl bug
Summary:
Resolves https://github.com/facebook/react-native/issues/11753 and https://github.com/facebook/react-native/issues/9835.

Android versions 4.1-4.3 don't understand the MIME type `text/html; charset=utf-8` and default to `text/plain` instead, rendering the content as an unparsed HTML string. Since the encoding is already set and passed separately, removing it from the MIME type has no negative effects.

The same fix has already been discussed, successfully tested and incorporated in https://github.com/NativeScript/NativeScript/issues/1038.
Closes https://github.com/facebook/react-native/pull/13789

Differential Revision: D5971910

Pulled By: shergin

fbshipit-source-id: 07795bdf0f13ddb1e8eec779d1cad59244f3687e
2017-10-03 18:51:57 -07:00
James Ide 26f6f6019b Set fishhook's header_dir to "fishhook"
Summary:
This lets us import fishhook like `<fishhook/fishhook.h>`.
Closes https://github.com/facebook/react-native/pull/16192

Differential Revision: D5971639

Pulled By: shergin

fbshipit-source-id: c46503953a08a74bdd10ed35cbd30029f1666c7d
2017-10-03 18:20:30 -07:00