Summary: Removes the inspector click handler that was stealing the scroll gesture from `ScrollView`. Instead, I've added a "Minimize" button. This also fixes a bug where the `ScrollView` was appearing underneath the button bar (and therefore permanently obscuring the last few lines of the warning).
Reviewed By: jingc
Differential Revision: D3725499
fbshipit-source-id: 1ec0e0ddf5e1e50989e297811a32779e6610c745
Summary:
Assert that the return value of these methods is sane.
Closes https://github.com/facebook/react-native/issues/8108
Reviewed By: majak
Differential Revision: D3722629
fbshipit-source-id: 2a67daae6dc380721e5dad27acd2ab67f71d0c6c
Summary:
`<Text>` accepts more than just string as its children; and it's handy to be able to style nav titles without a proptype warning throwing
Closes https://github.com/facebook/react-native/pull/8338
Differential Revision: D3719045
fbshipit-source-id: a02d181b5e133dbe467fbaca794f0d2119be2da7
Summary:
- Define a Styles type for the object that gets passed into StyleSheet.create
- Define a StyleSheet type that is returned from StyleSheet.create
- Clean up the type declarations in StyleSheet.create
Closes https://github.com/facebook/react-native/pull/8882
Differential Revision: D3587964
Pulled By: gabelevi
fbshipit-source-id: 629e0176484436848be69b1417638e1200a3669a
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
The Android permissions native module was open sourced recently (b7352b4667) but it is currently undocumented and requires directly interfacing with the native module.
This provides a JS wrapper to make it easier to use the permissions module and documents it.
This could be cleaner if the native code used Promise blocks instead of callbacks, but I didn't want to change the native code without a thumbs up since I'm guessing this is used in one of facebook's apps. Happy to do that if it makes sense
I also tried to make the `PERMISSIONS` object a class property - it works in the actual code but not in the documentation (think it's a jsdocs problem), so decided to initialize in the constructor.
**Test plan (required)**
If the API looks good, I will change the UIExplorer example to use this.
cc andreicoman11
Closes https://github.com/facebook/react-native/pull/9292
Differential Revision: D3716303
Pulled By: andreicoman11
fbshipit-source-id: cd40b8757fdf70ea8faecfb58caa00e99a99789e
Summary:
We only want to call onTransitionEnd after the transition has fully completed, including scene cleanup.
This will help avoid race conditions when we start new navigation after a transition completes.
Reviewed By: fkgozali
Differential Revision: D3712235
fbshipit-source-id: 146f30a0caf3d2fe164285fbef12293b7b161c6e
Summary:
Adds support for `Animated.Value#addListener` for native driven animated values. Same as #8844 but for iOS. This depends on some JS code in #8844 so only review the 2nd commit and let's wait for #8844 to land first.
**Test plan**
Tested using the UIExplorer example.
Closes https://github.com/facebook/react-native/pull/9194
Differential Revision: D3681749
fbshipit-source-id: 521a61e2221c1ad1f6f40c75dd2dc957361d0271
Summary:
fixes#7795fixes#8500
Motivation: When having a simple button that changes the Image source when tapped, the image doesn't change (or at least sometimes, intermittently it works).
This was found to be an issue where the request was being sent to the native layer correctly but then being subsequently cancelled by the `reactSetFrame: method` ...
Closes https://github.com/facebook/react-native/pull/9137
Differential Revision: D3702867
Pulled By: javache
fbshipit-source-id: c89ce6b841179394b6b23850b3128751ef9e0313
Summary:
The `shouldComponentUpdate` policies were meant to be a built-in optimization, but it prevents rendering at unexpected times, which has been causing confusion. Apps can use normal react optimization techniques to avoid extra rendering- Navigation will no longer attempt to optimize the render tree
Addresses https://github.com/facebook/react-native/issues/7720
Reviewed By: hedgerwang
Differential Revision: D3649735
fbshipit-source-id: 9461620445a6a57a1635113df7ec4026c0d6b9d2
Summary:
Ground work for allowing `font-variant`s. Currently allows switching between `tabular-nums` and `proportional-nums`. I will need guidance on how to test this, and a few pointers on code style (new to Objective C, and had to make one or two hacks).
Closes https://github.com/facebook/react-native/pull/9045
Reviewed By: majak
Differential Revision: D3664338
Pulled By: javache
fbshipit-source-id: 032f326c37ee6150348da2b33b6a3fc1988e8920
Summary:
This should not happen again:
Summary of all failing tests
FAIL Libraries/Animated/src/__tests__/bezier-test.js (0.259s)
● bezier › symetric curves › it should have a central value y~=0.5 at x=0.5
- Error: expected '0.5015953397493733' to be close to '0.5' with 3-digit precision
at assertClose (Libraries/Animated/src/__tests__/bezier-test.js:9:11)
at Libraries/Animated/src/__tests__/bezier-test.js:84:1
at Libraries/Animated/src/__tests__/bezier-test.js:28:22
at Object.<anonymous> (Libraries/Animated/src/__tests__/bezier-test.js:81:11)
Closes https://github.com/facebook/react-native/pull/9316
Differential Revision: D3690223
Pulled By: davidaurelio
fbshipit-source-id: 3ee0a283206680203a8b685d4ee5a430ef821704
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.
This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.
This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))
**Usage example**
```js
Alert.alert(
'Alert Title',
null,
[
{text: 'OK', onPress: () => console.log('OK Pressed!')},
],
{
cancelable: false
}
);
```
**Test plan (required)**
I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes https://github.com/facebook/react-native/pull/8652
Differential Revision: D3690093
fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
Summary:
We're mutating dictionaries on one thread for bookkeeping (anytime we receive a call over the bridge) and iterating over them on the main thread each frame (in `updateAnimations`). Seems like this can all happen on the main thread without issue. Am I missing something?
**Test plan (required)**
Run UIExplorer NativeAnimated examples before and after - compare the results. Nothing should have changed.
Closes https://github.com/facebook/react-native/pull/9049
Differential Revision: D3682871
fbshipit-source-id: c6de62063e724b15b9678a9ef0290284e928b31b
Summary:
This adds support for the `transform` animated node. This brings feature parity with the iOS implementation and allows running the NativeAnimated UIExplorer example that was created with the iOS implementation on Android. This is based on some work by kmagiera in the exponent RN fork.
This also adds support for mixing static values with animated ones in the same transform as well which is not supported on iOS at the moment. It is also implemented in a way that rebuilds the transform matrix the same way as we build it in JS so it will be easy to remove some of the current limitations like forcing the transforms order and only supporting one of each type.
**Test plan (required)**
Tested with the NativeAnimated example on Android and iOS. Also tested mixing in static values in a transform (`[{ rotate: '45deg' }, { translateX: animatedValue }]`).
Closes https://github.com/facebook/react-native/pull/8839
Differential Revision: D3682143
fbshipit-source-id: 5e6fd4b0b8be6a76053f24a36d1785771690a6f8
Summary:
`Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js` attempts to setup global variables typical in most JavaScript environments. It finds the previous property value using `Object.getOwnPropertyDescriptor` and preserves it as `original[PropertyName]` (if it existed), it then redefines the property using `Object.defineProperty`.
Properties may only be redefined if the property descriptor specifies that it is configurable ([MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor)). Attempting to redefine an non-configurable property will result in an error: `TypeError: Cannot redefine property: [PropertyName]`.
Not all properties being setup in `InitializeJavaScriptAppEngine.js` are necessarily configurable in the target environment.
Closes https://github.com/facebook/react-native/pull/9244
Differential Revision: D3679683
fbshipit-source-id: cd3398ef2cdf38e58c58862e64b159951c2b22c2
Summary:
This change adds support for spring animations to be run off the JS thread on android. The implementation is based on the android spring implementation from Rebound (http://facebook.github.io/rebound/) but since only a small subset of the library is used the relevant parts are copied instead of making RN to import the whole library.
**Test Plan**
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Add `useNativeDriver: true` to spring animation in animated example app, run it on android
Closes https://github.com/facebook/react-native/pull/8860
Differential Revision: D3676436
fbshipit-source-id: 3a4b1b006725a938562712989b93dd4090577c48
Summary:
In #7916 I moved transform matrix decomposition logic from JS to java. The next step is to accept list of transforms instead oftransform matrix as a transform ReactProp. This way there is no extra processing required on JS side for the transform param (at least for android now) and this on the other hand allow us to execute transform updates (through offloaded animation) solely on the UI thread.
After this change there is a whole bunch of stuff from `Libraries/Utilities/MatrixMath.js` that can be deleted (methods like: determinant, inverse, transpose). Although astreet mentioned under one of my previous commits that the code is still being referenced internally at fb, so I decided not to delete it here.
**Test plan (required)**
Run UIExplorer Transform example before and after - compare the results
Run android unit test: com.facebook.react.uimanager.MatrixMathHelperTest
Closes https://github.com/facebook/react-native/pull/8892
Differential Revision: D3676017
Pulled By: astreet
fbshipit-source-id: 5275e30805a85c12c89bea44e8b3a2b2ec7b33fa
Summary:
I've seen quite a few newbs trip on this, so I'm fixing it.
First - you have to set the width/height on a remote image, otherwise nothing shows. This is [even on stack overflow](http://stackoverflow.com/questions/30091398/unable-to-display-image-with-react-native-with-uri).
Second - with the addition of ATS in iOS most people who copy/paste this example will not be able to load an insecure image, so I changed it to the `https`.
**RESULT** this doc becomes copy/paste friendly again for beginners.
Closes https://github.com/facebook/react-native/pull/9235
Differential Revision: D3675478
Pulled By: JoelMarcey
fbshipit-source-id: 5b414caa40cda72dec4eace686278c26c251c4bb
Summary:
Consistently namespace all of css-layout's public C API with "CSS". The only function that needed to be renamed was isUndefined, which I renamed to CSSValueIsUndefined.
Fixes#210.
Closes https://github.com/facebook/css-layout/pull/211
Reviewed By: lucasr
Differential Revision: D3674922
Pulled By: emilsjolander
fbshipit-source-id: 1752f477bde45586db112fe2654d0404cc52e1d1
Summary:
The `NativeAnimationsExample` in Android can not work due to inputRange and outputRange were limited to double array type, which is different from iOS.
So we need let android version to support string array type.
Closes https://github.com/facebook/react-native/pull/8900
Differential Revision: D3674754
fbshipit-source-id: e7844f00940bf0fdd6f7f5003dd4eeefa0c317a0
Summary:
Not a API change, but this may break the layout of exisitng apps that
uses NavigationHeader.
For now, NavigationHeader uses absolute position, which makes it hard for
NavigationCardStack to determine the height of the scenes.
Theoretically, the height of the scenes would be the height of the cards
stack minus the height of the header.
That said, if we want to support the headers with different height (e.g.
MyIOSHeader or MyAndroidHeader), we're forced to expose the height of the
headers and manually compute the height of the scenes.
Alternatively, if the header does not use absolute position, the height
of the scenes can adjust automatically with flex box, and that's what this
commit is about to do.
Reviewed By: ericvicenti
Differential Revision: D3671119
fbshipit-source-id: 26e48f801da3661c5d7dce4752ba927621172f4a
Summary:
Adds support for `Animated.Value#addListener` for native driven nodes on Android. This is based on work by skevy in the exponent RN fork. Also adds a UIExplorer example.
** Test plan **
Run unit tests
Tested that by adding a listener to a native driven animated node and checked that the listener callback is called properly.
Also tested that it doesn't crash on iOS that doesn't support this yet.
Closes https://github.com/facebook/react-native/pull/8844
Differential Revision: D3670906
fbshipit-source-id: 15700ed7b93db140d907ce80af4dae6be3102135
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions
Reviewed By: fkgozali
Differential Revision: D3663693
fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
Summary:
Currently, the NavigationExperimental `Header` only renders correctly on iOS when the system status bar is visible. There are legitimate reasons to hide the status bar, especially when displaying in landscape.
This PR adds a `statusBarHeight` prop to the header, which defaults to 20 on iOS and 0 (no status bar) on Android. Changing this value causes the extra space at the top of the header reserved for the status bar to change.
I've tested this change in my own app on iOS with `statusBarHeight` set to 0, 20, and `undefined`, and ensured that it works correctly.
Closes https://github.com/facebook/react-native/pull/8983
Differential Revision: D3668637
fbshipit-source-id: 777a0c53e8fd1caa35ce4980ca3118adcf83b62d
Summary:
NavigationCardStack is a custom component, and its API should be explicit, not
too generic..
In NavigationCardStack, the prop `renderOverlay` is actually used to render
the NavigationHeader, and we uses absolute position to build the layout for
the header and the body.
One of the problem with using absolute postion and fixed height to build the
layout that contains the header is that the header can't have variant height
easily.
Ideally, if the layout for the header used flex-box, we'd ve able to be more
adaptive to deal with the header that has variant height.
That said, let's rename `renderOverlay` to `renderHeader`, then build the
proper layout that explicitly works better with the header.
If we to need to support overlay in navigation, we may consider add
`renderOverlay` later, if it's really necessary.
Reviewed By: ericvicenti
Differential Revision: D3670224
fbshipit-source-id: ff04acfe9dc995cb57117b3fd9b07d5f97b9c6ee
Summary:
This PR adds a capability for MessageQueue to emit "SPY" events in a way that can be extensible, to later allow for a tooling ecosystem to grow, one example is the existing [Snoopy](https://github.com/jondot/rn-snoopy) tool that is, for now, forced to work with monkeypatches, and after this PR will be able to use a "formal" way to trace queue events.
After this change, we can wire a "spy" into a queue that will expose the events in different and interesting ways, see below (done with Snoopy):
<img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>
<img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy-filter.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>
This removes the hardcoded `SPY_MODE` flag and instead uses a function that can be injected from outside world.
```javascript
MessageQueue.spy((info)=>console.log("event!", info)
```
It also creates
Closes https://github.com/facebook/react-native/pull/9160
Differential Revision: D3669053
Pulled By: javache
fbshipit-source-id: 3e4462aa77fc8514d2ea4f15430f7bec57b583a4
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/8999
Differential Revision: D3664512
Pulled By: javache
fbshipit-source-id: 030fe4752e53efcde21baadfc2502413b7fc9c8c
Summary:
The docs heavily implied that this method returned a notification object or null directly, like popInitialNotification used to do. In fact, it returns a promise. This change clarifies this.
Note that:
- This is purely a comment change, so no testing required.
- I've adhered to the 80 character line limit, and can't think of any other style rules you might have that could apply here.
Closes https://github.com/facebook/react-native/pull/9052
Differential Revision: D3662807
Pulled By: javache
fbshipit-source-id: 7a2573e03d7704b2d62a3499d350506ae73e8d77