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:
Simply adding myself to the Github Issue Task Force so I can help out closing, tagging or whatever is needed for the issues.
Thanks!
Closes https://github.com/facebook/react-native/pull/9311
Differential Revision: D3690115
fbshipit-source-id: feb063df4f7d811e36d0d03dfad395e069d5b142
Summary:
`error` is not an object so `error.message` will return 'undefined'
Closes https://github.com/facebook/react-native/pull/9271
Differential Revision: D3689980
Pulled By: javache
fbshipit-source-id: 07de946f04cdff0e8013faa2c5512c51c82147b9
Summary: This removes asset data that is not used at runtime from the bundle.
Reviewed By: javache
Differential Revision: D3628486
fbshipit-source-id: 33cd579c904e0b0e29502df39a4ff92cad43367c
Summary: This shortens the source map URL to its basename for bundles built via the command line API. This makes builds reproducible across different file system locations.
Reviewed By: michalgr
Differential Revision: D3684263
fbshipit-source-id: 2d5fdb5c5d0aa229f5a85465b2d1919f54e33d55
Summary:
This PR addresses issue #9265.
Negated the condition that checks if `_hostViews` exists so that `_hostViews` will be allocated only if it doesn't exist
Closes https://github.com/facebook/react-native/pull/9295
Differential Revision: D3686214
fbshipit-source-id: ec0caac99d231786eefad023f3f0ed44a79f687e
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/9289
Differential Revision: D3684467
Pulled By: hramos
fbshipit-source-id: 625b01f1e21c526048832d2c4af0d37f02fed44e
Summary: Add FragmentActivity-based ReactFragmentActivity to support apps using the v4 support lib. Add delegate class to share implementation details between the new class and ReactActivity.
Reviewed By: astreet
Differential Revision: D3655428
fbshipit-source-id: d3ff916538e13b6f0d594bbb91555e322645e954
Summary:
If a paused activity is destroyed (e.g. because of resource contention), we send onHostDestroyed to all modules even if there's an on-screen, resumed activity using the current react instance.
This diff adds a check to make sure lifecycle events come from the current activity, and ignores ones that don't.
Reviewed By: astreet
Differential Revision: D3655422
fbshipit-source-id: 0f95fda124df3732447853b9bc34c40836a4b1da
Summary: It doesn't make sense to clear mCurrentActivity in onHostPause -- we're not going to leak a paused activity. Only keeping it around after onDestroy could lead to leaks. This allows us to check the source of lifecycle events and only send them if they come from the current activity (upcoming diff).
Reviewed By: astreet
Differential Revision: D3655370
fbshipit-source-id: f54b04a95c5c090636219832e63a348f3ae5a5c3
Summary:
React 15.3.0 was officially released. We especially should try not depend on RCs in RN releases and npm doesn't handle RC versions well.
Closes https://github.com/facebook/react-native/pull/9279
Differential Revision: D3683587
fbshipit-source-id: fc4f8a030769232b7697434a419e1e07e482e308
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:
via commit 8c29a52c54 , the way has changed building offline bundle. So this commit update the docs about that.
Closes https://github.com/facebook/react-native/pull/9186
Differential Revision: D3682643
Pulled By: JoelMarcey
fbshipit-source-id: 3e4127ca0c00f254dc3464e73c1c2496c0710b85
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:
https://github.com/facebook/react-native/pull/8219 adds range requests to the asset server, but there was an off-by-one-error that made responses end prematurely. This made (for example) react-native-video not work for video assets. This change fixes the off-by-one error and react-native-video works with assets.
**Test plan (required)**
Try the test in the original pull request for range requests: https://github.com/facebook/react-native/pull/8219
Closes https://github.com/facebook/react-native/pull/9254
Differential Revision: D3680070
fbshipit-source-id: 3f2a18ba9f35b45b340f4a1046bc099b8444eb7d
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:
Updating the RN version 0.31, so that doc is also upto date with latest version.
Closes https://github.com/facebook/react-native/pull/9247
Differential Revision: D3677606
fbshipit-source-id: 8ec5999dfaa243377d85a533935ccfe2d4c97fae
Summary:
Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
Rename allowRTL and setAllowRTL functions
Differential Revision: D3673601
fbshipit-source-id: 98f9c99e8a6948336fb918c24566dc9e5c0a3a3e
Summary:
When you call `-[RCTConvert UIFont:withFamily:...]` with a non-nil font object, we'll try to use the existing font object for system information. On iOS9+ which uses the San Francisco font, `[UIFont fontNamesForFamilyName:]` doesn't return anything useful, so we need to make sure that we detect this as a system font and use the appropriate methods. This issues is made worse by the fact that RCTTextView and friends recreate the font property for every attribute that is set (pretty horrible perf-wise).
This fixes https://github.com/facebook/react-native/issues/2140
Reviewed By: sahrens
Differential Revision: D3662751
fbshipit-source-id: c528e8945ed361a922c03f861d3c0b584658573b
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:
Since the core layout in RN is now assigning `left/right` to `start/end`, we need to tweak the text input handling as well:
1. We need to replace all left/right to start/end
2. For text inset padding, we need to manually flipped the padding in RTL situation.
Reviewed By: fkgozali
Differential Revision: D3670277
fbshipit-source-id: 442bead25af8548a85dd1f359aa5a799982d1185