Summary:
When we hit the back button and unmount the ReactRootView, we tell JS to unmount the application root node, which causes JS to asynchronously come back and tell the UIManager to drop the corresponding root view.
This issue was that by the time JS gets back to us, we likely will have already paused the UIManager frame callback which means the view unmounting never actually happens: it just gets stuck in the queue.
The solution is to immediately execute batches when they are enqueued when the frame callback isn't running.
Reviewed By: lexs
Differential Revision: D3398958
fbshipit-source-id: 0de81061a97a119be4cb0b12d6f01c1cec8e8171
Summary:
This PR adds the ability to export videos to the CameraRoll on both Android and iOS (previously only photos were possible, at least on iOS). The API has changed as follows:
```
// old
saveImageWithTag(tag: string): Promise<string>
// new
saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>
```
if no `type` parameter is passed, `video` is inferred if the tag ends with ".mov" or ".mp4", otherwise `photo` is assumed.
I've left in the `saveImageWithTag` method for now with a deprecation warning.
**Test plan (required)**
I created the following very simple app to test exporting photos and videos to the CameraRoll, and ran it on both iOS and Android. The functionality works as intended on both platforms.
```js
// index.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
* flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
CameraRoll,
} from 'react-native';
import FS fro
Closes https://github.com/facebook/react-native/pull/7988
Differential Revision: D3401251
Pulled By: nicklockwood
fbshipit-source-id: af3fc24e6fa5b84ac377e9173f3709c6f9795f20
Summary:
The type key for a layout animation config must be supplied otherwise the app crashes (on Android). I added a isRequired check in JS as well as an explicit exception in java otherwise it crashed at a very hard to debug place. The crash happens when passing null to `Animation.setInterpolator` so this makes sure it never happens.
**Test plan (required)**
Tested that the error is caught properly in JS when passing an invalid animation config like
```
LayoutAnimation.configureNext({
duration: 250,
update: { type: undefined }, // or LayoutAnimation.Types.easeInEastOut in my case haha :)
});
```
Also tested the java exception.
Closes https://github.com/facebook/react-native/pull/7958
Differential Revision: D3401760
Pulled By: nicklockwood
fbshipit-source-id: 83c019d863c2b2294405b60e87297c562add0f49
Summary:
After cleaning up JS SourceMap code, these native methods are not needed anymore.
On iOS it saves another 30+ Mb during development.
Reviewed By: javache, astreet
Differential Revision: D3348975
fbshipit-source-id: a68ae9b00b4dbaa374b421029ae676fc69ae5a75
Summary:
Remove the "Start/Stop" option in RN Android dev menu.
mkonicek talked to Mike Armstrong who originally added this option and he said Traceview didn't end up being used much and Systrace was the preferred way to do profiling, which is used from the command line.
Haven't removed all the codes behind because there are some codes in JNI, including native methods in C++ through the ReactBridge.
Dev menu before:
{F61306550}
Dev menu after:
{F61306553}
Reviewed By: mkonicek
Differential Revision: D3391092
fbshipit-source-id: c400d8bb3c196afa9ef53cda13476e1fec6c2384
Summary: D3352450 didn't handle the case where removeClippedSubviews is on and the indices within the parent view don't match the indices JS is working on
Differential Revision: D3398675
fbshipit-source-id: 0a1b9cf41b02f71f6585db92474e4699b944d273
Summary: Make "double tap R" shortcut enabled when redbox is shown in RN Android, consistent with that in iOS.
Reviewed By: mkonicek
Differential Revision: D3390132
fbshipit-source-id: 48fc40c2ba371a34abcac42a077359d11e907dfc
Summary:
Fixing the WebSocket SendBinary method error. This is a regression caused during recent change.
Closes https://github.com/facebook/react-native/pull/7956
Differential Revision: D3398065
fbshipit-source-id: 5d56eba807b59d1f3265cba5d5f501d610afebf2
Summary:
Reduce the public surface area of TextInput. It only exposes a secureTextEntry property, but on Android was also accepting password as a prop.
This removes that.
Reviewed By: javache
Differential Revision: D3392223
fbshipit-source-id: 67c36fbe16fe493e2841d5d9deb78e3be2209ebd
Summary:
Instead of passing the helper to each method that uses it, just pass it
to the image constructor.
Reviewed By: dmmiller
Differential Revision: D3364532
fbshipit-source-id: 949bdbf951875c9b8cd05d028a2c329e12d72042
Summary:
When using FormData upload images or files, in Android version, network module cannot send an event for showing progress.
This PR will solve this issue.
I changed example in XHRExample for Android, you can see uploading progress in warning yellow bar.
Closes https://github.com/facebook/react-native/pull/7256
Differential Revision: D3390087
fbshipit-source-id: 7f3e53c80072fff397afd6f5fe17bf0f2ecd83b2
Summary:
Implement a handler to allow intercepting all RN redboxes in Android, including exceptions in both JS and Java.
The handler is not open sourced, so there is only an open-source interface called **RedBoxHandler** in //fbandroid/java/com/facebook/catalyst/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/devsupport//, meantime there is an internal class called **FBRedBoxHandler**, which implements **RedBoxHandler** and is located in //fbandroid/java/com/facebook/fbreact/redboxhandler//, actually handles the exception information.
The code structure is as follows:
- **AdsManagerActivity** has a member variable of **FBRedBoxHandler**.
- **AdsManagerActivity** passes this handler all the way down to the **DevSupportManagerImpl**, through** ReactInstanceManager**, **ReactInstanceManagerImpl**, **DevSupportManagerFactory**.
- **DevSupportManagerImpl** intercepts the exceptions just before showing the redboxes, like this:
mRedBoxDialog.setExceptionDetails(message, stack);
mRedBoxDialog.setErrorCookie(errorCookie);
if (mRedBoxHandler != null) {
mRedBoxHandler.handleRedbox(message, stack);
}
mRedBoxDialog.show();
By now, the internal class just prints information for each redbox to logcat, including exception message and stack trace.
Reviewed By: mkonicek
Differential Revision: D3369064
fbshipit-source-id: 199012c4b6ecf4b3d3aff51a26c9c9901847b6fc
Summary:
Issue reported here
https://github.com/facebook/react-native/issues/7755#issuecomment-222950463
Converting int to Integer explicitly and not cancelling the call more than once
should fix it.
Reviewed By: bestander
Differential Revision: D3371238
fbshipit-source-id: cb00663b4ca19a788bd27b971b6447cc0788a818
Summary: These will, eventually, need to be moved to the new bridge and so must become standalone things. For *NativeArray, this is almost just moving them out into their own .h/.cpp files. The *NativeMaps are updated to be hybrids instead of countables (in addition to getting their own .h/.cpp).
Reviewed By: mhorowitz
Differential Revision: D3325169
fbshipit-source-id: 40cfcab92b3fb2310bcd4de8f39e82f85d404abd
Summary:
Just rename and rearrange the dev menu options in Android, so as to be consistent with those in iOS.
{F61192593} {F61192595}
{F61192594} {F61192597}
There are other issues to solve on the inspector and profiling in Android, so I just ignore them for now.
Reviewed By: mkonicek
Differential Revision: D3361415
fbshipit-source-id: ffa823a0c54a27f7918e4e43ecea3c845d2a2f90
Summary:
1. Make "Remote JS Debug" and "Start/Stop Profile" options persist across app restarts.
2. Check and confirm:
- All options in the Android dev menu are persisted now.
- The behavior is the same on Android and iOS now.
Reviewed By: mkonicek
Differential Revision: D3340097
fbshipit-source-id: 4087b6605031c650e164282244cedb006f8f6fd3
Summary:
As for symbolicated stack trace in the red box in Android, make column number not shown if it's zero.
Format Before:
{F61180667}
Format After:
{F61180666}
Reviewed By: mkonicek
Differential Revision: D3358317
fbshipit-source-id: 87981e678e22ab9f483727002175c8835941ceee
Summary:
When the activity hosting a Modal goes away, we should dismiss the dialog from the stack and then reconstitute it when the activity comes back. This means that if an activity is paused because another activity is placed on top of it but our ui operation was delayed, it will not blow up finding no window since it is gone.
Also fixes a place where we should remove a listener for lifecycle events which we were not doing.
Reviewed By: halfjuice
Differential Revision: D3357286
fbshipit-source-id: c5c6dd8e5ef299762ed9aa15a6910ce9c0b111dc
Summary:
The API for `ActivityIndiatorIOS` and `ProgressBarAndroid` is very similar and can be merged in a cross platform component that displays a circular indeterminate loading indicator.
This deprecates `ActivityIndiatorIOS` and non-horizontal `ProgressBarAndroid` in favor of this new component.
**Test plan (required)**
Tested with the ActivityIndicator example in UIExplorer on android and ios. Also made sure that `ActivityIndicatorIOS` still works and displays a deprecation warning. Also tested that `ProgressBarAndroid` with `indeterminate == true` and `styleAttr != 'Horizontal'` displays a deprecation warning.
Closes https://github.com/facebook/react-native/pull/6897
Differential Revision: D3351607
Pulled By: dmmiller
fbshipit-source-id: b107ce99d966359003e8b3118cd97b90fa1d3d7d
Summary:
- TestIdTestModule instrumentation tests is responsible for too many occasional crashes, e.g. https://circleci.com/gh/facebook/react-native/7054.
This should fix the problem (will monitor over next week)
- Made file naming more consistent
- 5 retries don't make e2e tests more stable, reduced back to 3 but I need to investigate how to make it more reliable
Closes https://github.com/facebook/react-native/pull/7784
Differential Revision: D3354444
fbshipit-source-id: d058362edbec09522a4828998e01988a82a74487