Summary: It's called `timestamp` on iOS, making it consistent.
Reviewed By: foghina
Differential Revision: D3820937
fbshipit-source-id: 2805f1fc10d6445d8b31676e0e3dca348510ffe7
Summary: Casting to long too early here and dropping some precision, resulting in skipped (not dropped) frames.
Reviewed By: sahrens
Differential Revision: D3819153
fbshipit-source-id: 83676cf4c9129638348890c74d563db121049e4a
Summary: Cleans things up and also defers rendering rows if there is an interaction happening.
Reviewed By: achen1
Differential Revision: D3817231
fbshipit-source-id: fd08d0ca7cb6c203178f27bfc5a0f55469135c3a
Summary:
Add native support on iOS and Android for `Animated.diffClamp` that was added in #9419.
**Test plan**
Tested that it works properly using the native animations UIExplorer example.
Closes https://github.com/facebook/react-native/pull/9691
Differential Revision: D3813440
fbshipit-source-id: 48a3ecddf3708fa44b408954d3d8133ec8537f21
Summary:
Adds support for the `extrapolate` parameter on the native interpolation node. This is pretty much a 1 to 1 port of the JS implementation.
**Test plan**
Tested by adding the `extrapolate` parameter in the native animated UIExplorer example.
Closes https://github.com/facebook/react-native/pull/9366
Differential Revision: D3824154
fbshipit-source-id: 2ef593af827a8bd3d7b8ab2d53abbdc9516c6022
Summary:
This is an updated version of #2336 and #7694.
---
This adds a `registrationError` event that is emitted by `PushNotificationIOS` whenever an application receives a registration error from APNS (APNS service failure, running on simulator, etc). This event fires to the exclusion of the `register` event (and vice versa).
**How to use**
Add the following to your `AppDelegate.m`:
```obj-c
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
}
```
And register an event handler for the event:
```js
PushNotificationIOS.addEventListener('registrationError', function({ message, code }) {
// Complete your registration process in error.
});
```
**Test plan**
Added support for this event (and `register`) to UIExplorer as a proof of concept. Navigating to the push notifications example on a simulator is an easy way to reproduce this e
Closes https://github.com/facebook/react-native/pull/9650
Differential Revision: D3822142
Pulled By: javache
fbshipit-source-id: a15ed8941b74dc3eed2c44c658deccbcaf39ce3d
Summary:
ReactRootView currently intercepts and swallows all
`requestDisallowInterceptTouchEvent` calls, which made sense when the
ReactNativeView was the root of all views. In the context of react native views
embedded in other views though, we want to propagate the call to all parents
views, but not set it on the ReactRootView itself (because we still need the
`onInterceptTouchEvent` calls to dispatch the touch events to JS).
Reviewed By: foghina
Differential Revision: D3819255
fbshipit-source-id: 21f2dd173c76e98342193de384292fef2b407250
Summary:
This diff changes the textinput component to only scroll (and interrupt parent
views from scrolling), when it is possible for the text inside the component to
be scrolled. Before (D3735237), we would intercept all touch events on the
textinput if it's focused. But this makes it: a.) impossible to scroll a scrollview from within
a textinput that cannot be scrolled; b.) different from iOS behavior.
What the component now does is intercept move touches, and check if it can
scroll in any direction. If it does, it will intercept the touches and stop the parent
component from scrolling; otherwise, it will give the control back to the parent
component.
Note: this might change in the future to also detect the direction of the scroll, and
only block the scroll if the component can scroll in that direction. This is however not
trivial, since the scroll needs to be above some threshold of pixels. Blocking the
parent view from scrolling until that threshold is passed might cause incorrect behavior
in the parent component.
Reviewed By: astreet
Differential Revision: D3764267
fbshipit-source-id: 47e7b5e03855b3c85789e04fc31a8317afbafa84
Summary:
Include CSSLayout headers in the same way as other project headers, ie `#import <CSSLayout/CSSLayout.h>` becomes `#import "CSSLayout.h"`. CSSLayout is not a framework or system dependency, so shouldn't (AFAIK) be included with angle brackets. Doing so breaks framework builds, such as when RN is used as a pod in a swift project.
In combination with https://github.com/facebook/css-layout/pull/217 this fixes https://github.com/facebook/react-native/issues/9014 (specifically swift cocoapods projects). There is then no need for a separate CSSLayout pod subspec.
Tests run on the RN project in isolation (with changes inside `CSSLayout` itself also applied) and against a dummy swift project with RN included as a pod.
NB: This effectively reverts https://github.com/facebook/react-native/pull/9015 and may break non-swift cocoapods projects unless https://github.com/facebook/css-layout/pull/217 is merged and synced first.
Update: As discussed with alloy and emilsjolander, wrap these imports in a preprocess
Closes https://github.com/facebook/react-native/pull/9544
Differential Revision: D3821791
Pulled By: javache
fbshipit-source-id: d27ac8be9ce560d03479b43d3db740cd196c24da
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Fix issue with browser and react-native module mappings in node-haste when running the packager from Windows.
**Test plan (required)**
Tested on the NPM package uuid, which has a browser mapping, and it worked.
Fixes#9570
Closes https://github.com/facebook/react-native/pull/9572
Differential Revision: D3821761
Pulled By: davidaurelio
fbshipit-source-id: ebbd91f9e3215385afe3b81a97a962b45a6286f9
Summary:
This adds the `didUpdateDimensions` event that already exists on iOS, and
updates the internal native dimensions data that needs repopulation after
orientation change.
Reviewed By: foghina
Differential Revision: D3819364
fbshipit-source-id: fc2b3b4d1991d101e5de4439ccef2189bc65fd58
Summary:
At the moment the run-ios command from the react-native cli does only work for simulators.
The pull request adds a new option to the existing command: **"--device 'device-name'" which installs and launches an iOS application on a connected device.**
This makes it easier to build a test environment using react-native for connected devices.
I've tested my code with the following commands:
react-native run-ios --device "Not existing device"
react-native run-ios --device
react-native run-ios --device "name-of-a-simulator"
react-native run-ios --device "name-of-connected-device"
Output of the first three commands:
![example_error_output](https://cloud.githubusercontent.com/assets/9102810/17669443/f53d5948-630d-11e6-9a80-7df2f352c6a3.png)
Additional to the manual command tests i've added a test file 'parseIOSDevicesList-test.js'.
I used **ios-deploy** In order to launch and install the .app-bundle on a connected device.
ios-deploy on github:
Closes https://github.com/facebook/react-native/pull/9414
Differential Revision: D3821638
Pulled By: javache
fbshipit-source-id: c07b7bf25283a966e45613a22ed3184bb1aac714
Summary:
Currently, when reloading uiexplorer, it does not go back to the last visited
component. This fixes it, by only storing the state (which contains the last
visited component), after it has been set.
Reviewed By: bestander
Differential Revision: D3821288
fbshipit-source-id: 5b9ba10765ce402c20016519a3b7f6b5211cc623
Summary:
First of all,please forgive my poor english. LOL
When I use Promises as callBack,
I followed the guide to make a (RCTPromiseRejectBlock),in this RCTPromiseRejectBlock,
from the guide I should add a (NSString)code a (NSString)message and an (NSError) to a RCTPromiseRejectBlock.
As what did guide said I just make a NSError with
```
NSError *error=[NSError errorWithDomain:@"native stroage error" code:402 userInfo:@{@"data":key}];
```
As you can see, I want to transfer some data in this callback.But I just found the (userInfo) of NSError didn't composed to a RCTPromiseRejectBlock.
So I check out the source code of RCTUtil ,I found this
```
// TODO: Can we just replace RCTMakeError with this function instead?
NSDictionary<NSString *, id> *RCTJSErrorFromCodeMessageAndNSError(NSString *code,
NSString *message,
NSError *__nullable error)
{
NSString *errorMessage;
Closes https://github.com/facebook/react-native/pull/9519
Differential Revision: D3821334
Pulled By: javache
fbshipit-source-id: 0fa40dd93932af70123b8f8a20a5c7dc5afdd6ac
Summary:
When I use local static files as Image resources, it will occur a 404 error if the image file's name contains some non-latin letters.
The reason is that the request's url will be encoded if it contains some non-latin letters.
Closes https://github.com/facebook/react-native/pull/9604
Differential Revision: D3821328
Pulled By: javache
fbshipit-source-id: bfdc7f71517b5d4ba9e0a013979e5dcf6c31a237
Summary:
Landing D3528215 again, now that D3593884 has landed and makes that easier.
Copy-paste summary from previous diff:
So PanReponder.onPanResponderRelease/onPanResponderTerminate receive a
gestureState object containing a onPanResponderTerminate.vx/vy property. On
Android and iOS, they appear to be orders of magnitude different, which appear
to be due to the different scale of timestamps that are used when generating
touch events.
This pull request fixes the timestamps to be milliseconds on both platforms
(since I assume iOS is the more authoritative one, and is the one that
react-native-viewpager's vx thresholds written written to compare against.)
As far as I can tell, the RN code doesn't use the vx/vy properties, so they
should be okay. And looks like the RN code only cares about relative values of
startTimestamp/currentTimestamp/previousTimestamp though, so should be fine too.
it's quite possible there will be downstream android breakage with this change,
particularly for those who are already compensating for the RN discrepancy.
Reviewed By: foghina
Differential Revision: D3819761
fbshipit-source-id: fd2d85748ae6a9cde6af715aabb620f340c2220c
Summary:
Currently, when sharing local files, the file contents are being sent as NSData causing the file to never be attached when sharing via Email or via Airdrop, being renamed to something obscure such as (null)-257D026032E9-1.data
Simply passing the Local File URL to UIActivityViewController instead of the file contents resolves this issue.
More info on this issue: https://github.com/facebook/react-native/issues/8442
Closes https://github.com/facebook/react-native/pull/9693
Differential Revision: D3821142
Pulled By: javache
fbshipit-source-id: a06128db88d24cf5565169f321365ace43ab89fe
Summary:
Similar to iOS, send device orientation changes events. This does not have the
`getCurrentOrientation` method, because it's not used. If necessary, we'll
add it separately.
This also adds a simple example for testing.
We listen to orientation changes in `onGlobalLayout`, and check if the rotation of the device has changed. If it has, we emit the event.
But:
- `onGlobalLayout` (and `onConfigurationChanged` - which is the method usually used for checking for device orientation changes) is *not* called when the device goes from landscape
to reverse landscape (same with portrait), as that is not a relayout / configuration change. We could detect if this happens with the help of an `OrientationEventListener`. However, this listener notifies you if the degree
of the phone changes by a single degree, which means that you need to know by how many degrees the phone needs to change in order for the orientation to change. I haven't looked into how accurate this could be, but I suspect that in practice it would cause a lot of bugs. A simple `abgs` and google search reveals that everybody uses a different margin for detecting a rotation change (from 30 to 45 degrees), so I suspect that this won't work
as expected in practice. Therefore, we're not using this here, and we're sticking to what android provides via `onConfigurationChanged`. If we find that we have issues because users need to know when the user goes
from landscape to reverse landscape, then we'll have to revisit this.
Reviewed By: foghina
Differential Revision: D3797521
fbshipit-source-id: 62508efd342a9a4b41b42b6138c73553cfdefebc
Summary:
This fixes some inaccuracies in our reporting of textinput's contentsize.
First, we were not using the correct padding info. Then, we are converting the
contentSize width and height to ints right before sending
them over to JS. This adds some inaccuracy with the textinput behaviour,
especially in the case of auto expending text inputs, since those same sizes are
then sent right back.
Reviewed By: astreet
Differential Revision: D3806008
fbshipit-source-id: 7e32f91fde50099fd8a122833fd0042683e68df1
Summary:
Currently when doing a file upload, the Content-Type header gets set to whatever MIME type iOS computed for the file. The Content-Type header the developer provided never takes precedence.
For example, when uploading an image, iOS might determine that the MIME type is "image/jpeg" and so this would be the Content-Type of the HTTP request. But the developer might need the Content-Type to be "application/octet-stream". With this change, if the developer provides a Content-Type header, it will not be overriden.
There is only one exception to this rule which is for "multipart" requests. In this case, the developer's Content-Type header is always ignored. This is because the Content-Type header needs to contain the boundary string and that information is not available to the developer in JavaScript.
This change makes iOS's behavior more consistent with Android's.
**Test plan (required)**
In a small test app, verified that the developer's Content-Type header takes precedence when it's provided. Verif
Closes https://github.com/facebook/react-native/pull/9651
Differential Revision: D3820001
Pulled By: mkonicek
fbshipit-source-id: fdb8871f88a0d0db1ae59f75bb62b896fe69542d
Summary:
This fixes an issue that would have arised once our number of blog posts passed 10, as the prev/next links in the footer were using the wrong path ("jest/", instead of "react-native/").
I also capped the number of recent blog posts to 10 in the sidebar.
Closes https://github.com/facebook/react-native/pull/9670
Differential Revision: D3819973
Pulled By: mkonicek
fbshipit-source-id: 321fe99654e10a4ad3e0815540518c8e9202385f
Summary:
Should help people with less xcode experience.
Closes https://github.com/facebook/react-native/pull/9748
Differential Revision: D3819960
Pulled By: mkonicek
fbshipit-source-id: 2d73611a5ed7261c95eded2f3e20eeb660527cdc
Summary:
Update documentation for Switch as it's not a background color that is displayed when the switch off, but juste the border (the background remains transparent)
Closes https://github.com/facebook/react-native/pull/9707
Differential Revision: D3819887
Pulled By: mkonicek
fbshipit-source-id: 218fd20deaded5260cc51e815b559f3cbbb3f752
Summary:
There's no codementor app, neither Android nor iOS, so I believe it should not exist in the showcase. Furthermore, the article linked doesn't even mention react native. Not sure how this got added, but I think it should be removed as it undermines the credibility of the showcase page by being there.
Closes https://github.com/facebook/react-native/pull/9744
Differential Revision: D3819328
Pulled By: mkonicek
fbshipit-source-id: d76fdb0fd3b644e25313b32d030d85071f88e276
Summary:
Android PR for TextInput selection, based on the iOS implementation in #8958.
** Test plan **
Tested using the text selection example in UIExplorer.
Closes https://github.com/facebook/react-native/pull/8962
Differential Revision: D3819285
Pulled By: andreicoman11
fbshipit-source-id: 9a2408af2a8b694258c88ab5c46322830c71452a
Summary: Activity events now have a `silent` boolean option that specifies whether or not the event phases are to be logged to the console. Defaults to `false`, preserving current behaviour for events that do not explicitly have this option set.
Reviewed By: davidaurelio
Differential Revision: D3810802
fbshipit-source-id: 38d14b9e6c6502fbc73eece9466f20b60d19965e