Summary:
Corresponding iOS PR: #12275
Respect the withCredentials XMLHttpRequest flag for sending cookies with requests. This can reduce payload sizes where large cookies are set for domains.
This should fix#5347.
This is a breaking change because it alters the default behavior of XHR. Prior to this change, XHR would send cookies by default. After this change, by default, XHR does not send cookies which is consistent with the default behavior of XHR on web for cross-site requests. Developers can restore the previous behavior by passing `true` for XHR's `withCredentials` argument.
**Test plan (required)**
Verified in a test app that XHR works properly when specifying `withCredentials` as `true`, `false`, and `undefined`. Also, my team uses this change in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12276
Differential Revision: D4673646
Pulled By: ericvicenti
fbshipit-source-id: 924c230c9df72071b3cf9151c3ac201905ac28a5
Summary:
Adds functionality to be able to disable saving of form data and thereby disabling autocomplete in webview on Android. Can be used as a workaround for #13241
Manual testing that autocomplete is disabled when the property is set to true, and still enabled when it is unset or set to false.
Closes https://github.com/facebook/react-native/pull/13271
Differential Revision: D4858899
Pulled By: ericvicenti
fbshipit-source-id: 62738b0685e4c1958c8a32e184fa2fe4f711b336
Summary: View tags are currently used for end-to-end test IDs. We'd like to overload the tag field with other information such as nativeID (for native refs) and transitionID (for shared element transitions) in the future. Added a key for testID's tag
Reviewed By: AaaChiuuu
Differential Revision: D4833045
fbshipit-source-id: c2f9371c9a3dbb2411e114f4f096f723ac3132c0
Summary:
Use `getChildDrawingOrder` instead of reordering views. The old implementation didn't work properly when `removeClippedSubviews` was enabled and this one should have better performance since we don't play with the view hierarchy at all.
This fixes weird bugs with sticky headers in `SectionList` and allows removing the hack that disabled `removeClippedSubviews` when using sticky section headers.
**Test plan**
Tested using the SectionList and ListViewPaging examples that use sticky headers which uses z-index.
Closes https://github.com/facebook/react-native/pull/13105
Reviewed By: sahrens
Differential Revision: D4765869
Pulled By: achen1
fbshipit-source-id: be3c824658a3ce965b6e7324ad95c77cbd8a86ae
Summary: View tags are currently used for end-to-end test IDs. We'd like to overload the tag field with other information such as nativeID (for native refs) and transitionID (for shared element transitions) in the future. Added a key for testID's tag
Reviewed By: AaaChiuuu
Differential Revision: D4770368
fbshipit-source-id: b76c53a20520aac1b25d435b6d5eb809e8833675
Summary:
See facebook/yoga#483. We should not transfer the layout if the layout didn't change. (using ```hasNewLayout```). This also changes that the lock on the java node is only aquired if needed, and it holds the lock only for the time the values are set and not for the time all it's children are set.
Closes https://github.com/facebook/yoga/pull/484
Reviewed By: astreet
Differential Revision: D4802966
Pulled By: emilsjolander
fbshipit-source-id: e8a8f2280ad6b25b98fc68b07eac68e0ec80fe3e
Summary:
As suggested in facebook/yoga#484. This is the PR which only adds the part of using a local bool field for storing the hasLayoutFlag, to be able to pass the layout only if it has really changed.
Closes https://github.com/facebook/yoga/pull/492
Reviewed By: astreet
Differential Revision: D4786961
Pulled By: emilsjolander
fbshipit-source-id: cf3d354b93f6dcc3ef817ef73a47bd29e37d1848
Summary:
Inspired by #13191
Creating a test app with spannable `TextView`, and observe the text width/height
Closes https://github.com/facebook/react-native/pull/13203
Differential Revision: D4795809
Pulled By: hramos
fbshipit-source-id: a7c6845abe7472dc7ad2f1f978a20d02fe49eda8
Summary:
This change change the interface of reactmarker to use enum type and ReactMarker would still support logMarker(string, string) with addtional support for logMarker(ReactMarkerConstants, string).
Also moved some markers into the enum.
Reviewed By: fkgozali
Differential Revision: D4773600
fbshipit-source-id: 336ba79bb9514d3146bdda177861743ae51424ab
Summary:
The app crashes because of `TouchEventCoalescingKeyHelper.getCoalescingKey` throwing an exception when move on the edge of some phones like HUAWEI P9. It's caused by that the down time differs from `ACTION_DOWN` to `ACTION_MOVE` which belongs to the same gesture when I touched on the edge of my HUAWEI P9. It seems a native bug of manufacturer. Related issue #11302.
```
java.lang.RuntimeException: Tried to get non-existent cookie
at com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper.getCoalescingKey(TouchEventCoalescingKeyHelper.java:75)
at com.facebook.react.uimanager.events.TouchEvent.init(TouchEvent.java:93)
at com.facebook.react.uimanager.events.TouchEvent.obtain(TouchEvent.java:46)
at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:118)
at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:158)
at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:130)
at android.view.Vie
Closes https://github.com/facebook/react-native/pull/12063
Differential Revision: D4779060
Pulled By: astreet
fbshipit-source-id: 5cf20084ff9081f2535ff9cb3b99d1d52c443f03
Summary:
As specifications says, the Position error must be an object with code and message attributes. Right now it is a string. If not, we can't know what kind of error is. Another issue is that the message must be exactly "No available location provider."
Specifications:
https://developer.mozilla.org/en/docs/Web/API/PositionError
Closes https://github.com/facebook/react-native/pull/13140
Differential Revision: D4774922
Pulled By: ericvicenti
fbshipit-source-id: f956af051461e9f8d6435496283e54b3c4dc8ef5
Summary:
Bug in Android https://code.google.com/p/android/issues/detail?id=33868 causes the RN catalyst instrumentation test to fail with
```
java.lang.ArrayIndexOutOfBoundsException: length=253; index=-1
at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:667)
at android.text.StaticLayout.out(StaticLayout.java:631)
at android.text.StaticLayout.generate(StaticLayout.java:423)
...
```
The fix is to set singleLine to true when there is only one line of text
Reviewed By: AaaChiuuu
Differential Revision: D4562000
fbshipit-source-id: 84248e3982063b767e8b0465effe2321b54a7fa2
Summary:
Fix `NullPointerException` in `ReactShadowNode.toString`
Simplified `ReactShadowNode.hasNewLayout` since I was already in there
It seems to me unlikely that this bug impacts anything but the debugging experience, so no biggie.
Closes https://github.com/facebook/react-native/pull/12953
Differential Revision: D4739215
fbshipit-source-id: 94955cc783216fdb8868fc8d08010e0d8a238052
Summary:
The `UIManager` already has a lot of responsibilities and is deeply
tied with React Native's view architecture. This diff separates out a
`DeviceInfo` native module to provide information about screen dimensions and
font scale, etc.
Reviewed By: fkgozali
Differential Revision: D4713834
fbshipit-source-id: f2ee93acf876a4221c29a8c731f5abeffbb97974
Summary:
See https://github.com/facebook/react-native/issues/10845
onSizeChanged is enqueueing a runnable from the ui thread that references a shadow view by id on the native modules thread. Since the shadow thread 'runs ahead' of the UI thread (e.g. it has a newer state of the world than the UI thread), this isn't safe. By the time that code block runs, it's possible that an update from JS has already removed that view from the shadow hierarchy (a change which would then propagate to the native hierarchy on the UI thread).
Reviewed By: AaaChiuuu
Differential Revision: D4706521
fbshipit-source-id: 0915f081068709b895f70b2edce12163b39e5456
Summary:
Don't crash in `StackTraceHelper.convertJsStackTrace` on missing `lineNumber`
I've seen the native Android app crash upon displaying a stack trace because of this bug.
Incidental and unrelated change: Refactor `StackTraceHelper.formatFrameSource` to use `StringBuilder`
Closes https://github.com/facebook/react-native/pull/12920
Differential Revision: D4709273
fbshipit-source-id: 95b3eb303f259460e33d8ee32a2db652360c645d
Summary:
Create a JSInstance superinterface which doesn't include all
the lifecycle stuff.
Reviewed By: AaaChiuuu
Differential Revision: D4614410
fbshipit-source-id: 16047bbcb1bb69bf36a0a13ef68f3a6aa396a991
Summary:
* Any animation can be looped on the javascript thread
* Only basic animations supported natively at this stage, loops run
using the native driver cannot contain animations of type sequence,
parallel, stagger, or loop
Motivation: We need a spinner in our app that is displayed and animated while the javascript thread is tied up with other tasks. This means it needs to be offloaded from the javascript thread, so that it will continue to run while those tasks are churning away.
I originally submitted PR #9513, which has served our needs, but brentvatne pointed out a better way to do it. Had hoped his suggestion would be implemented by janicduplessis or another fb employee, but after 5 months I thought I'd give it another push.
I've put together an implementation that basically matches the suggested API. Let me know what you think, and whether others can pick it up from here and get it in to core.
Personal Motivation: I am leaving my current organisation on Feb 10th, so am trying to clean thing
Closes https://github.com/facebook/react-native/pull/11973
Differential Revision: D4704381
fbshipit-source-id: 42a2cdf5d53a7c0d08f86a58485f7f38739e6cd9
Summary:
Display.getCurrentSizeRange() doesn't include the size of the status
bar, so Modal windows on Android have a gap in the bottom that is the
same size as the status bar. This checks the current theme and adds the
size of status bar to the modal window height if necessary.
**Test plan (required)**
Run a React Native app on Android with a theme that doesn't show status bar and launch a modal dialog. See issue #11872 for an example.
Closes https://github.com/facebook/react-native/pull/11928
Differential Revision: D4695847
fbshipit-source-id: 9fafc2b5040e2f58d562c9cc4cd4d6d87b0df2a3
Summary: `onHostDestroy` is when the app is backgrounded and all Activities are destroyed. At this point it's safe to clear Fresco's memory cache.
Reviewed By: AaaChiuuu
Differential Revision: D4674950
fbshipit-source-id: f6db658ad56e3ad843cd2acfa31e2df1c40d3279
Summary:
We use this version internally.
Closes https://github.com/facebook/react-native/pull/12837
Differential Revision: D4688986
Pulled By: mkonicek
fbshipit-source-id: 93d9dedb51a56d6104aae443e939455c44397e88
Summary:
Re-applying the diff that was reverted in D4659669 / b87f4abf78 because of some crashes with fixes from D4659708 merged in.
---
Fixes a bug that happens when trying to use ScrollView with sticky headers and native `Animated.event` with `onScroll`. Made a few changes to the ListViewPaging UIExplorer example to repro https://gist.github.com/janicduplessis/17e2fcd99c6ea49ced2954d881011b09.
What happens is we need to be able to add multiple events to the same prop + viewTag pair. To do that I simple changed the data structure to `Map<prop+viewTag, List<AnimatedEventDriver>>` and try to optimize for the case where there is only one item in the list since it will be the case 99% of the time.
**Test plan**
Tested by reproducing the bug with the above gist and made sure it was fixed after applying this diff.
Closes https://github.com/facebook/react-native/pull/12697
Reviewed By: fkgozali
Differential Revision: D4661105
Pulled By: sahrens
fbshipit-source-id: c719dc85f45c1a142ef5b9ebfe0a82ae8ec66497
Summary:
This implements a loading banner like on iOS that shows the progress of the packager.
![](https://media.giphy.com/media/l4FGoepExkpOeXtTO/giphy.gif)
**Test plan**
- Tested that it displays similar messages as it does on iOS and also that is show the right message when waiting for the remote debugger.
- Tested that errors are still shown properly.
- Tested that it works with packagers that don't support multipart response (add && false in https://github.com/facebook/react-native/blob/master/packager/src/Server/MultipartResponse.js#L81).
- Run new unit tests.
- Tested that backgrounding / foregrounding the app hides / show the banner properly.
Closes https://github.com/facebook/react-native/pull/12674
Differential Revision: D4673638
Pulled By: mkonicek
fbshipit-source-id: b2a1163de3d0792cf481d7111231a065f80a9594
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/12818
Differential Revision: D4680312
Pulled By: AaaChiuuu
fbshipit-source-id: d8410e99c3ced4e2c94145186a450923029d5b22
Summary:
I don't remember exactly where we talked about this but LayoutAnimation on Android is pretty stable now so there's no reason to keep it behind an experimental flag anymore. The only part that is not really stable is delete animations, so what I did is remove the default delete animation that we provide in presets.
**Test plan**
Tested that layout animations work properly without any config.
Closes https://github.com/facebook/react-native/pull/12141
Differential Revision: D4494386
Pulled By: mkonicek
fbshipit-source-id: 5dd025584e35f9bff25dc299cc9ca5c5bf5f17a3
Summary:
PR for option to set mixed content mode in Webview(Android) for issue #8460
Closes https://github.com/facebook/react-native/pull/12314
Differential Revision: D4663084
Pulled By: lacker
fbshipit-source-id: 0e40ea463739166311ddcb7887ff6d0289369637
Summary:
Fixes#11592
This bug was seen on a Galaxy S4 running Android 4.4.2. On this device, Android's `Layout.getDesiredWidth` method doesn't correctly measure text that contains unicode emoticons. It appears to think the emoticons take up 0 space.
Setting ANTI_ALIAS_FLAG in the TextPaint's constructor instead of setting it later with setFlags works around the Android bug.
**Test plan (required)**
My team uses this fix in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12690
Differential Revision: D4673649
Pulled By: mkonicek
fbshipit-source-id: 535f371281927bfff5d8b42966496bc8daf30045
Summary: Initializing natives modules on the UI thread blocks the JS thread if the UI thread is busy.
Reviewed By: yungsters
Differential Revision: D4611211
fbshipit-source-id: cd4fb9cb5e52a478b6692b784cfd9e3bf34c0d34
Summary:
At times, ReactPackage needs to get information from the ReactInstanceManager, e.g. to get the DevSupportManager for debugging purpose. This allows passing down the instance manager to create the native modules, in addition to just ReactApplicationContext. It is then up to the Package to use it or not.
To use this, you must make your package class extends ReactInstancePackage, instead of just implementing ReactPackage interface.
Reviewed By: mmmulani
Differential Revision: D4641997
fbshipit-source-id: 497c4408a7d2b773c49f08bff7c1bf8f9d372edb
Summary:
Fixes a bug that happens when trying to use ScrollView with sticky headers and native `Animated.event` with `onScroll`. Made a few changes to the ListViewPaging UIExplorer example to repro https://gist.github.com/janicduplessis/17e2fcd99c6ea49ced2954d881011b09.
What happens is we need to be able to add multiple events to the same prop + viewTag pair. To do that I simple changed the data structure to `Map<prop+viewTag, List<AnimatedEventDriver>>` and try to optimize for the case where there is only one item in the list since it will be the case 99% of the time.
**Test plan**
Tested by reproducing the bug with the above gist and made sure it was fixed after applying this diff.
Closes https://github.com/facebook/react-native/pull/12697
Differential Revision: D4656347
Pulled By: sahrens
fbshipit-source-id: b5c36ba796f478e56028c7a95bc0f86bc54cb2ce
Summary:
Removing unused code. We used to have this dependency for the RecyclerViewBackedScrollView, which has been removed.
**Test plan (required)**
Tests pass on Circle CI.
Closes https://github.com/facebook/react-native/pull/12636
Differential Revision: D4646561
Pulled By: ericnakagawa
fbshipit-source-id: 285de78debec306078eb9ad34a2339f95bc42a9c
Summary:
This adds blurRadius support for <Image>, similar to iOS.
The heavy-lifting was done by lambdapioneer in the stack of diffs ending with
D3924013, we're just patching this in.
Two notes: we might need to apply two postprocessors going forward, will tackle
that in a separate diff, so we can ship this asap.
However, we need a new version of fresco to be released in order
to ship this.
Reviewed By: lexs
Differential Revision: D3936438
fbshipit-source-id: 353bf1f1120ebd5f4f8266c5a20188b41478a741
Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .
Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.
New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes https://github.com/facebook/yoga/pull/432
Reviewed By: astreet
Differential Revision: D4611359
Pulled By: emilsjolander
fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Summary:
This diff adds display:none support to React Native. This enables hiding components which still calling their render method and keeping them within the state of your application. This enables preserving state in a component even though the component is not visible. Previously this was often implemented by rendering a component off screen as a work around. See below playground for usage.
```
class Playground extends React.Component {
render() {
return (
<View style={{width: '100%', height: '100%', flexDirection: 'row', backgroundColor: 'white'}}>
<View style={{width: 100, height: 100, display: 'none', backgroundColor: 'red'}}/>
<View style={{width: 100, height: 100, backgroundColor: 'blue'}}/>
</View>
);
}
}
```
Reviewed By: astreet
Differential Revision: D4611771
fbshipit-source-id: 0dbe0494d989df42994ab9ad5125d47f3233cc5a
Summary:
This PR is based on files ericvicenti gave me. Specifically, he gave me:
- AccessibilityInfo.android.js
- AccessibilityInfo.ios.js
- AccessibilityInfoModule.java
Before this change, only a native iOS implementation of AccessibilityInfo existed. This change includes:
- A native Android implementation of AccessibilityInfo.
- JavaScript wrappers for the AccessibilityInfo module for both iOS and Android.
- UIExplorer changes to illustrate how to use AccessibilityInfo on iOS and Android.
- Documentation for the AccessibilityInfo APIs.
**Test plan (required)**
Tested the UIExplorer AccessibilityInfo example on iOS and Android with the screen reader both enabled and disabled.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/12273
Reviewed By: mkonicek
Differential Revision: D4527224
Pulled By: ericvicenti
fbshipit-source-id: d04638465ccbdbb35ecfc9504daaeb8e33aab57a
Summary:
Android API 15 still have 1.5~2.0% distribution (refer: [Dashboard - Android Developer](https://developer.android.com/ndk/guides/standalone_toolchain.html#creating_the_toolchain)).
React Native is a good tec but many companies cannot endure loose their consumer. [Choreographer](https://developer.android.com/reference/android/view/Choreographer.html) triggered UI operation is the only reason that React Native Android sdk use minSdkVersion 16, so we can use a backward solution **only in API 15**: [Handler](https://developer.android.com/reference/android/os/Handler.html).
In this PR, the biggest change is :
- Make core operation of ReactChoreographer to an interface: ReactUIDriver;
- Impl ReactUIDriver by Handler => UIDriverHandlerImpl, refactor ReactChoreographer to UIDriverChoreographerImpl;
- Let UIDriverFactory to choose which one impl would be in use. (Only use handler in api 15).
Closes https://github.com/facebook/react-native/pull/12396
Reviewed By: AaaChiuuu
Differential Revision: D4588399
Pulled By: astreet
fbshipit-source-id: 76408e53664314dd926e6a553cde6bafbd37779e
Summary:
This PR fixes#6332
The issue is that Android Framework will return the same drawable instance for all requests if they request for the same resource. So the changes on the drawable instance will affect all users(`TextInput` in this case). The solution is very easy, call `mutate()` before change it will get a new drawable instance which make sure the change doesn't affect other users.
Closes https://github.com/facebook/react-native/pull/12493
Differential Revision: D4620034
Pulled By: astreet
fbshipit-source-id: a7b10fbc7447e01132b7ca0e1f78413796493e07
Summary: Adding providesModule annotations to files that don't have a `providesModule` annotation but are in directories that packager crawls.
Reviewed By: cpojer
Differential Revision: D4612455
fbshipit-source-id: b23f0d6bbe2d26f480e93b56b67c6c8b1075e9f7
Summary:
This PR will:
- add missing documentation for `caretHidden` prop to the docs
- add `caretHidden` prop implementation for Android
I noticed this by accident when looking at `RCTTextFieldManager.m` and there is `RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)` which hides caret on iOS. Then I realised that the docs were missing for this prop and implementation on Android side :)
Render `TextInput` with prop `caretHidden`. After this caret is not visible anymore.
`<TextInput style={styles.input} caretHidden />`
If you omit the prop then caret is visible again
`<TextInput style={styles.input} />`
Closes https://github.com/facebook/react-native/pull/11863
Differential Revision: D4448402
fbshipit-source-id: 456e1df3e2cbb8af32540d2c7a8f4e7da219f5c3
Summary:
Developers are complaining about horrible lag (https://github.com/facebook/react-native/issues/11809) caused by PR https://github.com/facebook/react-native/pull/11222.
The issue was that hasNewLayout in yoga is actually a dirty bit and indicates that either you OR one of your children has a new layout. We still need to manually check whether the component's layout actually is different from before.
Reviewed By: sahrens
Differential Revision: D4597545
fbshipit-source-id: 27d4605afd00badfdcdacae740ee2e477adee929
Summary:
Native animated events sometimes end up lagging a frame behind on android because we perform the update in the normal animation loop instead of doing it immediately when we receive the event. We had the same issue on iOS and was fixed in a similar way.
Moved some code around to have a method that updates a list of node that we can use to update the node in the animated event handler and also use it in the animation update loop.
**Test plan**
Tested that it did fix sticky headers lagging a frame behind during momentum scrolling in my PR #11315 and also tested the native animations examples still work properly.
Closes https://github.com/facebook/react-native/pull/11994
Reviewed By: mkonicek
Differential Revision: D4488977
Pulled By: sahrens
fbshipit-source-id: 831a1565bc7b8fa88cadd5a8c1be876fbdefbf66
Summary:
Since we are reading from a file, we should make sure this struct is packed, just in case we change it down the line and the compiler decides it might want to introduce padding, we're now protected against that.
There was also a discussion about the fact that people might use `ptr += sizeof(BundleHeader)` as an idiom in their code, which would currently be incorrect, if padding was introduced at the end of the file. Actually, it remains incorrect to do that now, because a RAM bundle header is a different size to a BC Bundle header. If people are properly testing their code, they should spot this pretty quickly, because it will always be an incorrect thing to do with a RAM bundle, so this isn't as bad as previously thought: where the code only succeeds when the compiler deigns to not pad the struct at the end.
This diff also cleans up how headers are initialised. `BundleHeader` has a constructor that explicitly zero-initialises it so we can rely on the default initializer to do the right thing now.
Reviewed By: mhorowitz
Differential Revision: D4572032
fbshipit-source-id: 7dc50cfa9438dfdfb9f842dc39d8f15334813c63
Summary:
A copy of https://github.com/facebook/react-native/pull/7791 because of our very imperfect tools that mirror the changes from pull requests in the fb monorepo. The internal Phabricator revision for #7791 is in an 'abandoned' state (by foghina probably because of changing teams) and Phabricator doesn't allow me to claim that revision and merge it. Therefore I'm creating a new one.
(It's not foghina's fault, no one probably knew about this "abandoned Phabricator revision" edge case, don't remember we hit it before.)
Will try to keep attribution (git blame) to rigdern when merging.
Closes https://github.com/facebook/react-native/pull/12448
Differential Revision: D4584743
Pulled By: mkonicek
fbshipit-source-id: 66e5b88134fca1980adc4cd8a2ff17c42e10022c
Summary: We're logging all console logs from webview. This strips console logging for non debug builds
Reviewed By: AaaChiuuu
Differential Revision: D4578071
fbshipit-source-id: 79b21012a6ef215eb35701911662a720cb6be280
Summary:
This matches the behavior on iOS, there was no way before to change the cursor color per input, it was only possible to change it globally via the theme. Ideally cursor color and selection color would be 2 different props but I think this is better than what we have (and matches iOS).
Sadly there is no api to change it pragmatically (only possible via xml) so this uses reflection and can easily break so it is wrapped in a try catch to avoid crashes. I think it is better to just silently fail in this case. Definetly not super happy about the solution but I think it's worth adding since it is possible to do it natively using xml so it would suck not to be able to do it in RN.
**Test plan**
Tested that the cursor has the same color as before the change when not setting the prop and that it gets the selectionColor color when set.
Closes https://github.com/facebook/react-native/pull/12280
Differential Revision: D4571858
Pulled By: astreet
fbshipit-source-id: 7dca2db33a0a4eecb6115b45155549b1265ffbed
Summary:
I couldn't resist to do this 😄#394
This adds ```flex-wrap: wrap-reverse```
I think we hit a edge case here:
https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width
as is differs here from chrome, but I think that yoga is here more correct.
So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60.
```html
<div id="wrap_reverse_column" style="height: 100px; flex-wrap: wrap-reverse">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
```
Looking forward what you think here emilsjolander
Closes https://github.com/facebook/yoga/pull/398
Reviewed By: astreet
Differential Revision: D4564711
Pulled By: emilsjolander
fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375
Reviewed By: dshahidehpour
Differential Revision: D4528518
Pulled By: emilsjolander
fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.
This PR adds an implementation for that.
It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357
Reviewed By: astreet
Differential Revision: D4501142
Pulled By: emilsjolander
fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
Summary:
The PR description has been updated to reflect the new approach.
**Breaking Change Summary**
On Android, the following properties now return a different number:
- `Dimensions.get('window').fontScale`
- `Dimensions.get('screen').fontScale`
- `PixelRatio.getFontScale()`
This is a breaking change to anyone who was using these properties because the meaning of these properties has now changed.
These properties used to return a value representing font scale times density ([`DisplayMetrics.scaledDensity`](https://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity)). Now they return a value representing just font scale ([`Configuration.fontScale`](https://developer.android.com/reference/android/content/res/Configuration.html#fontScale)).
**PR Description**
This PR changes a few things:
- Correctly exposes the font scale to JavaScript as `Dimensions.get('screen').fontScale`. UIManager was exporting `DisplayMetrics.scaledDensity` under the name `fontScale`. How
Closes https://github.com/facebook/react-native/pull/11008
Differential Revision: D4558207
Pulled By: astreet
fbshipit-source-id: 096ce7b28051325dfd45fdb2a14b5e9b7d3bc46f
Summary:
cc astreet
The goal of this PR is to enable the buck module `uimanager` to depend on `modules/core` without introducing any dependency cycles.
PR #11008 relies on this PR. PR #11008 needs `uimanager` to depend on `modules/core` so that `uimanager` can fire events using `RCTDeviceEventEmitter` which is in `modules/core`.
This PR moved a number of classes and interfaces:
- `com.facebook.react.modules.debug.DeveloperSettings` -> `com.facebook.react.modules.debug.interfaces.DeveloperSettings`
- `com.facebook.react.devsupport.DevOptionHandler` -> `com.facebook.react.devsupport.interfaces.DevOptionHandler `
- `com.facebook.react.devsupport.DevSupportManager` -> `com.facebook.react.devsupport.interfaces.DevSupportManager`
- `com.facebook.react.devsupport.DevServerHelper.PackagerStatusCallback` -> `com.facebook.react.devsupport.interfaces.PackagerStatusCallback`
- The class `com.facebook.react.devsupport.StackTraceHelper.StackFrame` was renamed to `StackFram
Closes https://github.com/facebook/react-native/pull/12329
Differential Revision: D4551160
Pulled By: astreet
fbshipit-source-id: 3a78443c4f30469b13ddfbdcc9bbef6af9e8381a
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.
Fix#229
Closes https://github.com/facebook/yoga/pull/364
Reviewed By: gkassabli
Differential Revision: D4528561
Pulled By: emilsjolander
fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
Summary:
If we throw an exception from a UIOperation, the UI is likely in a bad state and we shouldn't execute any other operations on it. In non-dev mode, this would mean we've crashed and don't have to worry about that. But in dev mode, we may have shown a redbox and the instance is still active. This means doing something like reloading, which will trigger onPause and thus flush more UI operations, can crash the app while its sitting on a red box.
This diff aims to prevent that by no longer executing UI operations after one has thrown an exception.
Reviewed By: AaaChiuuu
Differential Revision: D4536925
fbshipit-source-id: 15c21bb76ad3419a54d9d5de94b6bd1f70a3e4a4
Summary: Activity lifecycle events in native modules can cause exceptions: we should redbox them like we do all other application-logic triggered exceptions.
Reviewed By: AaaChiuuu
Differential Revision: D4537111
fbshipit-source-id: 71abf8696173a3d647e858c4ea316a169ad2d8ef
Summary:
Don't call OnBatchComplete on NativeModules that have'nt been initialized.
Also a follow up to D4479604. This also removes the extra allocation of OnBatchCompleteListener per NativeModule that implements OnBatchCompleteListener.
This means NativeModules which implement OnBatchCompleteListener will have to be explicitly initialized or called into before the OnBatchCompleteListener of that NativeModule will be triggered.
Reviewed By: javache
Differential Revision: D4483682
fbshipit-source-id: 6a9431c82f72d17605d1c1e0ee9194f8d8fc2ddc
Summary: Like GuardedAsyncTask, et al, but for Runnables.
Reviewed By: achen1
Differential Revision: D4537287
fbshipit-source-id: 8ae60c7007843c0b7d8e5c3835d0847921fb3db5
Summary:
Some nodes have a value of NaN initially so if we assign the value of the input in the constructor it is possible we get NaN as a value and then it will break when trying to update the value. Initializing at 0 is actually fine with this node since it will get updated properly in the `update` method.
**Test plan**
Tested in an app that uses native animated diffclamp where I noticed the issue. Made sure this change fixed it.
Closes https://github.com/facebook/react-native/pull/12279
Differential Revision: D4527866
fbshipit-source-id: add3fc0d86ffcf4ddcd01ff3251f2373eeaa2cf5
Summary: We deprecated `transformMatrix` and `decomposedMatrix` in D3239960 10 months ago. This revision finally removes remains of this functionality from native code.
Reviewed By: mmmulani
Differential Revision: D4515760
fbshipit-source-id: b4d5b7e834ac4a775f4992b28270b4ff961889a6
Summary:
Fix#241 and successor for #302
Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369
Reviewed By: astreet
Differential Revision: D4501141
Pulled By: emilsjolander
fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
Summary:
Corresponding iOS PR: https://github.com/facebook/react-native/pull/11002
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/11001
Differential Revision: D4220941
Pulled By: mkonicek
fbshipit-source-id: 7e420579946f2ae840c9e1fcdc8afab68007da17
Summary:
Fixes LayoutAnimation when animating the position of a view that has a transform, the animation would start at the wrong position, offset by the transform translation value. I noticed this bug while working on sticky headers using animated in the UIExplorer <ListView> - Paging example.
**Test plan**
Made a simple repro for the bug https://gist.github.com/janicduplessis/eb985dc3accfd5982c77761be692e395 and tested that it fixed it. Also tested that the UIExplorer <ListView> - Paging example with sticky headers worked properly with this fix.
Closes https://github.com/facebook/react-native/pull/12140
Differential Revision: D4494389
Pulled By: mkonicek
fbshipit-source-id: dd49cb2db9dd4950e293596fbc773f7d79e8b10a
Summary:
This prop exposes the functionality provided by Android ScrollView's setOverScrollMode method.
One interesting thing to note is that, if you were to read the Android docs, you would think that the value "always" is the default over scroll mode. However, the docs are incorrect and "always-if-content-scrolls" is actually the default value (http://stackoverflow.com/a/27116306).
**Test plan (required)**
Verified this change in a test app. Also, our team uses this change in our app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/10905
Differential Revision: D4500957
Pulled By: mkonicek
fbshipit-source-id: 873eba38183defba133c228e0c1038efa83297d3
Summary:
The DCIM folder is a better mapping to a "CameraRoll" than the "movies" or "pictures" directories.
https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_DCIM
```
DIRECTORY_DCIM
The traditional location for pictures and videos when mounting the device as a camera.
Note that this is primarily a convention for the top-level public directory, as this convention makes no sense elsewhere.
```
**Test plan**
- Make sure tests pass on both Travis and Circle CI.
- Test `saveToCameraRoll` in an example app, and check it is saved to the expected folder in a photos app.
Closes https://github.com/facebook/react-native/pull/12059
Differential Revision: D4500946
Pulled By: mkonicek
fbshipit-source-id: 8af994492303c175374502dffe6fd2f3e4e9975e
Summary:
Especially for newcomers, this may help since some may think the effect is immediate.
Closes https://github.com/facebook/react-native/pull/12066
Differential Revision: D4500929
Pulled By: mkonicek
fbshipit-source-id: dfa05134f208c084dacb3e490fe9eb8df323ffd5
Summary: `RecyclerViewBackedScrollView` was added a long time ago to work around the scroll-back-when-data-is-added bug, but that has now been fixed directly in the `ScrollView` (`ReactScrollView.java`) in open source and internally.
Reviewed By: astreet
Differential Revision: D4482105
fbshipit-source-id: 208f21f00045d5c5a83b74ad69b3db6fa63391d7
Summary:
**Motivation**
Ability to customize slider colors is desirable to match the brand. Currently iOS allows using images for slider parts, but android doesn't have any customization options. This PR adds support for customizing `thumbTintColor`, `trackTintColor` and `progressTintColor`.
**Test plan (required)**
Run UIExplorer example with the changes and verify everything works fine.
![image](https://cloud.githubusercontent.com/assets/1174278/22020752/f32a6eec-dcdf-11e6-928d-481bb28bd0a3.png)
cc brentvatne
Closes https://github.com/facebook/react-native/pull/11946
Differential Revision: D4427474
fbshipit-source-id: ec3a38db600bac6108691a4cfa15e2409143b9f3
Summary:
We were noticing the following crash in our application, that was occurring fairly often, but still hard to reproduce:
```
12-12 10:37:35.342: E/AndroidRuntime(9064): FATAL EXCEPTION: main
12-12 10:37:35.342: E/AndroidRuntime(9064): Process: com.bloomberg.android.plus, PID: 9064
12-12 10:37:35.342: E/AndroidRuntime(9064): java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.uimanager.UIViewOperationQueue$UIOperation.execute()' on a null object reference
12-12 10:37:35.342: E/AndroidRuntime(9064): at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
12-12 10:37:35.342: E/AndroidRuntime(9064): at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
12-12 10:37:35.342: E/AndroidRuntime(9064): at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
12-12 10:37:35.342: E/AndroidRuntime(9064): at com.facebook.react.uimanager.UIViewOperationQ
Closes https://github.com/facebook/react-native/pull/11428
Differential Revision: D4487841
Pulled By: astreet
fbshipit-source-id: ae49ef77967edea7514cbf40cb533c4b63fd34ae
Summary:
This is a followup for https://github.com/facebook/react-native/pull/12088 and implements the scrolling to end on Android natively rather than sending a large scroll offset from JS.
This turned out to be an OK amount of code, and some reduction in the amount of JavaScript. The only part I'm not particularly happy about is:
```
// ScrollView always has one child - the scrollable area
int bottom = scrollView.getChildAt(0).getHeight() + scrollView.getPaddingBottom();
```
According to multiple sources (e.g. [this SO answer](http://stackoverflow.com/questions/3609297/android-total-height-of-scrollview)) it is the way to get the total size of the scrollable area, similar to`scrollView.contentSize` on iOS but more ugly and relying on the fact the ScrollView always has a single child (hopefully this won't change in future versions of Android).
An alternative is:
```
View lastChild = scrollLayout.getChildAt(scrollLayout.getChildCount() - 1);
int bottom = lastChild.getBottom() + scrollLayout.getPadd
Closes https://github.com/facebook/react-native/pull/12101
Differential Revision: D4481523
Pulled By: mkonicek
fbshipit-source-id: 8c7967a0b9e06890c1e1ea70ad573c6eceb03daf
Summary:
According to #11992 fix skew transform in native code as well
janicduplessis vjeux
Closes https://github.com/facebook/react-native/pull/12106
Differential Revision: D4479880
fbshipit-source-id: d84780842b555f6352d84d229b5b6c5c3c6a0647
Summary: It should be possible to use the latter without using the former.
Reviewed By: ashwinb
Differential Revision: D4321776
fbshipit-source-id: 935fbb3fdb47369e18992aca0497d312ad6023bc
Summary:
When using a TextInput with a custom font, the placeholder didn't use that font. This is because ReactTextInputManager didn't use ReactFontManager to create the TypeFace which handles custom fonts.
**Test plan**
Tested in UI explorer by reproducing the bug with and testing that the custom font gets applied properly after the fix.
``` js
<TextInput
placeholder="Hello"
style={{ fontFamily: 'notoserif' }}
/>
```
Closes https://github.com/facebook/react-native/pull/12000
Reviewed By: hramos
Differential Revision: D4443713
fbshipit-source-id: e92c9822d9226681d7b00126dad95e5534c0c46e
Summary:
Support `xhr.send(data)` for typed arrays.
**Test plan:** run UIExplorer example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/11904
Differential Revision: D4425551
fbshipit-source-id: 065ab5873407a406ca4a831068ab138606c3361b
Summary:
For returnKeyType 'go', 'search' and 'send' Android will call
onEditorAction twice, once with IME_NULL and another time with the respective IME_ACTION.
This change makes sure to only fire one onSubmitEditing by always returning true in onEditorAction, which causes no subsequent events to be fired by android.
Fixes#10443
**Test plan**
1. Create view with TextInput having 'go', 'search' or 'send as `returnKeyType`
```javascript
<View>
<TextInput
returnKeyType='search'
onSubmitEditing={event => console.log('submit search')}></TextInput>
<TextInput
returnKeyType='go'
onSubmitEditing={event => console.log('submit go')}></TextInput>
<TextInput
returnKeyType='send'
onSubmitEditing={event => console.log('submit send')}></TextInput>
</View>
```
2. Input some text and click submit button in soft keyboard
3. See event fired only once instead of two times
Closes https://github.com/facebook/react-native/pull/11006
Differential Revision: D4439110
Pulled By: hramos
fbshipit-source-id: 5573b7f15f862b432600ddd3d61a0852ce51b2b3
Summary: Introduced IS_TESTING flag on Platform module for android as well. This is useful for testing environment.
Reviewed By: mmmulani
Differential Revision: D4429662
fbshipit-source-id: 33711d7fb5666f0bac8aee444b71261f7f12770f
Summary:
Many websites use domstorage and never think of its unavailability, which usually leads to a blank page on android and hard for developers to debug. I think it's better to enable domstorage by default, for convenience and consistency to iOS and PC.
Closes https://github.com/facebook/react-native/pull/11333
Differential Revision: D4437165
Pulled By: hramos
fbshipit-source-id: a00441cb5214cca27927471d3a33f030b9ff9b52
Summary: Since we don't support this, we should throw early. Also tries to improve the error message when adding a node that doesn't have a YogaNode to a node that can't measure itself.
Reviewed By: andreicoman11
Differential Revision: D4421542
fbshipit-source-id: e0be8cdd763091145e5e6af2db91515f4d236b37
Summary:
Fix#326. I'll open another PR once this one gets accepted to add support for `YGLayoutGetBorder` 👌
Closes https://github.com/facebook/yoga/pull/335
Reviewed By: gkassabli
Differential Revision: D4409399
Pulled By: emilsjolander
fbshipit-source-id: 8153f6701cab60b55a485f6d2e0b9f7767481090