Commit Graph

2738 Commits

Author SHA1 Message Date
Pieter De Baets f255bda51f Fix loop when websocket executor is used without packager present
Reviewed By: mhorowitz

Differential Revision: D4159911

fbshipit-source-id: db913704641daf055060f5fe4561479daf76cd5a
2016-11-21 07:13:28 -08:00
Alex Kotliarskyi d117f550a5 Provide more info when image fails to load
Reviewed By: javache

Differential Revision: D4209311

fbshipit-source-id: 6ad8ea6b8e236ec5ad2a2313a69b8985f9a06c74
2016-11-21 04:58:30 -08:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
Justin d643eed0f0 Update grammar in TouchableWithoutFeedback.js
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

When I'm referring to the `TouchableWithoutFeedback` documentation, I keep noticing this missing 's'.
Closes https://github.com/facebook/react-native/pull/11037

Differential Revision: D4211726

Pulled By: ericvicenti

fbshipit-source-id: 32adf03ec37733128039e064b8fdfa8b817e4a01
2016-11-20 15:28:31 -08:00
Adam Comella 54e947152f Navigator: null check on gesture.overswipe to prevent crash
Summary:
Sometimes, `gesture.overswipe` can be `null`/`undefined` in `_moveAttachedGesture` resulting in a crash. This change adds a null check to avoid the crash. `_matchGestureAction` has a similar check so it looks like this case was overlooked in `_moveAttachedGesture`.

**Test plan (required)**

My team's app is using this change.

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

Differential Revision: D4207277

Pulled By: ericvicenti

fbshipit-source-id: a22817c2ebec1c996583269a59d6767f5713771b
2016-11-20 15:28:31 -08:00
Alex Kotliarskyi dcbcda75ec Introduce nativeImageSource API
Summary: The goal is to replace `require('image!...')` with an API that communicates better of what's going on under the hood.

Reviewed By: yungsters, fkgozali

Differential Revision: D4186241

fbshipit-source-id: b764588dbbd9494dd6905b2346e3274b575a9644
2016-11-20 12:28:28 -08:00
Don Yu 1835dbea7b Add in support for showing annotation callouts by default without the user clicking on the pins
Reviewed By: mmmulani

Differential Revision: D4209555

fbshipit-source-id: 38c2459f9bec0dd2279cf673bcb22aef15748347
2016-11-20 00:58:28 -08:00
Kevin Gozali 4530da87e2 make Modal pass rootTag to AppContainer
Summary:
Following up on fb7fe2d4e8: when <Modal> is used in dev mode, it renders `<AppContainer>` to wrap the children so that the element inspector can show up correctly. In that scenario, we need pass the `rootTag` over the `<AppContainer>` so that the children can read the rootTag correctly. Otherwise, the children of <Modal> will see it as undefined.

With this, AppContainer can then declare `rootTag` as a required prop, as it should have been.

Note that this only affects DEV build because there's no AppContainer wrapping otherwise.

Reviewed By: jingc

Differential Revision: D4204011

fbshipit-source-id: 80edbc8d351d983786e6fc3c68dfa65a71b1ed3c
2016-11-18 01:43:26 -08:00
Valentin Shergin 5d03ff8035 Added support of `<Text>`'s `selectable` attribute on iOS
Reviewed By: mmmulani

Differential Revision: D4187562

fbshipit-source-id: 131ece141fe8b895914043a7a01c6e042e858331
2016-11-17 16:13:28 -08:00
AgtLucas 84553ebf06 Improve doc code consistency
Summary:
For the sake of consistency. 😃
Closes https://github.com/facebook/react-native/pull/10978

Differential Revision: D4193554

Pulled By: JoelMarcey

fbshipit-source-id: c79de8192ecdd0a38c9693a996de84cf63cc89b1
2016-11-16 18:13:26 -08:00
Saleeh 27ae04cabd Fixed #7564
Summary:
Fix for some firewall with ModSecurity
 rules for MULTIPART_STRICT_ERROR, namely MULTIPART_BOUNDARY_QUOTED.
Closes https://github.com/facebook/react-native/pull/10876

Reviewed By: javache

Differential Revision: D4176229

Pulled By: ericvicenti

fbshipit-source-id: 8db819bd3e9b23fa3c1802c48091bb4c44358381
2016-11-15 08:44:30 -08:00
Adam Comella fde7c35449 Make resolveAssetSource public
Summary:
When building a native component which takes an image reference as a prop, `resolveAssetSource` needs to be called on the image reference. If this isn't done, the native component may receive the opaque type returned by `require` (e.g. `require('./foo.png')`) which is useless to the native component. `resolveAssetSource` is used by builtin components that take image references such as `Image`, `WebView` and `MapView`.

This change makes `resolveAssetSource` public so that third-party native components can correctly handle image references.

**Test plan (required)**

Verified that `Image.resolveAssetSource` works in a test app. Also, my team is using this change in our app.

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

Differential Revision: D4177803

Pulled By: ericvicenti

fbshipit-source-id: ffc511b9340325f7d1111002309cd8558ab8e6b0
2016-11-14 21:14:10 -08:00
Joel Arvidsson 31b7819b02 Unbreak custom animated components
Summary:
Commit c9960817ee broke `Animated.createAnimatedComponent()` for most components outside of the standard ones. This is because it will throw an exception for any component without a `viewConfig` defined, which basically no composition style component has AFAIK.

Related issues: https://github.com/facebook/react-native/issues/10825, https://github.com/oblador/react-native-vector-icons/issues/337, https://github.com/oblador/react-native-animatable/issues/70

This PR removes the check which is more treating the symptoms really – but shouldn't `setNativeProps` duck typing be enough?
Closes https://github.com/facebook/react-native/pull/10827

Differential Revision: D4178183

Pulled By: ericvicenti

fbshipit-source-id: b85cc78ed6d84dada4d476caa243332eaadb003f
2016-11-14 20:58:56 -08:00
Gabe Levi 61d1a4fb39 Deploy v0.35.0
Reviewed By: davidaurelio

Differential Revision: D4177391

fbshipit-source-id: c02cf98ed275b7032103b11eab6d0e189f8d8f24
2016-11-14 20:45:17 -08:00
Adam Comella e87e181998 Android: Expose Image's onError event to JavaScript
Summary:
iOS supports an Image onError event. Android was firing the event but it was never reaching JavaScript because Android didn't include this event in `getExportedCustomDirectEventTypeConstants`.

**Test plan (required)**

Verified that the `onError` event now fires in a test app.

My team uses this change in our app.

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

Differential Revision: D4180149

Pulled By: ericvicenti

fbshipit-source-id: 4bf0b9aa7dc221d838d7b6b3e88bb47196dcadef
2016-11-14 19:43:58 -08:00
Linmic 39c18186e1 Fix redundant styles on RefreshControl for Android
Summary:
Fixed a bug that RefreshControl wrongly apply redundant styles on Android, this solves #10742
Closes https://github.com/facebook/react-native/pull/10899

Differential Revision: D4176670

fbshipit-source-id: 357bfd726a39fe8e79d4d70ddfdfd1d39034620e
2016-11-14 17:58:58 -08:00
ianlin e51cb349ce PushNotificationIOS: Use PushNotificationEventName as the key to store in the handler map
Summary:
If we are using the same handler for different events, e.g. both `notification` and `localNotification` use `_onNotification()` handler, the former listener stored in `_notifHandlers` would be overridden by the latter so it's impossible to remove the `notification` listener when we call `removeEventListener`.

This PR stores the listeners by using `pushNotificationEventName` (notification, localNotification, register or registrationError) as the key.

Use the same handler for `notification` and `localNotification`, both listeners will be removed when calling `removeEventListener`.
Closes https://github.com/facebook/react-native/pull/10776

Differential Revision: D4168722

Pulled By: hramos

fbshipit-source-id: d68581428d2acde314f7b5333feafe1ec7807159
2016-11-14 12:58:32 -08:00
Chirag Jain 07c5882a38 enable variable size slideoutView with swipeableListView
Summary:
Currently, swipeableList expects maxSwipeoutDistance to be a number. This breaks when you want each row to have a variable width slideoutView.

This PR add support for passing maxSwipeoutDistance as a number(as before) or a function which gets the current rowData for conditionally returning the distance based on the row data.
Closes https://github.com/facebook/react-native/pull/10189

Differential Revision: D4168561

Pulled By: hramos

fbshipit-source-id: b78564f83279cab3bf04297034ca78edfff74be7
2016-11-14 11:58:58 -08:00
Slavik Manukyan ec6e274172 relativeKeyboardHeight works wrong in some cases
Summary:
relativeKeyboardHeight calculation is wrong when frame.y < keyboardFrame.y

Let's look at an example:

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

export default class Test extends Component {
  constructor(props, context) {
    super(props, context);
  }

  render() {
    return (
      <View style={{flex: 1, marginTop: 20}}>
          <Text style={{ flex: 1, alignItems: 'center'}}>
            Hi! This is test.
          </Text>

          <KeyboardAvoidingView behavior={'position'} keyboardVerticalOffset={-20} >
            <TextInput
              style={{height: 40, borderColor: 'gray', borderWidth: 1}}
            />
          </KeyboardAvoidingView>
      </View>
    );
  }
}

