Commit Graph

7256 Commits

Author SHA1 Message Date
Fadil Sutomo faabeadebf Fix JSX string props quote convention
Summary:
Not sure if I misunderstand the previous JSX convention. But I found that in JSX string props, double-quote is preferred instead.

https://github.com/facebook/react-native/blob/master/.eslintrc#L182

![screen shot 2016-07-21 at 5 32 04 am](https://cloud.githubusercontent.com/assets/6204776/17006166/137db7ae-4f09-11e6-871b-2cf99960e3a1.png)
Closes https://github.com/facebook/react-native/pull/8933

Differential Revision: D3597084

fbshipit-source-id: 606a2123f1a1ff1fe2234b636b68b3273ebf6ebb
2016-07-20 20:13:27 -07:00
Mengjue Wang 700e82f663 Provide I18n Module in OSS 3/3
Summary: expose context for I18nManagerModule and I18nUtil

Reviewed By: dmmiller

Differential Revision: D3575706

fbshipit-source-id: d432d3762df13f9a1b33a32eff306f88e49fe852
2016-07-20 15:29:27 -07:00
Emil Sjolander 0df569dc7f Handle children internally in CSSLayout
Reviewed By: javache

Differential Revision: D3588205

fbshipit-source-id: 27f701a9a85cc0e86bb1d233a6bc74b529a8d4d4
2016-07-20 13:28:30 -07:00
Mengjue Wang 566e0553ca Provide I18n Module in OSS 2/3
Summary: Add module dependence into RN

Reviewed By: dmmiller

Differential Revision: D3575689

fbshipit-source-id: bc8cd221ffa4fcdbdab97051c0f8dedd387d6ee1
2016-07-20 11:28:33 -07:00
Mengjue Wang 0ab1486f7e Provide I18n Module in OSS 1/3
Summary: Create I18nUtil and I18nManagerModule for OSS.

Reviewed By: dmmiller

Differential Revision: D3575674

fbshipit-source-id: aad96be167f3e7b0692a9cc2c7f8a558e7aa722a
2016-07-20 11:28:33 -07:00
Emil Sjolander c7ff46bf55 Make isTextNode a prop instead of a function
Reviewed By: javache

Differential Revision: D3586184

fbshipit-source-id: 8b269c11c5d47efb6b788be68336845399292168
2016-07-20 08:59:00 -07:00
Emil Sjolander 1af9270e45 Revamp API
Reviewed By: majak

Differential Revision: D3579423

fbshipit-source-id: 040ecab2f20216aa136ccb8a9e7e15ffa882b313
2016-07-20 08:58:59 -07:00
Don Yu 12ec213c0d Add support for layout gravity to ToastAndroid
Summary: Add support for top, bottom, and center layout gravity to ToastAndroid

Reviewed By: AaaChiuuu

Differential Revision: D3590224

fbshipit-source-id: 84dbbcfbe4133f291d62723c5c261acd7b32b46e
2016-07-20 08:13:37 -07:00
Emil Sjolander 768caf5e08 Use library style import for CSSMacros
Reviewed By: javache

Differential Revision: D3576815

fbshipit-source-id: 8d8cf34f701529b272f564088fb1b28708ec27a9
2016-07-20 07:28:36 -07:00
Charles Dick b25005a833 AdsManager now uses new react native QPL identifiers
Reviewed By: fkgozali

Differential Revision: D3543775

fbshipit-source-id: b7a6f811c579d35913ad5e480e1a5bc486a6172d
2016-07-20 07:28:36 -07:00
Adam Comella c4ffc7d71c Android: Fix handling of line height with inline images
Summary:
This PR was split from a commit originally in #8619. /cc dmmiller

When an inline image was larger than the specified line height,
the image would be clipped. This changes the behavior so
that the line height is changed to make room for the inline
image. This is consistent with the behavior of RN for iOS.

Here's how the change works.

ReactTextView now receives its line height from the layout thread
rather than directly from JavaScript.

The reason is that the layout thread may pick a different line height.
In the case that the tallest inline image is larger than the line
height supplied by JavaScript, we want to use that image's height as
the line height rather than the supplied line height.

Also fixed a bug where the image, which is supposed to be baseline
aligned, would be positioned at the wrong y location. To fix this,
we use `y` (the baseline) in the `draw` method rather than trying
to calculate the baseline from `bottom`. For more information
see https://code.google.com/p/andro
Closes https://github.com/facebook/react-native/pull/8907

Differential Revision: D3592781

Pulled By: dmmiller

fbshipit-source-id: cba6cd86eb4e3abef6a0d7a81f802bdb0958492e
2016-07-20 07:13:37 -07:00
Andrew Jack c47f7457c0 Update OkHttp to 3.4.0 and Okio to 1.9.0
Summary:
- 3.3.1 wasn't compatible with Robolectric 3.0, however 3.4.0 [fixes](https://github.com/square/okhttp/issues/2533#issuecomment-230198063) this issue.
- Few other fixes to OkHttp mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

> Fixes: #7743
>
- Android apps can recover from a `REFUSED_STREAM` in HTTP/2.
- A few other fixes mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

- CircleCi
- Test with `/Examples` 
Closes https://github.com/facebook/react-native/pull/8672

Reviewed By: alsutton

Differential Revision: D3541293

Pulled By: bestander

fbshipit-source-id: 76429861b4f4df15cb9c18ab0f177daee3e1459d
2016-07-20 06:43:33 -07:00
Emil Sjolander 1aa7ad0ab8 CamelCase
Reviewed By: majak

Differential Revision: D3576069

fbshipit-source-id: cecda2cdb67f2f66ac92e336068d58731ccdb101
2016-07-20 06:43:32 -07:00
Jon Vassbø b7bf24bc7f Support geolocation in android webview
Summary:
Makes sure request for geolocation use in the webview is handled.
This solves issue #7609

Currently use of geolocation in webview fails silently, as the permission request is never received by the native app.

**Test plan (required)**

1. Create new project with webview
2. Add javascript for geolocation:
```javascript
navigator.geolocation.getCurrentPosition(function (position) {
  console.log('success', position)
}, function (error) {
  console.log('could not determine position', error)
})
```
3. Run code and assert geolocation permission is requested, resulting in success (or error) callback being called
Closes https://github.com/facebook/react-native/pull/8305

Differential Revision: D3592887

fbshipit-source-id: 84fe2383fba8873431c5e89d154c0a4fd58ffb70
2016-07-20 05:43:25 -07:00
Dan Caspi 654e4bed2e Better folly::dynamic ==> JSValue conversion
Reviewed By: lexs

Differential Revision: D3347854

fbshipit-source-id: 95b81152d1b0d5fe41e01991c44f5d1110be7ddb
2016-07-20 04:28:37 -07:00
Adam Comella e1b3bbdb04 Android: Refactor HierarchyOptimizer in preparation of inline view support
Summary:
This PR was split from commits originally in #8619. /cc dmmiller

These refactorings to the HierarchyOptimizer are in preparation for implementing support for inline views in #8619.

**Refactoring 1: Collapse add*LayoutOnlyNodeToLayoutOnlyNode**

addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.

**Refactoring 2: Extract addGrandchildren**

Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.

**Test plan (required)**

This change was tested with UIExplorer and a small test app and it's being used in my team's app.
Closes https://github.com/facebook/react-native/pull/8908

Differential Revision: D3592783

Pulled By: dmmiller

fbshipit-source-id: a513e8d381e71112ce6348bbee7d4a7c62c33619
2016-07-20 04:28:36 -07:00
Emil Sjolander 0587c85094 Add [RCTShadowView isCSSLeaf] for skipping css tree of children
Summary: RCTShadowText currently overrides a couple methods from RCTShadowView to reset the count of the cssNode children to 0. This diff instead moves that logic into RCTShadowView behind a configurable flag making it easier to reason about.

Reviewed By: javache

Differential Revision: D3586434

fbshipit-source-id: 4389a8119dc49e3fc4357174c87c0c69287ae385
2016-07-20 02:58:39 -07:00
Emil Sjolander 102577565a Remove fillCSSNode method
Summary: fillCSSNode was only ever used in RCTShadowView to set the child count which is already performed in insert/remove subview calls and in RCTShadowText is was used to set the measure function which can be done in the initializer instead.

Reviewed By: majak, javache

Differential Revision: D3586418

fbshipit-source-id: de2155daf0f1702c8977bf23183a3b6a650d016b
2016-07-20 02:58:39 -07:00
Konstantin Raev 702c14bdf2 Enabled Vertical ScrollView instrumentation test in SandCastle
Reviewed By: emilsjolander

Differential Revision: D3588423

fbshipit-source-id: ad2486b3da5fe7972e4ea9409a729d2ba2483782
2016-07-20 02:58:39 -07:00
Mengjue Wang a527ef2032 Fix Popover problem for RTL 1/n
Summary: Change modal.js to support RTL

Reviewed By: javache

Differential Revision: D3580776

fbshipit-source-id: e9ef3f340f52e38fd905dce6d14a74d3bd7b7982
2016-07-19 10:43:29 -07:00
Adalbert Gorecki 6d1277065d Show the right error message in the console
Summary:
Just a small update to fix the error message in `Alert.js`.

In my app, I'm using https://github.com/zo0r/react-native-push-notification to show local notifications. When the notification is tapped, I'm trying to show an alert with the notification text, but this results in an error (which is not the problem I'm addressing here). Unfortunately the wrong parameter was passed to the `console.warn`, so you couldn't see what the error message was.

Before:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 43" src="https://cloud.githubusercontent.com/assets/666322/16910173/854fc0ea-4cd7-11e6-956f-93ee68a09bd6.png">

After fix:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016
Closes https://github.com/facebook/react-native/pull/8861

Differential Revision: D3586453

fbshipit-source-id: bf81e42bd4450ef15a301e7367e94355379c442e
2016-07-19 07:28:34 -07:00
Pieter De Baets 63e0e6c7e4 Add more profiling markers to RCTJSCExecutor
Summary: Add some additional perf markers, and remove the usage of RCTProfileBlock as it completely breaks debugging / stepping in those blocks.

Reviewed By: majak

Differential Revision: D3579900

fbshipit-source-id: 8846dfc39b2448daa3669d5e1e8efb9096f183c5
2016-07-19 07:28:34 -07:00
Jhen 46417dd26a Get server host in setupDevtools for Android
Summary:
The `setupDevtools` for Android looks coming on [v0.30](22fbb6d46d), currently we need to run `adb reverse tcp:8097 tcp:8097`, I think get host IP (`10.0.2.2`, Genymotion: `10.0.3.2`) for Android will be better. (it can be found in `AndroidConstants` native module)
Closes https://github.com/facebook/react-native/pull/8811

Differential Revision: D3586177

Pulled By: javache

fbshipit-source-id: 3bfe04391b0fea608e4d3deab03dd376fab8727c
2016-07-19 05:58:29 -07:00
themorecolor@gmail.com 875d5d2364 update doc for android MainApplication.java
Summary: Closes https://github.com/facebook/react-native/pull/8886

Differential Revision: D3586269

fbshipit-source-id: d6dc0a3618f3c1c4516ce428dd525b3f8aa09d3c
2016-07-19 04:43:25 -07:00
Bart den Hollander 25ed41cc94 update yeoman-generator to 0.21 because of RegExp DoS issue
Summary:
Installing react-native gives a warning because of outdated version of yeoman-generator. The warning is ```npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue```.
This MR will update the yeoman-generator version to 0.21.0 to resolve this warning.
Closes https://github.com/facebook/react-native/pull/8859

Reviewed By: matryoshcow

Differential Revision: D3580087

Pulled By: bestander

fbshipit-source-id: 4daddd804679ab8e95e59cf0d0005f87d2f48e1c
2016-07-19 04:37:01 -07:00
aleclarsoniv bee118096b Add Image resizeMode center to iOS
Summary:
Addresses this comment: https://github.com/facebook/react-native/issues/2296#issuecomment-232446493

This pull request adds the `center` value to `ImageResizeMode`.
When set, it will center the image within its frame.
If the image is larger than its frame, the image is downscaled while maintaining its aspect ratio.
That is how the Android implementation works, too.

Sorry, don't have time to write tests. 😢

Any reviewers should make sure `RCTTargetRect` returns the correct value when:
- the image is smaller than its frame (ie: no downscaling needed)
- the image is larger than its frame (should be downscaled to avoid clipping)
Closes https://github.com/facebook/react-native/pull/8792

Differential Revision: D3586134

Pulled By: javache

fbshipit-source-id: 78fb8e5928284003437dac2c9ad264fa584f73ec
2016-07-19 03:43:26 -07:00
Tobias Ritzau d343eaabff Added the native animation demo to the android UIExplorer
Reviewed By: javache

Differential Revision: D3569816

fbshipit-source-id: ab03f3f3ad10b3921d428628c87e4091c07ceafe
2016-07-19 02:43:24 -07:00
Rakan Nimer 36ee027d22 Add debugging with Stetho instructions #934
Summary:
**Motivation** : Debugging RN with Stetho is very helpful but not very well documented.

**Result Screenshot**

![debugging-with-stethos-screenshot](https://cloud.githubusercontent.com/assets/1270909/16942569/61be3f76-4d9f-11e6-90de-d788ccabb440.png)
Closes https://github.com/facebook/react-native/pull/8883

Differential Revision: D3586063

fbshipit-source-id: e55ebee0d1e1eedb109bec307c313942bc70b646
2016-07-19 02:13:27 -07:00
sasaki takeru fa062aab14 fix UIExplorer build path
Summary:
UIExplorerApp.ios.js is moved into js directory.
Closes https://github.com/facebook/react-native/pull/8884

Differential Revision: D3586032

Pulled By: nathanajah

fbshipit-source-id: 93793681e33a0922e3d8503da3f1c0d01fd4fa93
2016-07-19 01:58:36 -07:00
Brent Vatne a564af853f Throw flow error when trying to access a style that is not defined on a stylesheet
Summary:
I thought it would be useful to help clear out references to no longer used styles and also catch typos on style names to have flow error when we try to access a style that isn't defined.

Example:

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because `continer` is misspelled
    return (
      <View style={styles.continer} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because no fancyContainer style is defined
    return (
      <View style={[styles.container, styles.fancyContainer]} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

All credit goes to jeffmo in this tweet: https://twitter.com/lbljeffmo/status/755179096271888385

Also included in the PR is some cleanup on styles that
Closes https://github.com/facebook/react-native/pull/8876

Differential Revision: D3584983

Pulled By: yungsters

fbshipit-source-id: 0ee0e12ff3d976c137d932688e323c26690e0a52
2016-07-18 23:28:25 -07:00
Yibin Chen 4ccd14f31a Integrating AutoUpdater's custom JS Bundle loading into Fb4a
Reviewed By: AaaChiuuu

Differential Revision: D3558831

fbshipit-source-id: b3909de774922fae903f3e8718fbfcd9b1ece2f8
2016-07-18 16:28:28 -07:00
Olivier Notteghem e27c1495bd network congestion improvements (part 1)
Reviewed By: dmmiller

Differential Revision: D3553287

fbshipit-source-id: ea33bb7d929cbc0229bfe8537c3a4fc58fe9691e
2016-07-18 12:13:29 -07:00
Mehdi Mulani 40c06b99a2 Short-circuit setContentInset in RCTScrollView
Reviewed By: javache

Differential Revision: D3579609

fbshipit-source-id: c108bbe135a0a9a98045ebc8068a103c892a1d0f
2016-07-18 11:58:27 -07:00
David Goldman 9d2e6a2f8a Add ability to customize error messages and stacks within the iOS redbox
Reviewed By: javache

Differential Revision: D3517605

fbshipit-source-id: a2efba80bbe1f6c74bf4e01f7807389962cb2463
2016-07-18 11:28:36 -07:00
Ernest Walzel 83336130ef Fix minor typo in ListViewExample.js
Summary:
s/_renderSeperator/_renderSeparator/
Closes https://github.com/facebook/react-native/pull/8816

Differential Revision: D3580181

Pulled By: javache

fbshipit-source-id: e9cf35d50512b490efafa880f8d99ca13aa4df15
2016-07-18 10:30:53 -07:00
Gabriel METZGER 5f6237912c Update IntegrationWithExistingApps.md
Summary:
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.**

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

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/face
Closes https://github.com/facebook/react-native/pull/8869

Differential Revision: D3580218

Pulled By: JoelMarcey

fbshipit-source-id: 9f71825ed0a63739497ec7fa77081df0a72b6747
2016-07-18 10:13:28 -07:00
Gabe Levi 750da65d71 Update suppress_comment for v0.29.0
Reviewed By: bhosmer

Differential Revision: D3563060

fbshipit-source-id: b6fe913b312c45234d1685524efebd7249d20741
2016-07-18 08:58:32 -07:00
Pieter De Baets 4269003cb7 Make bridge initialization configurable
Reviewed By: majak

Differential Revision: D3424412

fbshipit-source-id: 933925b97cb2bdfabd84c3533fefb01efb41d030
2016-07-18 07:13:32 -07:00
Pieter De Baets 23e28eca11 Add completion callback to enqueueJSCall
Reviewed By: majak

Differential Revision: D3423580

fbshipit-source-id: c063c9c5d8961d5c9cb14c32d70767c67d78430a
2016-07-18 07:13:32 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
yeshuang ca5d1aebab Defend against nil pointer in RCTImageLoader.m
Summary:
Defend against nil pointer in RCTImageLoader.m. In some rare case, the "response" might be nil, and this would lead to crash.

This issue is related: https://github.com/facebook/react-native/issues/6952
Closes https://github.com/facebook/react-native/pull/8141

Differential Revision: D3579427

Pulled By: javache

fbshipit-source-id: 7b71768a0c6d74a42d280b1d54adda86b493f0ef
2016-07-18 04:58:29 -07:00
Janic Duplessis df8c88e000 Fix UIExplorer entry file on iOS
Summary:
Files were moved to the js/ directory so UIExplorer did not work anymore on iOS, this fixes the path.
Closes https://github.com/facebook/react-native/pull/8841

Differential Revision: D3576752

fbshipit-source-id: 921ddc2e158ee0c74dcf691a32504900c5d79e1d
2016-07-17 01:43:28 -07:00
Alec Winograd abe9f5188a Fix documentation link in README.md
Summary:
Updated link for `integrating with existing apps` documentation
Closes https://github.com/facebook/react-native/pull/8842

Differential Revision: D3576490

fbshipit-source-id: 20d7c39dec615a3928ddc98ef31c8fbcf063f145
2016-07-16 18:58:27 -07:00
Kureev Alexey 3c8a2eed92 Fix native modules linking in 0.29.1
Summary:
Attempt to fix https://github.com/facebook/react-native/pull/8612

We re-named `mainActivityPath` by `mainFilePath` in the `link` code, but we forgot to rename config parameters. Currently, link is broken.

- [x] `react-native link` should work for react-native 0.29+
Closes https://github.com/facebook/react-native/pull/8807

Differential Revision: D3576176

fbshipit-source-id: 60ecbd660563923696bbef1ed3b0900a7d58469f
2016-07-16 10:58:21 -07:00
Mengjue Wang 9e142a18dd Provide RTL support for RCTShadowText
Reviewed By: majak

Differential Revision: D3524891

fbshipit-source-id: e67c35cc85b2764ab2eea3b14f7970afa06154b5
2016-07-15 18:58:30 -07:00
Konstantin Raev 7aeaf7d941 Updated React to 15.2.1
Reviewed By: zpao

Differential Revision: D3569832

fbshipit-source-id: 2a2aea8c68fb15e2772d30ddce03bad73fd0a259
2016-07-15 14:43:31 -07:00
Janic Duplessis 80872ffccd Remove exported constants from RCTTimers to allow lazy initialization
Summary:
As per javache comments in #8734.

Also removes now useless feature detection check.

**Test plan**
Tested that rIC still works in UIExplorer example.
Closes https://github.com/facebook/react-native/pull/8795

Differential Revision: D3572566

Pulled By: javache

fbshipit-source-id: 261d13d8b03898313f8b4184d634c70f81a61b62
2016-07-15 13:58:40 -07:00
Andy Denmark f067811cd2 Small typo s/they/the/
Summary: Closes https://github.com/facebook/react-native/pull/8813

Differential Revision: D3572677

Pulled By: sdwilsh

fbshipit-source-id: a2b2b38e64b9575a8b4bcaeb941a34470fc6f1e1
2016-07-15 13:58:39 -07:00
Lukas Piatkowski edb9fce9c3 #6 Notify SamplingProfiler of the main MachineThread
Reviewed By: bnham

Differential Revision: D3503444

fbshipit-source-id: a2e9a692cd5badac5a15416844c8497f88021a5e
2016-07-15 11:58:31 -07:00
Hedger Wang 4843a90c1c PanResponder should not hold stale handle for interaction.
Summary:
For now, `PanResponder.create()` return a new object which may hold a handle
for interaction. The handle is created when the gesture starts, and it's cleared
when the gesture finishes.

However, the handle may become stale cause the owner (view) is removed or
re-rendered before the gesture finishes, which leaves InteractionManager
with handles that can never be removed.

In some cases, this blocks the app that waits for InteractionManager to
be idle and having leaky handles prevents InteractionManager from being idle
again.

The fix is to move the handle from the instance to the static variable, and
we'd clear it whenever a gesture finishes.

Reviewed By: sahrens

Differential Revision: D3550699

fbshipit-source-id: 412e9046a6cd9be34b3a7d572258008016a29f41
2016-07-15 11:58:31 -07:00