Summary:
When something comes in from the right, we swipe from left to
right to move back. That means, when something comes in from the bottom,
we should swipe from top to bottom to get rid of it. This diff makes that
behavior occur - right now it's somewhat nonsensical as both jumpBack
and jumpForward are mapped to the same gesture.
thanks to #11192 for making gestures work on VerticalUpSwipeJumps
Reviewed By: ericvicenti, shergin
Differential Revision: D4412129
fbshipit-source-id: 6a3b202b0a90ca459b4ef106ba5bf48d0b1aec9e
Summary:
Hi,
The (as of yet unreleased) commit 5537055bf8 added some ListView and ScrollView mocks, but they leave out the original properties passed into them, which broke some of my tests (e.g. by excluding some properties like `testID`, for example, from the render tree) and I assume might break others' as well.
This PR makes it so the ListView mock directly returns the scroll component (instead of wrapping it in a View), and has ListViewMock and ScrollViewMock pass their given properties through.
Closes https://github.com/facebook/react-native/pull/11847
Differential Revision: D4408497
Pulled By: sahrens
fbshipit-source-id: 7ec01c35d6b8efeb97761cddffdb4075d09c7d70
Summary:
On Android with dev mode on, we're seeing a regular SIGSEGV when pushing a lot of animation declarations over the bridge. We tracked this down to being not specific to animations, but the crash is caused in `deepFreezeAndThrowOnMutationInDev`.
Specifically: the provided object to freeze is modified while looping, replacing the current key access to a getter/setter. After the modification, JSC crashes during retrieval of the next key - but only when there are a lot of events passing over the bridge.
We have a hunch that this is due to a bug in JSC object enumeration but did we not look into it further yet. Any help here is welcome. The JS code seems all right at first sight and shouldn't cause a segmentation crash.
The workaround in this PR is to retrieve the keys first from the object and then looping over that array. In our app and in a reduced app test case this fixes the crash.
If needed I can provide the reduced app test case. It's really tricky to make a test for this as it requires to be run
Closes https://github.com/facebook/react-native/pull/11804
Differential Revision: D4403483
Pulled By: davidaurelio
fbshipit-source-id: a31e5cff734e96bfec56e4a39dc1c6854798e245
Summary:
This fixes a broken link in the docs.
Closes https://github.com/facebook/react-native/pull/11453
Differential Revision: D4394773
Pulled By: lacker
fbshipit-source-id: 07b3aaa25017912063ac9e65f336c56a902d7144
Summary:
Hello,
This PR adds a property to the `ListView` to enable and disable to sticky sections headers behaviour. Current this is enabled by default and there is no way to disable it. It has been previously discussed in #1974 where there was a suggestion to add the `ListView` inside `ScrollView`. This is bad for performance, but some people were using that as a workaround. satya164 suggested someone submitting a PR, which is why I'm here 😉
I have tested the property manually by adding `stickySectionHeaders={false}` to the `<ListView> Paging` example in `UIExplorer`. I have also tested that the current behaviour still stands, so this is a non-breaking change.
I have also checked that the website displays the new documentation.
I couldn't see anywhere to add automated tests to this, but if there is feel free to point it out and I'll update this PR.
I tried running `npm run lint` to check the code style, but it spat out loads and loads of errors. I presume I have something set up incorrectly. Feel
Closes https://github.com/facebook/react-native/pull/11700
Differential Revision: D4380916
fbshipit-source-id: 7782043afc9f0108c81f97952fed60b153479cac
Summary:
This PR adds the `testID` prop to the `Button` component in order to allow end-to-end tests.
Closes https://github.com/facebook/react-native/pull/11526
Differential Revision: D4392137
Pulled By: ericvicenti
fbshipit-source-id: d3f864aacee319e520af226cd063edef452f6fc8
Summary:
I see there is a string matching inconsistency in `Libraries/CustomComponents/Navigator/Navigator.js` and `Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js`, which caused a bug resulting in gestures not working for vertical SceneConfigs. This PR fixes the inconsistency, and the bug.
**Motivation for making this change**
When working with the navigator, I was using the `VerticalUpSwipeJump` Navigator SceneConfig. The gesture to pop to the previous scene (in this case `jumpBack`) was not working.
**How I tested?**
I changed these strings (as shown in this PR) and swiped down. After these changes, everything worked as expected.
**Example**
In `Libraries/CustomComponents/Navigator/Navigator.js`, we check for gesture direction strings `bottom-to-top` and `top-to-bottom` in multiple places, but nowhere do we ever check for `up-to-down` and `down-to-up`.
```
var isTravelVertical = gesture.direction === 'top-to-bottom' || gesture.direction === 'bottom-to-top';
var isTravelInverted =
Closes https://github.com/facebook/react-native/pull/11192
Differential Revision: D4392103
Pulled By: ericvicenti
fbshipit-source-id: fd80578031f94b1b409815481c82e481c7ff2f13
Summary:
It seems that the `requestPermission` and `checkPermission` APIs from PermissionsAndroid have been deprecated in react-native 0.40.0., but they are still used in the description and example.
This commit updates the description and the example to use the new APIs.
Closes https://github.com/facebook/react-native/pull/11722
Differential Revision: D4392031
Pulled By: ericvicenti
fbshipit-source-id: e3ceebb1ef557e05dab40bb883013be4ec80bed6
Summary:
In Android, components using an elevation > 0 are able to hide the YellowBox. Especially bad when they happen to hide the dismiss button of the inspector.
Closes https://github.com/facebook/react-native/pull/11777
Differential Revision: D4392027
Pulled By: ericvicenti
fbshipit-source-id: 96ab98520cd54b9bb683d984f9990bf0e90b9a37
Summary:
Currently, < WebView > allows you to pass JS to execute within the view. This works great, but there currently is not a way to execute JS after the page is loaded. We needed this for our app.
We noticed that the WebView had messaging support added (see #9762) . Initially, this seemed like more than enough functionality for our use case - just write a function that's injected on initial load that accepts a message with JS, and `eval()` it. However, this broke once we realized that Content Security Policy can block the use of eval on pages. The native methods iOS provide to inject JS allow you to inject JS without CSP interfering. So, we just wrapped the native methods on iOS (and later Android) and it worked for our use case. The method injectJavaScript was born.
Now, after I wrote this code, I realized that #8798 exists and hadn't been merged because of a lack of tests. I commend what was done in #8798 as it sorely solves a problem (injecting JS after the initial load) and has more features than what I'
Closes https://github.com/facebook/react-native/pull/11358
Differential Revision: D4390425
fbshipit-source-id: 02813127f8cf60fd84229cb26eeea7f8922d03b3
Summary:
RCTRootView supports a property `passThroughTouches` which when set, allows
touches to propagate to sibling views. To allow touches to reach RCTRootView,
we also need to set `pointerEvents` on the RCTViews wrapping the child views.
Reviewed By: javache
Differential Revision: D4385443
fbshipit-source-id: 6291d8614870168f1c4cdf0ef5ff6e42e4a8ef63
Summary:
Puts hierarchy and other inspector data in a fixed height scrollview so it never takes up
too much space and you can always scroll to see everything you want.
Reviewed By: fkgozali
Differential Revision: D4374819
fbshipit-source-id: 89356670c984c693db345ad66a97d4cb54a98aee
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
Summary: This caused a bunch of stuff to break, reverting and will fix the problems before committing next time.
Reviewed By: fkgozali
Differential Revision: D4363398
fbshipit-source-id: 55146c9da998f6a3883307c36422a9d440ea7f52
Summary:
Bandaid for #7070. Until this is fixed, the docs should at least be honest the state they're in, so people don't have to go search and wonder.
Closes https://github.com/facebook/react-native/pull/11626
Differential Revision: D4366925
Pulled By: mkonicek
fbshipit-source-id: 082a8a9916ad0f8fbb2955cffbf61142fa2a98a1
Summary:
As of iOS10 permission is required to access user photos and their galleries, I felt this really needed to be addressed. I hope to create a section dedicated to iOS permissions soon.
Closes https://github.com/facebook/react-native/pull/11259
Differential Revision: D4364354
Pulled By: hramos
fbshipit-source-id: 97bdeb09deba01995eebd038e00ccc84b08281c9
Summary:
Transition animations are not very customizable right now with NavigationExperimental, unless I am missing something big. This PR allows NavigationCardStack to receive the `horizontalCardStyleInterpolator` and `verticalCardStyleInterpolator` props to override the default interpolators.
See the gif, transition animation changes from the default one (with scale) to a custom one (without scale) when passing in a custom interpolator. (The custom interpolator is an exact copy of the one in `NavigationCardStackStyleInterpolator.forHorizontal`, minus the scale transform.)
![cmz0gagoec](https://cloud.githubusercontent.com/assets/1389312/20552499/af33667c-b119-11e6-97e7-bea9986a58e0.gif)
Let me know if there's a robust way to test, but I couldn't find anything.
**To address**
The new `canUseNativeDriver` function on NavigationCardStackStyleInterpolator, which returns `true`, is dependent on the interpolator, so custom interpolators may need to falsify this. Didn't include it on the first pass since I wasn
Closes https://github.com/facebook/react-native/pull/11082
Differential Revision: D4362540
Pulled By: ericvicenti
fbshipit-source-id: 2ebd0047c147ac3d6c43ce880661c99de8fd0880
Summary:
`Fake` components are simplified so snapshots are stable and reliable, and references are exported
so that interactions like `onRefresh` and `onScroll` can be called manually. Currently there is just
one global export for each class, but we may change this in the future if we need to manage multiple
`Fake`s of the same type in one render tree.
Right now these must be installed explicitly, but I might move them into `__mocks__` folders if it
seems reasonable to make them defaults.
Reviewed By: cpojer
Differential Revision: D4318207
fbshipit-source-id: 62802353a98b09ca1c80804ef7201ea63091f94a
Summary:
expose this property to make Text having same property like TouchableHighlight
Closes https://github.com/facebook/react-native/pull/11473
Differential Revision: D4348825
fbshipit-source-id: 941bcc681139d4460f52fed5174be1d2381462c7
Summary:
In the 8e2906ae89 commit there was implemented a cancelable option for Alerts. It wasn't clear from the docs about this option and the additional Alert method's parameter.
Closes https://github.com/facebook/react-native/pull/11292
Differential Revision: D4342707
Pulled By: lacker
fbshipit-source-id: dc243b868106e705040e77bc90d4d9b8c2dc26eb
Summary:
I'm pretty sure this is supposed to be "bottom" as opposed to "top", as it's the offset from the keyboard, which is at the bottom of the screen.
Closes https://github.com/facebook/react-native/pull/11446
Differential Revision: D4339957
Pulled By: lacker
fbshipit-source-id: 62dca544a0167704d76cd972c44570f277ea63aa
Summary:
cc brentvatne
potential reviewers mkonicek and kmagiera
**Motivation for making this change.**
The previous PR was closed : #11095 but the followup actions was never done
I reopened a really similar one so it get merged
RecyclerView is no more used at Facebook (according to previous PR)
According to brentvatne, their were two motivations for RecyclerView:
* ListView with ScrollView component used to bounce back on row insert, but this is now fixed
* This made possible to implement certain performance improvements, but the maintenance cost was not worth the risk
With RN 0.37, the actual code in React Native make the app crash:
- see #10560
I spend one hour investigating this and did also require brent time at exponent slack. I think other people are struggling too.
**Test plan**
<img width="708" alt="screen shot 2016-12-13 at 23 42 22" src="https://cloud.githubusercontent.com/assets/13785185/21162483/dbeb642e-c18d-11e6-9c32-1fe73f1826c1.png">
**Code formatting**
The
Closes https://github.com/facebook/react-native/pull/11445
Differential Revision: D4340640
Pulled By: mkonicek
fbshipit-source-id: 64c5cf060f2eb035d4d6199b30f0e73afc520180
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/11459
Differential Revision: D4339946
Pulled By: lacker
fbshipit-source-id: d95e7c62dbf7bf6fd2ab3739b3d64bfcbe83e24a
Summary:
Android has a text API called breakStrategy for controlling how paragraphs are broken up into lines. For example, some modes support automatically hyphenating words so a word can be split across lines while others do not.
One source of complexity is that Android provides different defaults for `breakStrategy` for `TextView` vs `EditText`. `TextView`'s default is `BREAK_STRATEGY_HIGH_QUALITY` while `EditText`'s default is `BREAK_STRATEGY_SIMPLE`.
In addition to exposing `textBreakStrategy`, this change also fixes a couple of rendering glitches with `Text` and `TextInput`. `TextView` and `EditText` have different default values for `breakStrategy` and `hyphenationFrequency` than `StaticLayout`. Consequently, we were using different parameters for measuring and rendering. Whenever measuring and rendering parameters are inconsistent, it can result in visual glitches such as the text taking up too much space or being clipped.
This change fixes these inconsistencies by setting `breakStrategy` and `hyphenat
Closes https://github.com/facebook/react-native/pull/11007
Differential Revision: D4227495
Pulled By: lacker
fbshipit-source-id: c2d96bd0ddc7bd315fda016fb4f1b5108a2e35cf
Summary:
App will crash if result is null.
Closes https://github.com/facebook/react-native/pull/10338
Differential Revision: D4335305
Pulled By: lacker
fbshipit-source-id: 4910bfd7c56525a2ef1b252b56b8debd21fa2bae
Summary:
The reason for this change is to implement `allowFontScaling` on the Android's React Native Text component. Prior to this PR `allowFontScaling` only works for iOS.
The following link contains images of `allowFontScaling` working in Android on small, normal, large, and huge system fonts (from native Android display settings)
http://imgur.com/a/94bF1
The following link is a video of the same thing working on an Android emulator
https://youtu.be/1jTlZhPdj9Y
Here is the sample code snippet driving the video/images
```
render() {
const size = [12, 14, 16, 18];
return (
<View style={{backgroundColor: 'white', flex: 1}}>
<Text>
Default size no allowFontScaling prop (default true)
</Text>
<Text allowFontScaling={true}>
Default size allowFontScaling: true
</Text>
<Text style={{ marginBottom: 10, }} allowFontScaling={false}>
Default size allowFontScaling: false
</Text>
{ size.map(
Closes https://github.com/facebook/react-native/pull/10898
Differential Revision: D4335190
Pulled By: lacker
fbshipit-source-id: 0480809c44983644ff2abfcaf4887569b2bfede5
Summary:
When using React Native on Android on top of a game as an overlay, dialog windows sometimes get created with hardware acceleration disabled. This causes the UI to be unresponsive and anything that uses a TextureView stops working. Added a property for the modal view to make sure hardware acceleration flag is enabled when it's set to true.
**Test plan (required)**
set `hardwareAccelerated` property for Modal to force hardware acceleration on dialog windows on Android. Does nothing on iOS.
Closes https://github.com/facebook/react-native/pull/11421
Differential Revision: D4312912
Pulled By: andreicoman11
fbshipit-source-id: 9db6b2eca361421b92b24234b3501b5de0eecea7
Summary:
some server not work when upload a file with FromData in ios.
the reason is that there is a slash in boundary, like:
```
multipart/form-data; boundary=b/QeEbFgqK9PCZo4T/eXv7f.T74SHd5MxCZ846AsTz-yNV0xrRR_Zks4fkNMCzJck9ZE8o
// koa request.js (line 548)
is(types) {
if (!types) return typeis(this.req);
if (!Array.isArray(types)) types = [].slice.call(arguments);
return typeis(this.req, types);
}
// type-is index.js (line 237)
function normalizeType (value) {
// parse the type
var type = typer.parse(value)
// remove the parameters
type.parameters = undefined
// reformat it
return typer.format(type)
}
// media-typer
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
```
thanks for dougwilson 's [answer](https://github.com/jshttp/media-typer/issues/5).
> The / is an illegal character for Content-Type, which is what this module parses
Closes https://github.com/facebook/react-native/pull/11342
Differential Revision: D4326750
Pulled By: javache
fbshipit-source-id: b1c78a335c95a5c223537545d87beaffe15d673d
Summary:
Gestures now work with native animations so we can enable it, it is also not needed anymore to check if the native module exists since we print a warning in the Animated module now.
**Test plan**
Tested that animations and gesture work properly in the UIExplorer example. Also been using native animations with NavigationExperimental (ex-nav) in an app for a while.
Closes https://github.com/facebook/react-native/pull/11234
Differential Revision: D4321763
Pulled By: ericvicenti
fbshipit-source-id: 255bed5bfed3b93bdc10939b5a03d4d8b00ceade
Summary:
I was comparing `<TouchableOpacity>` to `UIButton` in iOS and it just doesn't feel native. The initial delay was fixed by https://github.com/facebook/react-native/pull/10866 but still there is a lag between button release and animation.
I'm also not sure what `_hideTimeout` was used for. When logging `touchableHandle*` events looks like `touchableHandleActivePressIn` is called first, then `touchableHandleActivePressOut` and then `touchableHandlePress`. Which means the fade in animation from `touchableHandleActivePressOut` was interrupted by `touchableHandlePress`.
Reviewed By: vjeux
Differential Revision: D4309789
fbshipit-source-id: b6d4df544952e11c2ade97d860531cbb2fada36b
Summary:
need to remove function declaration in a lexically nested statement
because babel uses 'use strict' by default now
Closes https://github.com/facebook/react-native/pull/11390
Differential Revision: D4308275
fbshipit-source-id: 0d073361d25b23fb67f001225feb72532af38683
Summary: No need to have two files; merge it into one and give it an appropriate name.
Reviewed By: javache
Differential Revision: D4296716
fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.
Reviewed By: javache
Differential Revision: D4296551
fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
Summary: Avoid using properties where unnecessary; stick to only one way to modify the delegate.
Reviewed By: javache
Differential Revision: D4296351
fbshipit-source-id: 94d0e3c90904ed584f691a3f28a15a7ac450c3e1