AppRegistry.registerComponent('Test', () => Test);
```

![rn-relativekb](https://cloud.githubusercontent.com/assets/13254349/17298119/b2192830-5819-11e6-968c-d9e95b6e4aba.gif)

How _relativeKeyboardHeight_ calculates positio
Closes https://github.com/facebook/react-native/pull/9139

Differential Revision: D4168431

Pulled By: hramos

fbshipit-source-id: 9181276355490452071b51b51ed7dc9ab80b2444
2016-11-14 11:58:58 -08:00
Héctor Ramos ab898ddda7 Set allowsBackgroundLocationUpdates as necessary when using location …
Summary:
Set the flag 'allowsBackgroundLocationUpdates' to YES if the location background mode is enabled and the 'Always Allow Location' key is set in the App Plist.

**motivation**

We found that on iOS 9.x, the allowsBackgroundLocationUpdates flag must be set on location manager in order to receive updates when the app is in the background (seems to affect actual device only).

**Test plan (required)**
Example app using the forked branch [here](https://github.com/briancalvium/react-native-geolocation-pr-example). Run this example through XCode on a device with 9.x, observe that location update logs continue to appear when the app is in the background. Switch to react native 0.32.0, observe that location update logs stop once the app is in the background.
Closes https://github.com/facebook/react-native/pull/9717

Differential Revision: D4167685

Pulled By: hramos

fbshipit-source-id: 5a62f8433bf8b553561a276fdaa544363298442a
2016-11-14 11:58:58 -08:00
npomfret df6b8bd832 Ensure notification payload is passed to completion handler
Summary:
Fixes #10863
Closes https://github.com/facebook/react-native/pull/10860

Differential Revision: D4175834

Pulled By: hramos

fbshipit-source-id: 5cf317eb675528c647425c70eff939a9db9728fa
2016-11-14 11:28:47 -08:00
Aria Buckles fa8c536b31 TouchableOpacity: Respond instantly to first touch
Summary:
On iOS, when you press down native fading components, they become
transparent instantly, but then have an animated fade in/out if you
move your finger in/out of their hit box.

On react-native currently, the touchdown fades, instead of providing
instant feedback, which doesn't feel right on iOS.

I'm less familiar with Android conventions, but it seems to use fading
components for buttons less often, instead using the ripple effect from
TouchableNativeFeedback. In either case, instant feedback seems better
for the user.
Closes https://github.com/facebook/react-native/pull/10866

Differential Revision: D4175854

Pulled By: hramos

fbshipit-source-id: d993231074e8190cf4ba7ca86dc24299f05d5d8f
2016-11-14 09:43:34 -08:00
Hilke Heremans be5e300abf Fix symbolication on stack trace with whatwg-fetch as a dependency
Summary:
This PR provides a workaround for issue #9605 which affects projects which directly or indirectly require `whatwg-fetch`. At that point, all symbolication on stack trace errors fails due to a circular require caused by RN's lazy loading of `fetch`, which results in `fetch` becoming `undefined`.

The workaround is simple: we postpone requiring `fetch` until the first `symbolicateStackTrace` call, at which point we can be certain `fetch` is properly exported. It is then cached for future use.

No tests have been added since, apparently, this module did not have any tests to begin with. Manual tests were performed on a regular project (not including `whatwg-fetch` externally) and a project that has direct and indirect includes for `whatwg-fetch`.
Closes https://github.com/facebook/react-native/pull/10247

Differential Revision: D4175835

Pulled By: hramos

fbshipit-source-id: d849a5874373e76f166ea6ab23f0f888792d1aef
2016-11-14 09:13:40 -08:00
Adam Comella 54beee2616 Android: Reduce overdraw layers by hiding cards when they are not visible
Summary:
Cards which are not visible because another card is occluding them are still being rendered by Android resulting in overdraw. This results in wasted GPU time because some pixels are drawn multiple times. This change reduces overdraw by changing the opacity of occluded cards to 0.

This bug was found using the tools described in Android's overdraw docs: https://developer.android.com/topic/performance/rendering/overdraw.html

**Test plan (required)**

This change is being used in my team's app.

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

Differential Revision: D4175758

Pulled By: ericvicenti

fbshipit-source-id: 4bfac7df16d2a7ea67db977659237a9aa6598f87
2016-11-14 08:59:24 -08:00
Jared Forsyth 9910d8301b FIx docs for list view: "sticky" header not sticky on android
Summary:
:( this confused me, I thought I was missing some configuration or something. But the UIExplorer app has sticky headers on iOS, and non-sticky headers on Android, so I guess that's that.
Closes https://github.com/facebook/react-native/pull/10335

Differential Revision: D4039482

Pulled By: hramos

fbshipit-source-id: 34be2db4b15dec2f28a808a9bbc2eb00b0e35525
2016-11-11 22:43:46 -08:00
Daniel Nagy b7889e028b Expose NavigatorIOS::replaceAtIndex
Summary:
The React Native docs list `replaceAtIndex` as a public method of the **NavigatorIOS** component but it is never exposed.
Closes https://github.com/facebook/react-native/pull/10577

Differential Revision: D4168180

Pulled By: hramos

fbshipit-source-id: 6d91d9de8404bb229930d804f8b01b324ec16f24
2016-11-11 12:58:35 -08:00
Linmic 35e517562c Fixed the issue that _onTransitionEnd might try to setState at unmoun…
Summary:
This is to fix the issue that if `Animated.parallel`'s callback - `_onTransitionEnd` being triggered twice in a really short period(say quickly double-click the Android's hardware back button),  it might try to `setState` at unmounted stage, hence cause app crash.

This will make sure `_onTransitionEnd` only fired after mounted.
Closes https://github.com/facebook/react-native/pull/10878

Differential Revision: D4167266

Pulled By: ericvicenti

fbshipit-source-id: 7361e0ea4e8481b2da3fa39f78cdc0461693631f
2016-11-11 09:43:48 -08:00
Kevin Han b4283ed844 FIX: Call all android back key handlers before invoking default
Summary:
Fixes issue #9736
Closes https://github.com/facebook/react-native/pull/9757

Differential Revision: D4164796

Pulled By: hramos

fbshipit-source-id: c5d966a9bbaa91f9929ea20a775f96c15aa9f482
2016-11-11 00:28:40 -08:00
Pieter De Baets 9e61473172 Remove FlowFixMe from TextStylePropTypes
Reviewed By: zertosh

Differential Revision: D4160025

fbshipit-source-id: 330f731548bca830d4e3213f43608d2f3495ca57
2016-11-10 08:58:41 -08:00
Naisheel Verdhan 1888a0af16 Add a new Navigator SceneConfig swipeFromLeft
Summary:
Add a new `SwipeFromLeft` Navigator SceneConfig.

The animation is the opposite of `HorizontalSwipeJump`, however there's no `Jump` while animating as `HorizontalSwipeJump`.  Should `HorizontalSwipeJump` be renamed to `SwipeFromRight`?

![swipe-left-anim-2](https://cloud.githubusercontent.com/assets/8182981/18466947/8ca4dd24-79bb-11e6-8cae-8ffa34c0c7da.gif)
Closes https://github.com/facebook/react-native/pull/9877

Differential Revision: D4160059

Pulled By: hramos

fbshipit-source-id: 7426ec72adea80af2d5612aae1dd9d2e6dc090f3
2016-11-10 08:13:57 -08:00
Jeff Morrison bd3be5bd24 Update fbsource
Reviewed By: zertosh

Differential Revision: D4111832

fbshipit-source-id: 301969a1c828fb87e7e09c1eea3cd44799b89509
2016-11-08 12:43:48 -08:00
Thomas Beverley b6a38e80e0 Expose setAllowUniversalAccessFromFileURLs in Android WebView
Summary:
This pull request exposes the `setAllowUniversalAccessFromFileURLs` method of Android WebViewSettings as a property. The reason for this is when loading pages with a `file://` baseUrl it's sometimes desirable to allow loading other assets from a file base url. (For example loading an image into a canvas). More information on its use and purpose can be found [in the android docs here](https://developer.android.com/reference/android/webkit/WebSettings.html#setAllowUniversalAccessFromFileURLs%28boolean%29)

Usage example:

``` jsx
return (
  <WebView
    source={{ html: myhtml, baseUrl: 'file://' }}
    allowUniversalAccessFromFileURLs={true}
    javaScriptEnabled={true} />
)
```
Closes https://github.com/facebook/react-native/pull/8905

Differential Revision: D4147245

Pulled By: hramos

fbshipit-source-id: 7eaa884b8c0268de52b284954a34acec0fbd4061
2016-11-08 08:43:38 -08:00
Ryan Gomba 6535858c71 Add extractOffset to Animated
Summary:
`flattenOffset` has proven extremely useful, especially when dealing with pan responders and other gesture based animations, but I've also found a number of use cases for the inverse. This diff introduces `extractOffset`, which sets the offset value to the base value, and resets the base value to zero. A common use case would be to extractOffset onGrant and flattenOffset onRelease.
Closes https://github.com/facebook/react-native/pull/10721

Differential Revision: D4145744

