Summary:
I, like many before me, had to Google why react-native init appeared to hang the first time I tried it.
It turns out it can just take a really long time, but does not give any warning of this fact.
This patch provides such a warning.
Closes https://github.com/facebook/react-native/pull/9406
Differential Revision: D3716357
Pulled By: bestander
fbshipit-source-id: 6a460c881a20b9edb1bd1c8c5df09e5a7e5020ed
Summary:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3713704
fbshipit-source-id: ba182325c4f4003c0a7402ea87444a94c75ebaf8
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/9388
Differential Revision: D3715004
fbshipit-source-id: c12abcdd54ae1176aaf666eed520b85e2f8db6bd
Summary:
The Android lifecycle is weird: turns out `onActivityResult` is called before `onResume`. This means `getCurrentActivity()` could return the wrong instance, or `null` if the activity was destroyed. To give developers access to the Activity receiving the result (which is also about to become the current activity), pass it as an argumento the listener.
Fixes github issue #8694.
Reviewed By: donyu
Differential Revision: D3704141
fbshipit-source-id: e7e00ccc28114f97415e5beab8c9b10cb1e530be
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:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3703896
fbshipit-source-id: abc2a41144536baf969d346522a17044c1c9558b
Summary: This dependency on okhttp is unused. Removing this to lower the method-count increase from including the core RN modules.
Reviewed By: AaaChiuuu
Differential Revision: D3711870
fbshipit-source-id: 54b92edb4a55140b33cc74a5e9270650ced56ab9
Summary:
Currently we just try to resolve a rn-cli.config.js file by walking up the tree from node_modules/react-native. In non-standard uses of RN, when your copy of RN may not live within node_modules, it's impossible to use rn-cli.config.js. This PR adds a "config" flag to the cli that let's you pass in a path to rn-cli.config.js.
cc ide
Closes https://github.com/facebook/react-native/pull/7883
Differential Revision: D3382823
Pulled By: bestander
fbshipit-source-id: b946f3bb355050fc2fe99273d0e99e441dbed111
Summary:
This is a very hacky solution to make reloads from packager faster for simple file changes.
Simple means that no dependencies have changed, otherwise packager will abort the attempt to update and fall back to the usual rebuilding method.
In principle, this change avoids re-walking and analyzing the whole dependency tree, and just updates modules in existing bundles.
Reviewed By: bestander
Differential Revision: D3703896
fbshipit-source-id: 671206618dc093965822aed7161e3a99db69a529
Summary:
We have a weak build machine for React Native app: a poor Mac Book Air with HDD, which is very slow.
So, fs operations sometimes fail because of timeout.
We likely don't care about build time, but it's pretty annoying to restart builds sometimes.
In this PR I make timeout injectable via environment variable.
__USAGE__:
export this variable into environment. It's measured in miliseconds.
Example, for 1 minute timeout:
`export REACT_NATIVE_FSOP_TIMEOUT=60000`
If you don't specify it, it will remain default value: `15000`
This should not break anything, but repair slow builds.
Related to : #9373 , #8794 (I think so)
This PR should handle case of issue and close#9373
Closes https://github.com/facebook/react-native/pull/9374
Differential Revision: D3709325
Pulled By: bestander
fbshipit-source-id: b00c89e10d05362314546faea7a4524f3d327c97
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: This move lets us remove the dependency on okhttp3 from react/bridge. The classes I moved are all strictly related to dev support features and don't need to go into the core bridge module that gets shipped to production.
Reviewed By: AaaChiuuu
Differential Revision: D3698977
fbshipit-source-id: 6ba1517377061690cef289a544ec1622122cef85
Summary:
`ThemedReactContext` wraps the actual `ReactContext` but doesn't actually receive any lifecycle events, which would set `mCurrentActivity`, so that's always stuck as `null`. To fix, we override `has/getCurrentActivity` and forward the call to the wrapped context, which actually has the correct lifecycle status.
Fixes issue #9310 on github.
Reviewed By: mkonicek
Differential Revision: D3703005
fbshipit-source-id: 363e87ac91d50516899b413e823d5312cbb807f4
Summary:
After 3c4fd42749, `getLaunchOptions` no longer exists in class `ReactActivity`.
We need refactor UIExplorerActivity to fix the build error.
Closes https://github.com/facebook/react-native/pull/9320
Differential Revision: D3696381
Pulled By: astreet
fbshipit-source-id: 5700cf2363029a95cfbdaf6230e4f82ea69fb472
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:
LazyReactPackage is an extension of ReactPackage that allows us to lazily construct native modules.
It's a separate class to avoid breaking existing packages both internally and in open source.
Reviewed By: astreet
Differential Revision: D3334258
fbshipit-source-id: e090e146adc4e8e156cae217689e2258ab9837aa
Summary:
**Motivation**
For the `Text` component, if `numberOfLines` is set to `0`, the behavior on iOS is such that there is no limit.
On Android, the behavior is such that `numberOfLines={0}` will not render the `Text` component.
Since we want behavior to be the same across platforms, this change will make sure Android behaves the same as iOS.
**Test Plan**
Create a `Text` component specifying `numberOfLines={0}` on an Android project.
Expected:
- `Text` component displays, with no limit to number of lines.
Result:
- `Text` component does not appear at all.
Closes https://github.com/facebook/react-native/pull/9188
Differential Revision: D3697115
fbshipit-source-id: c1768ac22bab3c0e41a9df38b7314f3201512eb2
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: Add `isPrefSet` and `setPref` function to make I18nUtil cleaner
Reviewed By: fkgozali
Differential Revision: D3684958
fbshipit-source-id: 96f51d495d700d46096dc162c7599bc51a0b37cd
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:
**Motivation**
Android project for TicTacToe example is missing.
**Test plan (required)**
Open Android Studio and run TicTacToe-android-app. It builds and runs as expected.
Closes https://github.com/facebook/react-native/pull/8918
Differential Revision: D3684375
Pulled By: foghina
fbshipit-source-id: cd4112467179d3d334cab198d817ed8b5b32599b
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