Summary:
This diff enables network inspection for WebSocket APIs, so by now XMLHttpRequest, Fetch and WebSocket are all supported. Android and iOS are both supported.
This diff monkey-patches the RCTWebSocketModule which WebSocket API builds on, and now it is able to intercept all WebSocket requests when app is running. The intercepted information of a WebSocket includes url, protocols, status, messages (sent and received), close reason, server close event and server error information, etc.
Reviewed By: davidaurelio
Differential Revision: D3641770
fbshipit-source-id: 393df0da74ed95b1fd60e38b0d67ed61b3dd5ff3
Summary: In previous `XHRInterceptor`, it sometimes crashes when restarting the network inspector because the id of the XHR objects are not unique all time. Fix this in diff by adding a global id "generator" for all intercepted xhr objects in order to make it safe across inspector restarts.
Reviewed By: davidaurelio
Differential Revision: D3641624
fbshipit-source-id: f9a1589f278023243aa182d3da93ce69c985587c
Summary:
This pull request fixes cases where the `error` argument of the `onUnhandled` method in `Libraries/Promise.js` is undefined. Previously this would result in a redbox with the helpful message: `Cannot read property message of undefined`. With this pull request, unhandled promise rejections result in the desired yellowbox saying that a promise rejection went unhandled.
I still do not know what would cause the error argument to be undefined, but this change makes the module behave as expected in an app I am building.
cc bestander
Relevant issue: #8452
Closes https://github.com/facebook/react-native/pull/9119
Differential Revision: D3655589
Pulled By: bestander
fbshipit-source-id: a975a0ab58701240ba06574c04521cd542700ff7
Summary:
We have a lot of small-ish calls to JSC and within the bridge that add up during TTI. This gives us a way to measure them in aggregate in a reasonable way.
From the comments:
MicroProfiler is a performance profiler for measuring the cumulative impact of
a large number of small-ish calls. This is normally a problem for standard profilers
like Systrace because the overhead of the profiler itself skews the timings you
are able to collect. This is especially a problem when doing nested calls to
profiled functions, as the parent calls will contain the overhead of their profiling
plus the overhead of all their childrens' profiling.
MicroProfiler attempts to be low overhead by 1) aggregating timings in memory and
2) trying to remove estimated profiling overhead from the returned timings.
To remove estimated overhead, at the beginning of each trace we calculate the
average cost of profiling a no-op code section, as well as invoking the average
cost of invoking the system clock. The former is subtracted out for each child
profiler section that is invoked within a parent profiler section. The latter is
subtracted from each section, child or not.
The usage is similar to Systrace: you put a MICRO_PROFILER_BLOCK in the block you want to profile and C++ RAII will handle timing it.
After MicroProfiler::stopProfiling() is called, a table of tracing data is emitted
to glog (which shows up in logcat on Android).
Differential Revision: D3635319
fbshipit-source-id: 01390b8ac76a68dd425cba2adfdde6e4957440cc
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure tests pass on both Travis and Circle CI.
**Code formatting**
Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/9141
Differential Revision: D3650195
Pulled By: hramos
fbshipit-source-id: 2a4bb06f92109b36bec761259e13a5782cc9929b
Summary: We now reach in and use the Scroller directly, reimplementing fling() and onOverScrolled(). I verified that in Android 4.1.2 ScrollView#mScroller exists as a private on ScrollView, but there's still potential that this could break things if OEMs have modified ScrollView so we just log a warning if we can't get access to that field.
Reviewed By: foghina
Differential Revision: D3650008
fbshipit-source-id: e52909bf9d6008f6d1ecd458aee25fe82ffaac19
Summary:
It seems like the `resizeMode` propType was missing from `Image.android.js`, this PR adds it.
I caught by trying to use `Image.propTypes.resizeMode` on Android, and getting a warning because it was `undefined`.
It's not supposed to break anything, maybe pop a few warnings but not much more.
**Test Plan:**
- Launched UIExplorer
Closes https://github.com/facebook/react-native/pull/7355
Differential Revision: D3648559
fbshipit-source-id: a4397938d14c11ded909d6bf4652a4b0fcebed3b
Summary:
On iOS, if `TextInput` is used with prop `multiline={true}`, the backend view is `UITextView`. Sometimes we need `UITextView.dataDetectorTypes` to detect clickable url in the text view. The PR add this prop to `TextInput`, so we can use it like this:
`<TextInput`
` defaultValue="Detect phone number: 88888888."`
` editable={false}`
` multiline={true}`
` dataDetectorTypes="all"`
` />`
Similar as #8743 .
Closes https://github.com/facebook/react-native/pull/8863
Differential Revision: D3648027
fbshipit-source-id: 987bd4f46fb5be74099b62988135a32115d9269c
Summary:
When trying sample code from the _Working with Scenes_ area of this page I see a warning and the example did not appear to work as expected. To fix this I updated the code to static so others following along will not see a warning about using a static property to define defaultProps. Also included is a screen capture of the warning message.
![react-native-warning-defaultprops](https://cloud.githubusercontent.com/assets/1053650/17271580/9d0e85fc-564d-11e6-9c58-f73ef708aade.png)
Closes https://github.com/facebook/react-native/pull/9108
Differential Revision: D3647366
fbshipit-source-id: 93b152756e6351614caf4ae1d5f45bac893fdf7b
Summary:
This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.).
It's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.
<s>This is still WIP and some of the commands are left commented out.</s>
For the `config` of `rnpm` (functions get info about project and dependency), <s>I am thinking we can merge them with</s> we decided to merge it with [`default.config.js`](e57683e420/local-cli/default.config.js (L33)), so they are available on the `new Config()` [instance](e57683e420/local-cli/cliEntry.js (L59)) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e
Closes https://github.com/facebook/react-native/pull/7899
Differential Revision: D3613193
Pulled By: bestander
fbshipit-source-id: 09a072f3b21e5239dfcd8da88a205bd28dc5d037
Summary:
The `clean` task always fail due to the failure of the `cleanReactNdkLib` task, error messages:
```
:ReactAndroid:cleanReactNdkLib
Android NDK: /my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk: Cannot find module with tag 'react' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
make: Entering directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
make: Leaving directory `/my/react-native/ReactAndroid/src/main/jni/react/jni'
/my/react-native/ReactAndroid/src/main/jni/react/jni/Android.mk:31: *** Android NDK: Aborting. . Stop.
:ReactAndroid:cleanReactNdkLib FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ReactAndroid:cleanReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info
Closes https://github.com/facebook/react-native/pull/7935
Differential Revision: D3646120
Pulled By: bestander
fbshipit-source-id: c869ff4a2d3407643fdeec431f454071747eb429
Summary:
Beause I found `Switch` can't work beause the app theme set `showText` to true. It works when the theme is sett to `Theme.AppCompat.Light.NoActionBar`.
Maybe it is necessary to let users knows this and set the default theme to `Theme.AppCompat.Light.NoActionBar`.
Closes https://github.com/facebook/react-native/pull/9086
Differential Revision: D3643082
Pulled By: JoelMarcey
fbshipit-source-id: bcf6e5315753dcde6ce171018999334bcfe2c1ba
Summary:
Since jest stopped using node-haste a while ago, we are the only client left.
This brings back node-haste back to fbsource to allow us to iterate faster.
Reviewed By: bestander
Differential Revision: D3641341
fbshipit-source-id: a859f8834765723a3515e2cf265581b9dd83997c
Summary:
The make current RCTShadowView support RTL layout.
1 Change all left/right to start/end for margin, padding, boarder and position
2 Calculate position in the same way as margin, padding and boarder
Reviewed By: fkgozali
Differential Revision: D3619292
fbshipit-source-id: eaaa6faeee93c964d59bb6f498d89effc09ed567
Summary: Stops the text in 'Reload (R, R)' from wrapping after the comma.
Reviewed By: foghina
Differential Revision: D3641409
fbshipit-source-id: ecbc8ea2935f613559f26e8ace1e9b609ea2ad18
Summary: The new CSSLayout have a wrong calculate for the getRelativePosition. So use the getLeadingPosition will get 0 instead of return undefined. Fix it with using isLeadingPosDefined.
Reviewed By: fkgozali
Differential Revision: D3640799
fbshipit-source-id: 50d3bd2ea4c0d8bf96ba34297425ba269b0535cd
Summary:
The make current RCTShadowView support RTL layout.
Two changes I made:
1 Change all left/right to start/end for margin, padding, boarder and position
2 Change the paddingAsInsets to support RTL
Reviewed By: majak
Differential Revision: D3548002
fbshipit-source-id: 15cc5228d2d28d0e12a7147daf57967e5b87ee63
Summary: Make UIOperation public so that custom implementations can expose instances of it.
Reviewed By: ahmedre
Differential Revision: D3618197
fbshipit-source-id: 89f764818cc2e8e94cf9678814e56e7074eb9067
Summary:
**motivation**
Previously, size can only accept either 'small' or 'large'. And to obtain a custom size, scale transformation is used. This is to let users to possibly pass number value directly to define ActivityIndicator's size.
**Test plan**
I have also modified the current example to reflect the new size prop in action.
Closes https://github.com/facebook/react-native/pull/8935
Differential Revision: D3637910
fbshipit-source-id: 6b8e1d4504964916df327b2d3eaaef1bb8cd5112
Summary:
The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.
Reviewed By: fkgozali
Differential Revision: D3616949
fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
Summary: It sometimes happens that there are already some existing `XMLHttpRequest` objects before we turn on the network inspector. So it is a must to check whether a `XMLHttpRequest` object has a property `_index` to determine if it should be tracked.
Reviewed By: davidaurelio
Differential Revision: D3635184
fbshipit-source-id: a5552d7244c994b0fe782ac35baae39ec7488494
Summary: Mirrors Android's support for multiple sources for Image, allowing us to fetch new images as the size of the view changes.
Reviewed By: mmmulani
Differential Revision: D3615134
fbshipit-source-id: 3d0bf2b75f63a4379e0e49f2dab9aea351b31d5f
Summary:
I noticed that even when a ScrollView's `keyboardShouldPersistTaps` prop is set to true, the ScrollView's children can still respond to tap events (even if the scroll view itself will not respond to tap events and the keyboard does not dismiss automatically). This is a point of ambiguity in the React Native docs; it implies that no touch events can be handled if `keyboardShouldPersistTaps` is set to true.
Closes https://github.com/facebook/react-native/pull/9053
Differential Revision: D3636711
Pulled By: hramos
fbshipit-source-id: 2f0aea86202ab66d5a9174ce8611509dff67e15f