fbshipit-source-id: dc2aa31652df0b31450556f611db43548180c7dd
2016-11-07 20:43:37 -08:00
Jhen bf2b435322 Make react-devtools server port can be changed
Summary:
This PR make [server port of react-devtools](https://github.com/facebook/react-devtools/blob/master/shells/electron/index.html#L71) can be changed, currently we can set the port yourself and open it, so I think it would be better if it could also be set here.

Another reason is I can debug two RN app (`react-native start --port 8082`), but I cannot let them use react-devtools together, it would be better if I set
different `__REACT_DEVTOOLS_PORT__` in `index.ios.js` and `index.android.js`.
Closes https://github.com/facebook/react-native/pull/10522

Differential Revision: D4144011

Pulled By: hramos

fbshipit-source-id: de67931f377092871a0fe92e7d9a18799625217e
2016-11-07 18:43:41 -08:00
Adam Dierkens f276425ab8 Stop other views from stealing the responder from PickerIOS and DatePickerIOS
Summary:
Similar to 52ddfd9b51 the `DatePickerIOS` and `PickerIOS` components need to stop the propagation of swiping gestures in order to prevent other views from responding to them.

This is most noticable when placed inside a modal behind a scrollView.

<table>
    <tr>
        <td>Before</td>
        <td>After</td>
    </tr>
    <tr>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20035981/ad8b97f6-a3b6-11e6-957c-2d3048e0e78b.gif" />
        </td>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20036025/e7206766-a3b7-11e6-8630-492f8092f3d4.gif" />
        </td>
    </tr>
</table>
Closes https://github.com/facebook/react-native/pull/10768

Differential Revision: D4142351

Pulled By: spicyj

fbshipit-source-id: 22395aefaf46179bf2f77031c329209d4c33ee71
2016-11-07 18:13:53 -08:00
Kevin Gozali fb7fe2d4e8 modernize AppContainer and add rootTag in the child context
Summary:
This does 2 things:
- modernize the component to use ES6 + flow
- assign `rootTag` to the child context

Each view in RN has its own `reactTag`. The reactTag for a root view is called `rootTag`. When there are multiple react root views active within the app (e.g. in a hybrid environment), rootTag is the only reliable "label" to differentiate them. This is especially useful when we want to limit an event/activity on a particular root view, instead of affecting all active root views. This allows components to do:

```
class Foo extends React.Component {
  static contextTypes = {
    rootTag: React.PropTypes.number,
  };

  componentDidMount() {
    // Get the root tag of this component, which is static for all components under the same root view
    console.log(this.context.rootTag);
  }
}
```

In a pure JS RN app environment, there will always be exactly 1 root view, so `rootTag` may usually be ignored.

Reviewed By: yungsters

Differential Revision: D4130376

fbshipit-source-id: 559b67615f487bad754b5832ad4a02bcef05be2a
2016-11-06 20:58:34 -08:00
Ben Griffith a609d1c2b7 Add currentHeight constant to status bar docs
Summary:
This PR is to fix #10561 by adding `currentHeight` to a list of constants for the `StatusBar` component. It also makes it clear that this constant is Android only by also adding a further note to the example use.

Closes #10561

![screen shot 2016-11-01 at 12 37 06](https://cloud.githubusercontent.com/assets/2854338/19889978/f453d43a-a02f-11e6-859e-5a9ebeba9d44.png)
Closes https://github.com/facebook/react-native/pull/10675

Differential Revision: D4137353

fbshipit-source-id: 717494fe78f8eb55c55447d6567ec8bcd0be86d3
2016-11-05 17:13:29 -07:00
Martin Konicek 1605276801 Remove open source deprecation warning from MapView
Summary: The warning is only relevant to open source RN but shown to employees too.

Reviewed By: fkgozali

Differential Revision: D4137216

fbshipit-source-id: 21d5c3051c7964231eeb3f555681a83eacb4c972
2016-11-05 14:13:36 -07:00
Janic Duplessis ac19276534 Fix NavigationCardStackPanResponder to work with native animations
Summary:
`NavigationCardStackPanResponder` uses `__getValue` and the `stopAnimation` callback value which both doesn't work with native driven animation. The workaround here is to add a value listener so the JS value of the AnimatedValue gets updated too so `__getValue` has a relatively up to date value. This value should be good unless JS lags behind native a lot but that should not happen during a navigation gesture. Also added a comment that explains the hack.

**Test plan**
Tested in an app that uses native driven animations with a back gesture. This also needs #10643 and #10641 for everything to work properly.
Closes https://github.com/facebook/react-native/pull/10642

Differential Revision: D4135496

Pulled By: ericvicenti

fbshipit-source-id: 395aff78b16a37ad9407207a05504fdd6311f733
2016-11-04 20:43:43 -07:00
Janic Duplessis e173f14b52 Use native animations if the animated value is native in NavigationCardStackPanResponder
Summary:
Since native and non-native animations do not work together check if the animated value is native and set useNativeDriver accordingly. So untill we move to always using the native driver this is needed. This and another fix in NativeAnimations module will allow using native animations to transitions with gestures.

**Test plan**
Tested in an app that uses native driven animations with a back gesture. This also needs #10643 and #10642 for everything to work properly.
Closes https://github.com/facebook/react-native/pull/10641

Differential Revision: D4135972

Pulled By: ericvicenti

fbshipit-source-id: 8e65574ebb296da044f4d03bf1eedee4a37ebdac
2016-11-04 20:28:30 -07:00
Neo 6a83ac3af6 update Modal.js to fix #10662
Summary:
further discussion: should there be a `onClose` or `onClosed` to pair with `onShow`? which would make a workaround for #10471 much easier
Closes https://github.com/facebook/react-native/pull/10669

Differential Revision: D4133832

Pulled By: hramos

fbshipit-source-id: 644a5bb6b9da697c81fc96ae4da196ba5b4050cb
2016-11-04 18:43:42 -07:00
Fred Liu 6ed49341f3 Remove underline colour in Android text inputs
Summary: `require('something.jpg')` returns a `number` type.

Reviewed By: ejanzer

Differential Revision: D4132544

fbshipit-source-id: cf47baa377258195fe0155b3ea34208325d7c462
2016-11-04 14:58:46 -07:00
Phillip Johnsen cb67d16aee StatusBar: fix incorrect setHidden(hidden) docs description
Summary:
Hi!

Just noticed an incorrect description for the `hidden` argument for `StatusBar.setHidden()` on the website, this trivial change fixes that.

FYI I followed the start procedure for the website mentioned in [CONTRIBUTING.md](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests), and noticed one needs to run `npm install` in the project root directory as well before starting the website. Do you want me to add that instruction as part of this PR, or as a separate PR entirely?
Closes https://github.com/facebook/react-native/pull/10735

Differential Revision: D4131223

fbshipit-source-id: b70c5ef12e72807445c51f13811537b9fa3b6b3e
2016-11-04 09:43:33 -07:00
David Aurelio 3683beb88a RN: Update React (2/2)
Reviewed By: kentaromiura

Differential Revision: D4026114

fbshipit-source-id: 67808af91454d95941fea01eef58a4d9086f46e1
2016-11-04 05:43:44 -07:00
Martin Konicek dca53feb4f Deprecate MapView in favor of airbnb/react-native-maps
Summary:
Compared to the `<MapView>` that comes with React Native, [react-native-maps](https://github.com/airbnb/react-native-maps) work on Android and is more feature complete. It is actively maintained and used extensively (9.2k installs / month, see [JS.Coach](https://js.coach/react-native/react-native-maps?search=react-native-maps)).

We think now is a good time to switch to react-native-maps in your applications and make `react-native-maps` the official `<MapView>` implementation for React Native.

We are going to release the deprecated `<MapView>` as a separate npm module so you can migrate to `react-native-maps` at your own pace.

**Test Plan**

Checked the docs render correctly on the website:

```
cd website
npm install
npm start
```

<img width="696" alt="screenshot 2016-11-01 20 17 31" src="https://cloud.githubusercontent.com/assets/346214/19905831/480074b8-a070-11e6-8779-8e12343c2883.png">

Warning is shown:

<img width="423" alt="screenshot 2016-11-01 20 39 21" src="https://cloud.githu
Closes https://github.com/facebook/react-native/pull/10500

Differential Revision: D4119602

Pulled By: mkonicek

fbshipit-source-id: 86780a98bf999e6047565ab66a5ebbd15e499a46
2016-11-03 16:58:49 -07:00
Tim Yung b5a71fe2b1 RN: Simplify Animated-test.js
Reviewed By: cpojer

Differential Revision: D4118935

fbshipit-source-id: 1f80f22235edbbf8bcb4d51b0110cbfa30a3f917
2016-11-02 14:58:52 -07:00
aybb 68c61203ac Texinput documentation improvement
Summary:
To my mind this feature should be documented as here lots of issues can happen potentially.
Closes https://github.com/facebook/react-native/pull/10706

Differential Revision: D4119506

fbshipit-source-id: 54f9738ea2308144a05678fd1897f529f260966c
2016-11-02 13:58:53 -07:00
Alexander Blom 1709043a12 Add Network agent
Summary: Adds methods in XMLHttpRequest so that the agent can hook the events needed for the implementation, these are only enabled if the agent is enabled (which means that the inspector is connected), it is also stripped out in non-dev currently.

Reviewed By: davidaurelio

Differential Revision: D4021516

fbshipit-source-id: c0c00d588404012d20b744de74e5ecbe5c002a53
2016-11-02 12:29:15 -07:00
Alexander Blom 6a1783210b Add JS agent support
Summary:
Adds the possibility to define agents in Javascript. Javascript agents are simple classes that extend `InspectorAgent` and pass down the
given `EventSender` to the super constructor. The library will then call methods on the object for each received method call over the protocol.

Reviewed By: davidaurelio

Differential Revision: D4021508

fbshipit-source-id: bbe609e92ea726cbbbec833df81705ebd3346c77
2016-11-02 12:29:15 -07:00
Kevin Gozali 3237ade34f fallback to JS Animation if native animated is not present
Summary: This should be a temporary migration path until we enable native animated everywhere, instead of crashing the app if the module is missing. This would present a yellow box with an instruction to add RCTAnimation module to the app

Reviewed By: yungsters

Differential Revision: D4112938

fbshipit-source-id: 56db7801063e9de16a3ff251bf1f0e4f6e3ea7c0
2016-11-01 23:58:49 -07:00
Kevin Gozali 8bb707b686 Use native animations in TouchableBounce and TouchableOpacity
Summary:
this brings back the previous commit that had to be reverted due to internal breakages.

original commit: 1bb323e256

Reviewed By: AaaChiuuu

Differential Revision: D4109811

fbshipit-source-id: b50de145eaf6851138429635bc0302518d656b75
2016-11-01 15:58:41 -07:00
James Ide 5105c09f56 Fix missing methods in Keyboard module
Summary:
They keyboard module is an instance of `NativeEventEmitter` which is an instance of `EventEmitter`. But the exported module only has a small subset of the APIs. This broke existing codebases which are using the methods not exported currently.

The PR just reassigns the variable before exporting so that the actual module is exported instead of the dummy object used for documentation. It also fixes a layout issue in the documentation.
Closes https://github.com/facebook/react-native/pull/10671

Differential Revision: D4110355

fbshipit-source-id: a6757f3ca8c2494970ba221b10a7e6e9a5f2d64d
2016-11-01 08:58:39 -07:00
James Ide fc11a5fde8 Add support for native animated events on iOS
Summary:
This adds native support for `Animated.event` on iOS.

**Test plan**
Tested in the native animated UIExplorer example that it works properly like on Android.
Closes https://github.com/facebook/react-native/pull/9598

Differential Revision: D4110331

fbshipit-source-id: 15748d23d0f475f2bcd1040ca3dca33e2620f058
2016-11-01 03:58:53 -07:00
James Ide 0fe1c7a9ff Fix symbolication failure caused by attempt to modify frozen frame
Summary:
This change makes so that processing stack trace before sending it to packager (see 7dbc805)
doesn't modify original frames but creates a copies instead.

This is required because after some changes that also have been landed in 0.35, frames that arrive to
'symbolicateStackTrace' are already frozen, so changing 'file' property of the original frame causes
symbolication to fail.
Closes https://github.com/facebook/react-native/pull/10655

Differential Revision: D4110273

fbshipit-source-id: 0302694b520d83a79c3cb67903038b3f494315f2
2016-11-01 02:58:41 -07:00
Janic Duplessis cdd2d791c9 Support static values in NativeAnimated transforms on iOS
Summary:
Support static values (non-animated) in transform config like Android already does.

**Test plan**
Tested in UIExplorer native animated example by adding a transform with a static value and comparing with JS.
Closes https://github.com/facebook/react-native/pull/10664

Differential Revision: D4109515

fbshipit-source-id: 2d7de17d51d6df835c569fd45d2de8fc170bf928
2016-10-31 21:13:41 -07:00
Janic Duplessis 2b49eddcfd Fix initial value of native Animated.Value
Summary:
Native Animated.Value uses the value it was created with when sending the config to native but this causes issue when the value has changed before calling `__makeNative` this happens with the `progress` value for `NavigationExperimental`. It gets initialized with value 1, then uses `setValue` to change it to 0 before starting the animation and this is when `__makeNative` is called. This simply uses the current value instead of the value passed to the constructor. Also pass offset so native implementations that support it can use it (iOS).

**Test plan**
Tested that the first transition that uses the `progress` animated value is not broken in an app that uses `NavigationExperimental` when using `useNativeDriver` for animations.
Closes https://github.com/facebook/react-native/pull/10656

Differential Revision: D4107624

fbshipit-source-id: 921cf4a3422cf91923bc315fd7a15c508becddae
2016-10-31 20:43:44 -07:00
Janic Duplessis 34c7e7610c Fix setAnimatedNodeValue in Native Animated on iOS
Summary:
`setAnimatedNodeValue` currently does not update views if there is no animation currently running. This simply updates the view immediately instead of relying on the animation loop. Extracted it out in a function to be able to use it for native `Animated.event` too.

**Test plan**
Tested this in an app using native driven animations with `NavigationCardStackPanResponder` that makes use of `setValue` to update `Animated.Values` during the back gesture.
Closes https://github.com/facebook/react-native/pull/10643

Differential Revision: D4106346

fbshipit-source-id: 7c639e03ded87058354340f1179f8b75be423e84
2016-10-31 14:28:42 -07:00
Leo Natan 3ac3749ac3 Fix for Unicode decoding issue when using incremental networking.
Summary:
This is **a critical issue**.

The issue arises when incremental networking is enabled from JS by setting `onprogress` or `onload` on an `XMLHttpRequest` object.

The results:

![example1](https://cloud.githubusercontent.com/assets/2270433/18829964/5a54ff30-83e7-11e6-9806-97857dce0430.png)

![example2](https://cloud.githubusercontent.com/assets/2270433/18829966/5bf40a66-83e7-11e6-84e6-9e4d76ba4f8b.png)

Unicode characters get corrupted seemingly in random. The issue is from the way Unicode character parsing is handled in `RCTNetworking.mm`. When incremental networking is enabled, each chunk of data is decoded and passed to JS:

```objective-c
incrementalDataBlock = ^(NSData *data, int64_t progress, int64_t total) {
NSString *responseString = [RCTNetworking decodeTextData:data fromResponse:task.response];
if (!responseString) {
  RCTLogWarn(@"Received data was not a string, or was not a recognised encoding.");
  return;
}
NSArray<id> *responseJSON = @[task.requestID, responseString, @(prog
Closes https://github.com/facebook/react-native/pull/10110

Reviewed By: yungsters

Differential Revision: D4101533

Pulled By: fkgozali

fbshipit-source-id: 2674eaf0dd4568889070c6cde5cdf12edc5be521
2016-10-31 13:13:38 -07:00
Adam Miskiewicz 426e66cfe6 Reverted commit D4099819
Summary:
Now that native animations for opacity and springs have landed in both iOS and Android, we can enable native animations both for TouchableBounce and TouchableOpacity.
Closes https://github.com/facebook/react-native/pull/10583

Differential Revision: D4099819

Pulled By: jingc

fbshipit-source-id: de70f8732b84d4caf0e4adfb2ad0e95b3de5da0f
2016-10-29 13:59:02 -07:00
Adam Miskiewicz 1bb323e256 Use native animations in TouchableBounce and TouchableOpacity
Summary:
Now that native animations for opacity and springs have landed in both iOS and Android, we can enable native animations both for TouchableBounce and TouchableOpacity.
Closes https://github.com/facebook/react-native/pull/10583

Differential Revision: D4099819

Pulled By: lacker

fbshipit-source-id: 247d7bff9a778e520af764f571caf6286b4a5749
2016-10-28 17:58:41 -07:00
Emil Sjolander 8e69a9f695 BREAKING - Make first parameter of measure and print functions CSSNodeRef instead of just context
Reviewed By: javache

Differential Revision: D4081544

fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
2016-10-27 10:58:42 -07:00
Pieter De Baets 19ab84ffb7 Cleanup and simplify view config generation
Reviewed By: fkgozali

Differential Revision: D4083308

fbshipit-source-id: 42ca797a8faede68bd031e84cf1c33a3e3ade37f
2016-10-27 06:58:52 -07:00
Pieter De Baets 384ea330c8 Move Platform constants to RCTPlatform
Reviewed By: majak

Differential Revision: D4081849

fbshipit-source-id: bee08af2f68dcc1af424f382f960ff897ba11945
2016-10-27 04:29:00 -07:00
Konstantin Raev a743fbe73e added semicolon which broke in #8040
Summary:
Fixes internal CI break t14126367 after #8040
Closes https://github.com/facebook/react-native/pull/10589

Differential Revision: D4088099

fbshipit-source-id: a8816e39d795406f59d2a12b9c7fc0fd4ddda69b
2016-10-27 03:13:43 -07:00
Jonathan Stanton e000b71845 Remote notification completion handler
Summary:
**Motivation**
To allow handling of remote notifications using the preferred delegate [application:didReceiveRemoteNotification:fetchCompletionHandler](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler:).

React native right now is setup to use [application:didReceiveRemoteNotification](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:) which doesn't give the engineer the option to call back to the app via a completion handler and inform the app that it is done with handling the push notification.

The primary reason to use the `fetchCompletionHandler` would be to wake up the app to fetch updates so the next time the user opens the app it will be up to date.

A new method will be exposed: `PushNotificationIOS#
Closes https://github.com/facebook/react-native/pull/8040

Differential Revision: D4081766

Pulled By: bestander

fbshipit-source-id: 2819061bd3a926cb1c9c743af5aabab8c0faec3d
2016-10-26 21:43:48 -07:00
d.chernyatiev f64538943e Navigator - Fix wrong scene transformation after pop
Summary:
Fixes #9485
Closes https://github.com/facebook/react-native/pull/9516

Differential Revision: D4080618

Pulled By: lacker

fbshipit-source-id: 296c209a0438c4a06b3b3556d7084c5435d60c72
2016-10-26 00:13:35 -07:00
leeight f9e36a08a8 Make sure xhr req header's value is String type
Summary:
In the `NetworkingModule.java`, `header.getString(1)` was
called, so the value must be String type.

FIX #10198
Closes https://github.com/facebook/react-native/pull/10222

Differential Revision: D4080319

Pulled By: lacker

fbshipit-source-id: 85234a2bbf90e5b9e0e65ceadbfabb330b2d1322
2016-10-25 22:29:35 -07:00
Anthony Sherbondy f930270b00 Fix for TouchableNativeFeedback having Animated.Component direct child
Summary:
Fixes #7996.
Test included.
Not sure this is the best way to go, just a simple solution since the TouchableNativeFeedback is trying to clone the component with a Native component, then seems like it should wrap it with Animated.Component if the incoming child was.
Closes https://github.com/facebook/react-native/pull/10081

Differential Revision: D4073603

fbshipit-source-id: 7827198a3e4697c14e37762cdca93f46a5a1d716
2016-10-25 00:28:37 -07:00
Fada Chen fc6eb51996 fix FlowFixMe in SwipeableQuickActionButton
Reviewed By: fred2028

Differential Revision: D4061448

fbshipit-source-id: 255ae39a16d89d89bbd7fac3bc1dd5350a578d0c
2016-10-24 09:58:53 -07:00
Ryan Gomba d950db4ef7 Add support for springs for NativeAnimated on iOS
Summary:
This diff adds support for native spring animations on iOS. This overlaps some spring work done by kmagiera on the Android side of things.

**Test plan (required)**

Run UIExplorer NativeAnimated examples before and after - compare the results. Pay special attention to the spring examples.
Closes https://github.com/facebook/react-native/pull/9048

Differential Revision: D4056088

Pulled By: foghina

fbshipit-source-id: a593408cb61cb850572bab4a0884f7157cece656
2016-10-21 04:29:03 -07:00
Denis 20598e54c6 Update NavigatorIOS.ios.js
Summary: Closes https://github.com/facebook/react-native/pull/9823

Differential Revision: D4055617

Pulled By: hramos

fbshipit-source-id: ec8d60ce93ead692c324eedf0678e8354202cc93
2016-10-21 02:43:47 -07:00
Ryan Gomba 5794ff61bc Add support for clamping for NativeAnimated on iOS
Summary:
This diff adds support for clamping on iOS. It separates out code originally submitted in #9048.

Test plan (required)

Run UIExplorer NativeAnimated examples before and after - compare the results. Pay special attention to the new clamped spring example.
Closes https://github.com/facebook/react-native/pull/9625

Differential Revision: D4053231

fbshipit-source-id: 29048de444ff5f6d7fe7dce7897399b483ee6d2d
2016-10-20 14:13:38 -07:00
Eric Vicenti f9779e3eb7 Enable native animations when possible
Summary:
The `position` animated value is used for scale, translateX, and tranlateY
animations, which are all supported by NativeAnimatedHelper. Unfortunately,
native animations are incompatible with JS driven animations, which the
`enableGestures` flag enables.

This diff therefore conditionally enables native animations based on the native
module's precense, and the state of `enableGestures`.

Ideally the animations would be refactored so that they could fully leverage
native animations, as they are far superior for navigational components.

Reviewed By: oyvindkinsey

Differential Revision: D4020977

fbshipit-source-id: 8e1d015c4d41fee103469f6f9ffa02ff4f1f5517
2016-10-19 15:28:44 -07:00
Konstantin Raev aee52eb148 Fixed uiexplorer legocastle starting script
Reviewed By: matryoshcow

Differential Revision: D4029497

fbshipit-source-id: 801294409129453c99aad1d4d8f7908548f6c3ef
2016-10-19 08:44:27 -07:00
YUYA FUJIMOTO 2230117f36 Add HorizontalSwipeJumpFromLeft animation to Navigator
Summary:
This brings RN Navigator to add HorizontalSwipeJumpFromLeft animation.
HorizontalSwipeJumpFromRight has been implemented but FromLeft version of SwipeJumpAnimation hasn't been there.
Closes https://github.com/facebook/react-native/pull/10406

Differential Revision: D4035212

fbshipit-source-id: edcbae18148e533b02a7d056de03154fb86280d0
2016-10-18 08:43:41 -07:00
Mehdi Mulani 40e8d8904b RN TextInput: don't let user more than maxLength when TextInput already exceeds it
Summary:
We had a classic integer underflow problem here. Before we would let you type endlessly when the text already exceeded the TextInput maxLength, now we only let you erase characters.

There is still a small problem with the TextInput: how do you handle when the value (set from JS) exceeds the maxLength? This could happen pragmatically, just by passing in a very large value or when changing maxLength (e.g. when changing from 4 to 3 digits in the case of a AMEX security code -> VISA security code).

Me and achen1 discussed firing onChange in these cases and truncating the number manually (to ensure JS's data model) was aware of the change but it seemed fraught with bugs and general weirdness in what the caller would expect to happen.

Reviewed By: javache

Differential Revision: D3991210

fbshipit-source-id: dc401c4a7aefe09fa749cd1168d36343d39dc196
2016-10-18 08:13:41 -07:00
Geordie 73c5360470 NavigatorIOS: stopPropagation on navigationComplete event. Fixes #1241
Summary:
With nested NavigatorIOS components:

```
<NavigatorIOS initialRoute={{
  component: ComponentWithAnotherNavigatorIOSInSubtree
  title: 'xyz'
}}>
```

Navigating (via push etc.) in ComponentWithAnotherNavigatorIOSInSubtree's `navigator` caused an invariant error, making apps with this structure unusable. The reason was that the `navigationComplete` nativeEvent was being propagated to the outer Navigator due to React's automatic event bubbling, making the outer NavigatorIOS incorrectly think it was holding navigation stack state inconsistent with its native UINavigationController.

Concretely, if the outer navigation stack is empty except for its initial state and something is pushed onto the inner stack, the outer NavigatorIOS suddenly complains that it has 2 items on its stack rather than 1. In reality, the outer Navigator still only has 1 item on its stack but the inner Navigator's event (containing information about the inner Navigator) incorrectly bubbles up and reaches the outer Navigator too.
Closes https://github.com/facebook/react-native/pull/9828

Differential Revision: D4030167

Pulled By: ericvicenti

fbshipit-source-id: d04de3d5b70b4862a78610c92701ebdab2b047dd
2016-10-17 10:28:41 -07:00
Cristian Carlesso 6a462fb085 Moving the jest configuration from jest-react-native to react native.
Reviewed By: cpojer

Differential Revision: D3923609

fbshipit-source-id: 62804df81b064871b499ae8c091e13dd1e0f229b
2016-10-17 08:44:05 -07:00
dlowder-salesforce 64a4c6070d Travis CI reliability fixes: preload package manager and increase tim…
Summary:
- Consolidate common code in iOS and tvOS test scripts
- Start the packager before starting tests, to improve reliability
- Increase timeout value in RCTTestRunner.m
Closes https://github.com/facebook/react-native/pull/10378

Differential Revision: D4028364

Pulled By: bestander

fbshipit-source-id: 24c2124a1c62643a02f0668b60a67b971e08d1a3
2016-10-16 15:43:44 -07:00
Jonathan Chen f8b0728d9b Update file for Markdown link syntax
Summary:
Reference: https://daringfireball.net/projects/markdown/syntax#link
Closes https://github.com/facebook/react-native/pull/10416

Differential Revision: D4028353

fbshipit-source-id: 22f396fd0f3942a8429128f2b60341da1d96183c
2016-10-16 15:28:42 -07:00
leeight 9db8910e36 Clean unused import modules.
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.**

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/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/10413

Differential Revision: D4028108

fbshipit-source-id: 99a864dfda578d640f582b296583591415ba26cd
2016-10-16 11:13:40 -07:00
Jacob Parker abb8ea3aea Implement a postMessage function and an onMessage event for webviews …
Summary:
JS API very similar to web workers and node's child process.

Work has been done by somebody else for the Android implementation over at #7020, so we'd need to have these in sync before anything gets merged.

I've made a prop `messagingEnabled` to be more explicit about creating globals—it might be sufficient to just check for an onMessage handler though.

![screen shot 2016-09-06 at 10 28 23](https://cloud.githubusercontent.com/assets/7275322/18268669/b1a12348-741c-11e6-91a1-ad39d5a8bc03.png)
Closes https://github.com/facebook/react-native/pull/9762

Differential Revision: D4008260

fbshipit-source-id: 84b1afafbc0ab1edc3dfbf1a8fb870218e171a4c
2016-10-16 06:43:46 -07:00
Konstantin Raev 6ea26c01de Reverted commit D4027388
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 8e3341b6f393ccf432c1a4e22a7cbf422284a06f
2016-10-16 04:13:42 -07:00
leeight dbfd046145 Change require('invariant') to require('fbjs/lib/invariant')
Summary:
FIX #10400
Closes https://github.com/facebook/react-native/pull/10409

Differential Revision: D4027850

fbshipit-source-id: c69e2ce892d119847902db3d6689ec237df35332
2016-10-16 02:13:52 -07:00
Jan Kassens e58d17e68b React.Element<any> » React.Element<*>
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 5bc178eab1ab72283622b4b7d418f9fd43ec0792
2016-10-15 17:58:38 -07:00
Timur Gibadullin c32ab7e608 Add disabled prop
Summary:
Implemented feature requested in https://github.com/facebook/react-native/issues/10354, updated docs.
The colours were picked from native interface for iOS and from material-ui for android.
Closes https://github.com/facebook/react-native/pull/10398

Differential Revision: D4026189

Pulled By: ericvicenti

fbshipit-source-id: f3316e76f5a4126c07ffcdfb134cd902f40624d5
2016-10-14 19:43:40 -07:00
Tim Yung efcdef711e RN: Stop Deep Linking `ReactChildren`
Reviewed By: sebmarkbage

Differential Revision: D4025469

fbshipit-source-id: 311f9d741101133155395355d8468938435063f7
2016-10-14 18:59:10 -07:00
Tim Yung edecbcddcc RN: Stop Deep Linking `ReactElement`
Reviewed By: sebmarkbage

Differential Revision: D4025461

fbshipit-source-id: bdb35bd8948bf96e791e2c0d567ad6bd42806188
2016-10-14 18:59:10 -07:00
Tim Yung 7263c349c7 RN: Stop Deep Linking `ReactPropTypes`
Reviewed By: sebmarkbage

Differential Revision: D4025448

fbshipit-source-id: 4e9b6ee002a86f638fc57a4bbeb45bf35fabf74c
2016-10-14 18:59:10 -07:00
Tim Yung c4fc13b997 RN: Change `onlyChild => React.Children.only`
Reviewed By: sebmarkbage

Differential Revision: D4025440

fbshipit-source-id: efbcb44dcc89a6059688cf5a00cf28ada8a6a4c4
2016-10-14 18:59:10 -07:00
Tim Yung 331c13d4dc RN: Require {react/lib/ => }ReactNative
Reviewed By: sebmarkbage

Differential Revision: D4024375

fbshipit-source-id: cd2226a3580a7a4ff319d6a93b67b68f2942eb00
2016-10-14 18:59:10 -07:00
Tim Yung c7d68238ec RN: Stop Exporting `Perf` and `TestUtils`
Reviewed By: sebmarkbage

Differential Revision: D4024221

fbshipit-source-id: d35e3dfbff8cc9ce08d34f854b9eb8c79fc1d4af
2016-10-14 18:59:10 -07:00
Tim Yung 421e7880d9 RN: Fix References to ReactComponent / ReactElement
Reviewed By: sebmarkbage

Differential Revision: D4023832

fbshipit-source-id: 6074efe614380119da4f8aa93b47593eeb981fbd
2016-10-14 18:59:09 -07:00
Tim Yung b77b760810 RN: Fix Remaining ReactElement References
Summary: Fixes remaining references to `ReactElement` that did not already have `React` in scope.

Reviewed By: bestander, vjeux

Differential Revision: D4022022

fbshipit-source-id: 4aeacee0cdbb2c825feba10282208316d064c578
2016-10-14 10:45:11 -07:00
Tim Yung e8198aed8d Cleanup: Prefer `React.Element` over `React$?Element`
Reviewed By: vjeux

Differential Revision: D4013049

fbshipit-source-id: 18a447fdbc584418d6a51770363bcd221e7fb7dc
2016-10-14 08:59:37 -07:00
kevyu的马甲 beca25083a fix typo in Alert.js
Summary:
after adding new parameter options in alert method, parameter type is the 5th.
Closes https://github.com/facebook/react-native/pull/10370

Differential Revision: D4021511

Pulled By: javache

fbshipit-source-id: 09476162b879d2081f0c0ac95260e673327871b8
2016-10-14 08:13:55 -07:00
Cristian Carlesso 9ffe2ee0d8 Updating jest to 16.0.1
Reviewed By: cpojer

Differential Revision: D4001464

fbshipit-source-id: cbbf6a9d77605657151c86334fbc03d21f16e5fd
2016-10-13 13:13:46 -07:00
Evgrafov Denis 924c9927d0 Update Modal.js
Summary: Closes https://github.com/facebook/react-native/pull/9825

Differential Revision: D4010331

Pulled By: mmmulani

fbshipit-source-id: 81c0a07716d47429dae8f28d08c9b5b13d30bf26
2016-10-12 21:13:45 -07:00
Tim Yung a3868722f8 Cleanup: Remove `@typechecks`
Reviewed By: spicyj

Differential Revision: D4010629

fbshipit-source-id: b243b2ca09cdfcaeec49b5f6850139d0461b80c5
2016-10-12 19:28:42 -07:00
Gaëtan Renaudeau 0010df514e iOS: Fix CameraRoll to support custom user groups
Summary:
on iOS, if you pull photo from one of user's custom album, the app crashes on the assertion `RCTAssert(resolvedPromise == NO, @"Resolved the promise before we finished processing the results.");` . assertion that was assumed to never been reached.

According to iOS doc, the enumerateGroupsWithTypes `usingBlock` block is called with `group=nil` when the iteration is over, but in current react-native implementation, it is stopping in other circumstance (because the `else` case) which is probably a mistake.

You have probably never seen the bug because you didn't tried to use getPhotos with something else than the pre-defined groups, but it should be possible to do so *(and it seems to work fine as soon as I included my fix. Later I should provide a PR that includes a way to list user groups :) but at least I need this to gets in, otherwise it crashes)*.

For instance, User have a Photo Folder (or "album", whatever you call it) called "Instagram", when I call `CameraRoll.getPhotos({ groupName: "Instagram",
Closes https://github.com/facebook/react-native/pull/10272

Differential Revision: D4009342

Pulled By: javache

fbshipit-source-id: a73ca828133b4f0d880c229f9b675538854020de
2016-10-12 11:28:50 -07:00
Pieter De Baets 8802db3cc0 Update checked-in xcodeproj for RCTHTTPRequestHandler.mm
Reviewed By: majak

Differential Revision: D4009309

fbshipit-source-id: a88021d935a2ac21a220956e77f167c8598eaf1c
2016-10-12 10:58:53 -07:00
leeight c9960817ee Add viewConfig to RCTSlider Component, fix #10158
Summary:
And check componet.viewConfig before call component.setNativeProps method.

FIX #10158
Closes https://github.com/facebook/react-native/pull/10238

Differential Revision: D4008640

Pulled By: javache

fbshipit-source-id: 1bf9b34c0e56f1ffbcd31ae64b3cbafe77a9a1fd
2016-10-12 08:59:05 -07:00
Pieter De Baets 4b7f84aee8 Add lock to RCTHTTPRequestHandler
Reviewed By: mmmulani

Differential Revision: D4001762

fbshipit-source-id: 3a388bbeddeb7b5f6923274137abfc5e20d001b1
2016-10-12 08:59:04 -07:00
Omeid 54f48de48a ios:websocket:exectuor : Grab port from Bundle URL
Summary:
Grabbing the port from Bundle URL allows concurrent Remote JS Debugging using the same machine with running multiple instances of packager on different ports.

This improves the developer experience when developing and debugging cross-platform components.
Closes https://github.com/facebook/react-native/pull/10007

Differential Revision: D4008630

Pulled By: javache

fbshipit-source-id: fcf8495e564fd9ac7baf26a87ed3904898132aa0
2016-10-12 08:43:37 -07:00
leeight ddb1e44b43 Warning: bind(): You are binding a component method to the component
Summary:
Warning: bind(): You are binding a component method to the component.
React does this for you automatically in a high-performance way, so you can safely remove this call. See TouchableOpacity
Closes https://github.com/facebook/react-native/pull/10349

Differential Revision: D4008552

Pulled By: javache

fbshipit-source-id: d98fe9a0d694dee74ea872e51b02fbd75a133e43
2016-10-12 08:28:50 -07:00
David Perrenoud a13b373c94 <br /> doesn't exist in React Native
Summary:
Replace `<br />` with `{'\n'}` in order to provide an example of working line breaks in React Native.
Closes https://github.com/facebook/react-native/pull/10323

Differential Revision: D3995544

Pulled By: JoelMarcey

fbshipit-source-id: 8404db8f23eeb606a5a5ed98ca1b7f9b20917e46
2016-10-11 15:13:46 -07:00
Pieter De Baets 26be005b0a Cancel network requests from the correct queue
Summary: Fix suggested by sooth-sayer (https://github.com/facebook/react-native/pull/10280)

Reviewed By: mmmulani

Differential Revision: D4001618

fbshipit-source-id: cc28d19d02a29b62d2bdbddcd30f94b1c1bcfd76
2016-10-11 12:43:40 -07:00
Pieter De Baets c90bf303c1 Remove queryLayoutByID
Reviewed By: vjeux

Differential Revision: D3987495

fbshipit-source-id: 43a3cc0fb9ea718064e59e988619c39a23cd0c38
2016-10-11 11:43:40 -07:00
Pieter De Baets 292cc82d0e Reorganize core JS files
Reviewed By: lexs

Differential Revision: D3987463

fbshipit-source-id: fa8f1d1bea7ed699120b9705ddc1c83767fcf8e4
2016-10-11 10:14:28 -07:00
Seph Soliman d1f8add4d0 Documentation fix: dx vs. x0
Summary:
> What existing problem does the pull request solve?

Purely a documentation/example error. Was misled/wasted time debugging because of this issue.

Description:
`dx`/`dy` are zero in onPanResponderGrant, not `x0`/`y0`. `x0`/`y0` will be the coordinates relative to the granted element, which are rarely zero.
Closes https://github.com/facebook/react-native/pull/9984

Differential Revision: D4001603

Pulled By: hramos

fbshipit-source-id: 32580795f62394585ccfb8f9a2ae65b0b72add69
2016-10-11 08:13:39 -07:00
Connor McEwen 9a8b5fcf61 Add repeatInterval to PushNotificationIOS
Summary:
This just cleans up the work done in #7219 by adamterlson based on grabbou's feedback
Closes https://github.com/facebook/react-native/pull/10337

Differential Revision: D4001540

Pulled By: javache

fbshipit-source-id: c73b5fef912fa71d1d988dae41094c9c46dc610b
2016-10-11 07:43:52 -07:00
Satyajit Sahoo fa5ad85252 Remove deprecated APIs and modules
Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes https://github.com/facebook/react-native/pull/9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
2016-10-11 07:43:52 -07:00
Pieter De Baets 9ed9bca0bf Lazily instantiate native modules
Summary: Instead of sending a list of modules over to JS on startup (and actually blocking script execution) instead provide a proxy object that constructs each of these lazily.

Reviewed By: lexs

Differential Revision: D3936979

fbshipit-source-id: 71bde822f01eb17a29f56c5e60e95e98e207d74d
2016-10-11 07:28:42 -07:00
Pieter De Baets 606fc11487 Increase laziness in InitializeJavaScriptAppEngine
Reviewed By: davidaurelio

Differential Revision: D3981026

fbshipit-source-id: fa7c0a0e98fb4ddccc61fffbb6644dd3d39b857c
2016-10-11 06:58:56 -07:00
Pieter De Baets d99623fcdc Remove keyMirror usage in JSTimers
Reviewed By: davidaurelio

Differential Revision: D3981015

fbshipit-source-id: 9ce7601038b7cdf8a7feb580380557ed84008397
2016-10-11 06:58:56 -07:00
Pieter De Baets 3137ba993d Cleanup console and ErrorUtils
Reviewed By: davidaurelio

Differential Revision: D3981005

fbshipit-source-id: 3c95e62177f78785c7f971dd632126dbfb83746b
2016-10-11 06:58:55 -07:00
Jing Chen a5698f5cea Override onContentSizeChange prop on ScrollView before rendering
Summary:
We got a report that onContentSizeChange function was being called with an object instead of a number for width, sometimes. Upon debugging, it looked like the param being passed in was a native event wrapper. Tim eventually figured out that this is because there's a TextInput child, and the event bubbles: diffusion/FBS/browse/master/fbobjc/Libraries/FBReactKit/js/react-native-github/Libraries/Text/RCTTextViewManager.m;afbdef32df50$39

Because ScrollView just passes all its props down to the component it eventually renders (RCTScrollView on iOS), the TextInput event bubbles up and triggers the onContentSizeChange prop that was passed in directly, instead of going through the layer in ScrollView that normally unpacks width/height from the native event: diffusion/FBS/browse/master/fbobjc/Libraries/FBReactKit/js/react-native-github/Libraries/Components/ScrollView/ScrollView.js;247ddb2022151b68dd9f83a888b6e0ec9923737a$413-416

Overriding the prop before passing down to RCTScrollView will break that chain, so that the event will continue to bubble but it won't find the incorrect prop from ScrollView.

Reviewed By: yungsters

Differential Revision: D3999689

fbshipit-source-id: d6c3bf711969b3e1c6fc1e51fd44c6894910bc3d
2016-10-11 00:13:39 -07:00
Jeff Thomas de70a622aa Docs improvement
Summary:
In the `Additional Scenes` section, the `TouchableHighlight` component is used, but is not present in the import statement.

This is confusing and results in a `Can't find variable: TouchableHighlight` error.

This PR attempts to correct this confusion.
Closes https://github.com/facebook/react-native/pull/10276

Differential Revision: D3997058

Pulled By: hramos

fbshipit-source-id: 22ebf39cd39d8a76427c89cecc774ff9aef2c3c8
2016-10-10 18:29:03 -07:00
leeight 176f96d7b6 Remove duplicated call from NavigatorSceneConfigs
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.**

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/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/10299

Differential Revision: D3997827

Pulled By: ericvicenti

fbshipit-source-id: a98e112d95015842936a9d2bdc89553772ba49c2
2016-10-10 17:44:28 -07:00
Eric Vicenti 2ae73ffa00 Introduce Button Component
Summary:
Button is an important component to help the community get onboarded with RN quickly, so the first few minutes of a developer's experience is not spent formatting a simple button component.

In my opinion, `<Button />` should be seen as a "lowest common demoniator" component, rather than "the one button to rule them all". In other words, we should only support features in Button that will work on any platform. We should encourage people to fork Button if they need to add specific features to it, rather than trying to twist and bloat this component until it supports everything.

These platform imitations may not have the perfect constants just yet, but they are good enough to make a user feel at home in the app, without any modification. The community can help tweak the final formatting to make them look just right- PRs are welcome!

Reviewed By: frantic

Differential Revision: D3929041

fbshipit-source-id: 3785fb67472a7614eeee0a9aef504c0bdf62ede7
2016-10-10 17:28:39 -07:00
Isak Dunér 770091f3c1 add null check for keyboardFrame variable in KeyboardAvoidingView component
Summary:
This is a critical change and should be pushed to stabel asap

The reason for the pull request is to prevent crashes that can occure if the function relativeKeyboardHeight(keyboardFrame: ScreenRect) got null as an input variable which sometimes does happen.
Closes https://github.com/facebook/react-native/pull/10287

Differential Revision: D3988359

Pulled By: bestander

fbshipit-source-id: 0d1052b590b2684907ea6f7d6b4fe9b89989d4dd
2016-10-08 20:28:42 -07:00
Aaron Chiu 1296cb29eb add flag to enable lazy view managers
Reviewed By: achen1

Differential Revision: D3981171

fbshipit-source-id: 2f6b8370064a5835e2e3636d4c1a7f42cc28ccaf
2016-10-07 05:43:45 -07:00
Domenico Matteo b6719b247d Fix small typo in the help text
Summary:
Not much to add. My OCD spotted this 😄
Closes https://github.com/facebook/react-native/pull/10275

Differential Revision: D3984542

Pulled By: hramos

fbshipit-source-id: 2de8c8f7f5c2c518e0ec5277087095e0553c72d6
2016-10-06 20:28:37 -07:00
Neil Sarkar fea38570ff Fix minor typo in documentation of bottom property - "top" => "bottom"
Summary:
Super minor documentation fix.
Closes https://github.com/facebook/react-native/pull/10278

Differential Revision: D3984539

Pulled By: hramos

fbshipit-source-id: 81559df2173a2471152dc7725bb513a49e6d7c64
2016-10-06 16:58:35 -07:00
Douglas Lowder 8622998335 Apple TV support 2: Xcode projects and CI (scripts/objc-test.sh)
Summary:
* Motivation *

Second PR for Apple TV support.

* Test plan *

Apple TV tests have been added to scripts/objc-test.sh
Closes https://github.com/facebook/react-native/pull/10227

Differential Revision: D3974064

Pulled By: javache

fbshipit-source-id: 36dffb4517efa489e40fa713a30655d1d76ef646
2016-10-05 07:28:44 -07:00
Nader Dabit 91d266ba87 Update ScrollView.js
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.**

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/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/10157

Differential Revision: D3974091

Pulled By: javache

fbshipit-source-id: c756fb82422253bb9098c37fbcb5637e58e53340
2016-10-05 05:05:07 -07:00
Michał Łazowik f77185f27e Fix rest operator syntax errors
Summary:
These are caused by new [syntax checking](1285131e3e/CHANGELOG.md (v6113-2016-10-01)) introduced by babylon.

"The single rest at the end only applies to binding `let { x, ...y } = obj;` and assignment `({ x, ...y } = obj).`"

I'd say this really should be cherry picked into the stable branch.

**Test plan**
1. install babylon@6.11.3
2. see that things break
3. apply patch
4. things work
5. make sure all instances were fixed (I used `\.\.\..*,.*\n.*=` in IntelliJ regex format—find all ... followed by newline followed by =)

Issue #10199
Closes https://github.com/facebook/react-native/pull/10200

Differential Revision: D3974066

Pulled By: javache

fbshipit-source-id: 3f3c1e9df01a3b3bdd61dd3863416c638d3ed98d
2016-10-05 04:43:45 -07:00
sunnylqm 1941450649 no "window" in react native
Summary:
There is no "window" in react native. And by the way fix the indent.
Closes https://github.com/facebook/react-native/pull/10182

Differential Revision: D3974090

Pulled By: javache

fbshipit-source-id: e0e47e15364abff5bcb136d988e234fc8e1f0a8b
2016-10-05 04:43:45 -07:00
pedramsaleh fb355f663d Update TouchableHighlight.js
Summary:
Update to docs to indicate that TouchableHighlight must have exactly one child (i.e. not zero or more than one). Previously it was only indicated that it cannot have more than one.
Closes https://github.com/facebook/react-native/pull/10244

Differential Revision: D3970841

fbshipit-source-id: f1c4c223cfaf150fec9bbae1041567d0c81eb63b
2016-10-04 15:43:36 -07:00
Chace Liang 5eb28dc4f0 RC, fix cant refresh in campaign list view
Reviewed By: hedgerwang

Differential Revision: D3966351

fbshipit-source-id: 20b1621dd26c57f6367f9d2eab0be3661dee1843
2016-10-04 11:43:34 -07:00
Felix Oghina 6d175f2c25 Android: enable foreground ripple
Reviewed By: astreet

Differential Revision: D3932066

fbshipit-source-id: ee2f019cb9ba41e32cbbd8c1cd07c9ed5263fddc
2016-10-03 04:28:46 -07:00
Felix Oghina 8915507244 show touchable feedback for short touches
Summary: Currently, for short touches (under 130ms by default), we don't trigger the highlight effect. This diff makes it so that if we're not highlighted when we invoke onPress, we highlight.

Reviewed By: astreet

Differential Revision: D3932019

fbshipit-source-id: c0ff7d4c646890507ce510f51c279c88aeba66ae
2016-10-03 04:28:46 -07:00
Jeff Morrison 1a9853da37 fbobjc
Reviewed By: gabelevi

Differential Revision: D3949455

fbshipit-source-id: 1cbce4a85fe5b8798496752863bbca64b078aa9c
2016-10-01 11:16:21 -07:00
Alexander Pantyuhov c4ac8b329c StatusBar: barStyle support for Android (API 23+)
Summary:
Android (starting from API 23) supports "light status bar", thus it is possible to extend StatusBar and make `barStyle` property work not only for iOS, but also for Android.

This PR introduces one more `barStyle` option `dark-content` in addition to two existing ones (`default` and `light-content`).
Why there are 3 options instead of 2?

Two simple reasons:
1) to make all existing applications fully compatible with these changes;
2) the default status bar on Android is dark with white text and icons, while on iOS it is light with black text and icons on it. Thus the `default` option means something like "I don't really care, just apply the default color for this platform", while two other options (`light-content` and `dark-content`) allow to accurately specify the required result.
Closes https://github.com/facebook/react-native/pull/10185

Differential Revision: D3952346

fbshipit-source-id: 999a67614abff52321fbeb06298ebf1946c3f1d1
2016-09-30 12:58:37 -07:00
AgtLucas dbc853246d Remove missing link from Modal doc
Summary:
Is okay to remove this link? It seems that we don't have the Navigator Comparison anymore.
Closes https://github.com/facebook/react-native/pull/10186

Differential Revision: D3951863

Pulled By: mmmulani

fbshipit-source-id: 170f4cc9288f84d88c3b607e3a1a85619d9776c8
2016-09-30 11:43:44 -07:00
Andrei Coman 05de4dbb94 Fix inspector on top of Modal
Summary:
Very similar to https://github.com/facebook/react-native/pull/9600.
Does not trigger on DEV, but there are two inspectors: one underneath and one
above the modal. This looks like something we should fix, but the only solution
I've come up with so far was to mangle the event that AppContainer listens to, so that
only the AppContainer in the modal responds to it. This seems pretty ugly, I'd
rather look for something else. Wdyt?

Reviewed By: frantic

Differential Revision: D3937096

fbshipit-source-id: a6e648b6d583088514d6ba8df7851f9a8ef48f74
2016-09-29 04:58:33 -07:00
Felix Oghina 3080b8d26c Android: add support for headless js tasks
Summary: Provide a base `HeadlessJsTaskService` class that can be extended to run JS in headless mode in response to some event. Added `HeadlessJsTaskEventListener` for modules that are interested in background lifecycle events, and `HeadlessJsTaskContext` that basically extends `ReactContext` without touching it. The react instance is shared with the rest of the app (e.g. activities) through the `ReactNativeHost`.

Reviewed By: astreet

Differential Revision: D3225753

fbshipit-source-id: 2c5e7679636f31e0e7842d8a67aeb95baf47c563
2016-09-29 03:58:33 -07:00
Gant Laborde 542ab8643e adds `Keyboard.dismiss()` function and document Keyboard
Summary:
Simple and elegant.  Now someone can dismiss a keyboard in a way that makes sense.

```js
import { Keyboard } from 'react-native'

// Hide that keyboard!
Keyboard.dismiss()
```

+ docs
Closes https://github.com/facebook/react-native/pull/9925

Differential Revision: D3935357

fbshipit-source-id: ecd2fb5c72c4dd769951d308e9bb6ee5d888052a
2016-09-28 18:13:37 -07:00
Mattias Pfeiffer b2dac834fb Use strong reference in RCTImageLoader
Summary:
This PR is related to the multitude of crashes (#10016, #9751, #9882).

From my understanding, we should be using a strong reference when calling `decodeImageData` or we could be calling the method on a deallocated instance.

PR #9751 have mitigated this by adding a fail-safe, but I think the culprint is the weak reference, which this PR fixes.

Tested on iOS only, since it doesn't touch Android.
Closes https://github.com/facebook/react-native/pull/10147

Differential Revision: D3938763

fbshipit-source-id: 7389d4ae7a98926014401a1fe0cbbdcdd5ee6a01
2016-09-28 13:28:35 -07:00
Emil Sjolander c43a3f5d84 Default scrollview to flexShrink to allow views below it
Summary: Changing from flex -> flexGrow on Scrollview caused some layouts to break due to having views below the scrollview. Adding flexShrink allows for the behavior again.

Reviewed By: blairvanderhoof

Differential Revision: D3936963

fbshipit-source-id: 0f43e6f5148918d3d431b98d26d185bbcc1548d0
2016-09-28 10:13:37 -07:00
Andrei Coman 404b7cc069 BREAKING: Fix modal resizing on keyboard show
Summary:
This changes modal behavior to resize when the keyboard appears/disappears.
Previously, the modal would not react in any way, or it would pan above to bring the
TextInput into view. Resizing is the correct behavior for android.

This is not trivial, as in, setting the flag, because of the combination of
react native laying out all views and the system reacting to the keyboard
appearance in a weird way. Namely:
- if `windowTranslucentStatus` is not set, the system will just call
  `onSizeChanged` on the dialog's content view, and everything works nicely
- with `windowTranslucentStatus` set, the system will consider the dialog as a
  full screen view that doesn't resize. In order for it to resize, the base
  view of the layout needs to have
  `setFitsSystemWindows(true)` called on it. This is needed, so that the system
  can call layout on that base view with the new value of `paddingBottom` that
  coincides with the height of the keyboard. Neat.

We fix this by wrapping our existing content view (mHostView) in a simple
FrameLayout that has `setFitsSystemWindows` set. That way, `mHostView` will have
`onSizeChanged` called on itself with the correct new size of the dialog.

This has the fortunate consequence of our layout now also getting `paddingTop` as the size of the
status bar, which means that we can remove the JS `top` hack in Modal, which
was necessary for no view getting drawn under the status bar.

This behavior is set as default, since that is the default correct Android behavior.

Reviewed By: astreet

Differential Revision: D3913784

fbshipit-source-id: 4378ada21f466dc7ac6e357abeca10b88009ca3f
2016-09-28 02:58:37 -07:00
Lord Daniel Zautner 95b1fc42b7 Emit `willfocus` from immediatelyResetRouteStack
Summary:
The Navigator component inconsistently emits the `willfocus` event.

While it is emitted in `Navigator#resetTo`, `Navigator#push`, `Navigator#pop` and event `Navigator#replaceAtIndex` it is not emitted from `Navigator#immediatelyResetRouteStack`. This leads to surprising inconsistencies when working with these events.

With the PR I suggest to emit the `willfocus` event before resetting the route stack.
Closes https://github.com/facebook/react-native/pull/10125

Differential Revision: D3931284

fbshipit-source-id: 6e4f45c6d38426bcd0acc8f8c39478524032a03a
2016-09-27 11:43:32 -07:00
Douglas Lowder d368ebfab2 Apple TV support 1: existing Objective C code should compile for tvOS
Summary:
First commit for Apple TV support: changes to existing Objective-C code so that it will compile correctly for tvOS.
Closes https://github.com/facebook/react-native/pull/9649

Differential Revision: D3916021

Pulled By: javache

fbshipit-source-id: 34acc9daf3efff835ffe38c43ba5d4098a02c830
2016-09-27 06:28:33 -07:00
Kevin Gozali 0a0dd30c6a Introduced AnimatedDivision
Summary:
Combining 2 animated values via addition, multiplication, and modulo are already supported, and this adds another one: division.
There are some cases where an animated value needs to invert (1 / x) another animated value for calculation. An example is inverting a scale (2x --> 0.5x), e.g.:

```
const a = Animated.Value(1);
const b = Animated.divide(1, a);

Animated.spring(a, {
  toValue: 2,
}).start();
```

`b` will then follow `a`'s spring animation and produce the value of `1 / a`.

The basic usage is like this:

```
<Animated.View style={{transform: [{scale: a}]}}>
  <Animated.Image style={{transform: [{scale: b}]}} />
<Animated.View>
```

In this example, the inner image won't get stretched at all because the parent's scaling gets cancelled out.

Also added this to native animated implementation.

Reviewed By: foghina, mmmulani

Differential Revision: D3922891

fbshipit-source-id: 32508956c4b65b2deb7574d50a10c85b4809b961
2016-09-26 16:43:51 -07:00
Ryan Gomba 9462a73189 Value offsets
Summary:
This diff adds support for value offsets on iOS. It separates out code originally submitted in #9048.

Test plan (required)

Set up an animation with an offset, and `useNativeModule: true`. Compare results with `useNativeModule: false`.
Closes https://github.com/facebook/react-native/pull/9627

Differential Revision: D3924410

fbshipit-source-id: 8177a25a5f6b9e33f00ea66143c782aeea24507d
2016-09-26 10:28:35 -07:00
Emil Sjolander 0a9b6bedb3 BREAKING - Fix unconstraint sizing in main axis
Summary:
This fixes measuring of items in the main axis of a container. Previously items were in a lot of cases measured with UNSPECIFIED instead of AT_MOST. This was to support scrolling containers. The correct way to handle scrolling containers is to instead provide them with their own overflow value to activate this behavior. This is also similar to how the web works.

This is a breaking change. Most of your layouts will continue to function as before however some of them might not. Typically this is due to having a `flex: 1` style where it is currently a no-op due to being measured with an undefined size but after this change it may collapse your component to take zero size due to the implicit `flexBasis: 0` now being correctly treated. Removing the bad `flex: 1` style or changing it to `flexGrow: 1` should solve most if not all layout issues your see after this diff.

Reviewed By: majak

Differential Revision: D3876927

fbshipit-source-id: 81ea1c9d6574dd4564a3333f1b3617cf84b4022f
2016-09-26 06:13:56 -07:00
Matej Matiasko 295ee16430 Fix View documentation typo
Summary:
Fix typo in View component documentation.
Closes https://github.com/facebook/react-native/pull/10097

Differential Revision: D3923619

Pulled By: davidaurelio

fbshipit-source-id: ebe63eec8ebdb36cfa7e3f501a214b9e11b17aef
2016-09-26 06:13:55 -07:00
Lord Daniel Zautner 9584480261 Remove unnecessary double test in Navigator
Summary:
_renderScene would unnecessary test if `this.state.transitionFromIndex != null` twice.

The left side and right side of the 'or' statement would always be the same.

For cleaner code I suggest to remove it.
Closes https://github.com/facebook/react-native/pull/10042

Differential Revision: D3923058

fbshipit-source-id: 7466c1f0f24eac3f9f296debd9a5e9f5320aea28
2016-09-26 01:43:41 -07:00
Erik Arvidsson 24c72f513e XMLHttpRequest.getAllResponseHeaders should use CRLF
Summary:
XMLHttpRequest.prototype.getAllResponseHeaders was previously joining
the headers with `\n`. The spec at:

https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method

step 3.2, requires the headers to be joined using `\r\n`.
Closes https://github.com/facebook/react-native/pull/10034

Differential Revision: D3917020

fbshipit-source-id: f4e920f6bebacc3aa5c52c84348157d2b530480f
2016-09-23 16:28:56 -07:00
Erik Arvidsson 1142d9d059 Remove unused/invalid Flow suppression
Summary:
The suppression comment was not formatted correctly and thus not
used.
Closes https://github.com/facebook/react-native/pull/10076

Differential Revision: D3917036

fbshipit-source-id: 92927993fb7223dc131d82096ca92017aea5f1aa
2016-09-23 16:28:56 -07:00