Summary:
This diff attempts to fix a number of iOS native animation bugs related to improper node invalidation and a race with view creation. The major issues were presented in #9120 as problems 3 and 3b, but I'll recap here:
The invalidation model we use is overly complicated and incomplete. The proper combination of `_needsUpdate` and `_hasUpdated` will result in nodes values being recomputed. However, we do not invalidate nodes in all the places we should, e.g. if we create a new view and attach it to an existing value node (see example in #9120). This diff chooses to remove the `_hasUpdated` flag, and simply relies on the `_needsUpdate` flag to mark a node as dirty.
We mark nodes as dirty when they are:
- created
- updated
- attached to new parents
- detached from old parents
- attached to a view
Calling `updateNodeIfNecessary` will, if necessary, compute all invalidated parent values before recomputing the node value. It will then apply the update, and mark the no
Closes https://github.com/facebook/react-native/pull/10663
Differential Revision: D4120301
Pulled By: mkonicek
fbshipit-source-id: e247afcb5d8c15999b8328c664b9f7e764d76a75
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?
Just fixed a typo.
Feel free to make the change directly in the repo without my credit if the process is easier than accepting this PR.
Closes https://github.com/facebook/react-native/pull/11164
Differential Revision: D4236963
Pulled By: mkonicek
fbshipit-source-id: 72c059596216602f9ab30dea6eb5f9cdbf89d31b
Summary:
When using text inputs inside a ScrollView with `keyboardShouldPersistTaps=false` (default behavior) tapping another text input dismisses the keyboard instead of keeping it open and focusing the new text input which I think is the better and expected behavior.
See #10628 for more discussion about that. Note that this affects nothing but the behavior with text inputs unlike #10628.
cc satya164 MaxLap ericvicenti
Closes https://github.com/facebook/react-native/pull/10887
Differential Revision: D4178474
Pulled By: ericvicenti
fbshipit-source-id: 0c62ea2fac0017d559d1f8674b0a686a5e1b3d2d
Summary:
This exposes iOS's spellCheckingType functionality to JavaScript. The native functionality is a three state enum. It gets exposed to JavaScript as a boolean. The initial value and JS null map to the third state.
An alternative design for this API would have been to expose a three state enum to JavaScript:
- "on" which maps to UITextSpellCheckingTypeYes
- "off" which maps to UITextSpellCheckingTypeNo
- "auto" (default) which maps to UITextSpellCheckingTypeDefault
For consistency, I decided to use the same API design as spellCheck. We don't have many options for fixing spellCheck in #11055 without introducing a breaking change.
**Test plan (required)**
Verified that switching `spellCheck` between `true`, `false`, and `null` all work correctly in single line and multiline `TextInputs`.
Closes https://github.com/facebook/react-native/pull/11056
Differential Revision: D4232802
Pulled By: javache
fbshipit-source-id: 79e03307fa6a30a169f7e2fd0ec5ac826663e7c1
Summary:
This PR seeks to improve the documentation of PushNotificationIOS.
The method didReceiveRemoteNotification without a fetch completion handler is deprecated by Apple and they [discourage using it](https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623117-application) in favor of the [version with the handler](https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623013-application).
Reasons for this change:
1. Our docs say that this method is required for remote notifications, but it's not. (It's one of possibilities with a recommendation not to use it.)
2. The method is deprecated by Apple and people shouldn't use it.
3. If you use the deprecated method, in 99% of the cases it will behave in a different way from what you'd expect. In particular, you won't get remote notifications when your app is in the background.
As there's no benefit (as far as I know) of using the method, I don't think we should even mention it to the users.
This is a re-opened PR that was mis
Closes https://github.com/facebook/react-native/pull/11109
Differential Revision: D4232800
Pulled By: javache
fbshipit-source-id: d3b509db41a549aa7fbc41753c648085df43d8ee
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.
It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.
Reviewed By: matryoshcow
Differential Revision: D4231208
fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
Summary:
To make React Native play nicely with our internal build infrastructure we need to properly namespace all of our header includes.
Where previously you could do `#import "RCTBridge.h"`, you must now write this as `#import <React/RCTBridge.h>`. If your xcode project still has a custom header include path, both variants will likely continue to work, but for new projects, we're defaulting the header include path to `$(BUILT_PRODUCTS_DIR)/usr/local/include`, where the React and CSSLayout targets will copy a subset of headers too. To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".
Reviewed By: mmmulani
Differential Revision: D4213120
fbshipit-source-id: 84a32a4b250c27699e6795f43584f13d594a9a82
Summary:
Expose aspectRatio style prop from css-layout to React Native.
This means the following will now work:
<View style={{backgroundColor: 'blue', aspectRatio: 1}}/>
Reviewed By: javache
Differential Revision: D4226472
fbshipit-source-id: c8709a7c0abbf77089a4e867879b42dcd9116f65
Summary:
On Android, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), Android may choose to have the user edit the text inside of a full screen text input mode. This behavior isn't always desirable. For example, if your app offers some UI controls for controlling the formatting of the text, you want the controls to be visible while the user is editing the text. This Android feature conflicts with that desired experience because the UI controls would be hidden while the text is being edited.
The `disableExtractUI` prop enables developers to choose whether or not Android's full screen text input editing mode is enabled. When this prop is true, Android's `IME_FLAG_NO_EXTRACT_UI` flag is passed to the `setImeOptions` method.
**Test plan (required)**
Verified `disableExtractUI` works for both `true` and `false` values in a test app.
My team is also using this change in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/10900
Differential Revision: D4226483
Pulled By: mkonicek
fbshipit-source-id: 8f1055f6e612b05bafabe6f07a3705dd8788e3da
Summary:
There's an inconsistency in autoCorrect's default state:
- If you don't specify a value for autoCorrect, it defaults to on.
- If you specify true/false for autoCorrect and later specify null, autoCorrect turns off. It should have reverted to its initial state of on.
The reason for this discrepancy is that autoCorrect is exposed to JS as a boolean but it is actually an enum with three states in native:
- UITextAutocorrectionTypeDefault (the default value)
- UITextAutocorrectionTypeYes
- UITextAutocorrectionTypeNo
This is fixed by explicitly mapping JS null to UITextAutocorrectionTypeDefault.
**Test plan (required)**
Verified that switching `autoCorrect` between `true`, `false`, and `null` all work correctly in single line and multiline `TextInputs`.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/11055
Differential Revision: D4226419
Pulled By: javache
fbshipit-source-id: e3e5769a3aa537f00fb56ca4ae622ff4213481c5
Summary:
When native events where handled they were not sent to JS as an optimization but this caused some issues. One of the major one is touches are not handled properly inside a ScrollView with an Animated.event because it doesn't receive scroll events so it can't cancel the touch if the user scrolled.
Closes https://github.com/facebook/react-native/pull/10981
Differential Revision: D4226403
Pulled By: astreet
fbshipit-source-id: 41278d3ed4b684af142d9e273b11b974eb679879
Summary:
Corresponding Android PR: https://github.com/facebook/react-native/pull/11001
This adds an onScroll event to TextInput which is useful when a multiline TextInput has so much content that it is scrollable.
**Test plan (required)**
Verified the event works properly in a test app. Also, my team uses this event in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/11002
Differential Revision: D4203565
Pulled By: ericvicenti
fbshipit-source-id: 7cb5e10325c3b03c6b395cce0f1bacb0528db40a
Summary:
When running in strict mode we run into the following error:
“Cannot assign to read only property 'product' of object '#<WorkerNavigator>’”
Moreover navigator.product = ‘ReactNative’; didn’t actually change the product value. Without strict mode this was silently ignored.
By using our defineProperty function we are able to run in strict mode and now navigator.product is really ReactNative.
See https://github.com/facebook/react-native/issues/10881 for more information
---------------
Long story short - if we run in strict mode, the current code throws an error :
`Cannot assign to read only property 'product' of object '#<WorkerNavigator>' initializeCore.js`
(the current version of initializeCore.js doesn't have 'use strict'; on top, but if you are unfortunate enough to have a babel module that ads this for you, you are guaranteed to run into this. Moreover our contributing guidelines say that we should have 'use strict'; https://github.com/facebook/react-native/blob/master/CONTRIB
Closes https://github.com/facebook/react-native/pull/11057
Differential Revision: D4219958
Pulled By: javache
fbshipit-source-id: 35568b2ce4b87fff1aa8248f067d49e5f9f9e9a2
Summary: Correct header import paths, update podspec so we point at the copy in ReactCommon (and can eventually remove the copy under React)
Reviewed By: astreet
Differential Revision: D4204501
fbshipit-source-id: e979a010092f025b2cdc289e1e5f22fc7b65a8d1
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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