Summary:
This pull request exposes the `setAllowUniversalAccessFromFileURLs` method of Android WebViewSettings as a property. The reason for this is when loading pages with a `file://` baseUrl it's sometimes desirable to allow loading other assets from a file base url. (For example loading an image into a canvas). More information on its use and purpose can be found [in the android docs here](https://developer.android.com/reference/android/webkit/WebSettings.html#setAllowUniversalAccessFromFileURLs%28boolean%29)
Usage example:
``` jsx
return (
<WebView
source={{ html: myhtml, baseUrl: 'file://' }}
allowUniversalAccessFromFileURLs={true}
javaScriptEnabled={true} />
)
```
Closes https://github.com/facebook/react-native/pull/8905
Differential Revision: D4147245
Pulled By: hramos
fbshipit-source-id: 7eaa884b8c0268de52b284954a34acec0fbd4061
Summary:
`flattenOffset` has proven extremely useful, especially when dealing with pan responders and other gesture based animations, but I've also found a number of use cases for the inverse. This diff introduces `extractOffset`, which sets the offset value to the base value, and resets the base value to zero. A common use case would be to extractOffset onGrant and flattenOffset onRelease.
Closes https://github.com/facebook/react-native/pull/10721
Differential Revision: D4145744
fbshipit-source-id: dc2aa31652df0b31450556f611db43548180c7dd
Summary:
This PR make [server port of react-devtools](https://github.com/facebook/react-devtools/blob/master/shells/electron/index.html#L71) can be changed, currently we can set the port yourself and open it, so I think it would be better if it could also be set here.
Another reason is I can debug two RN app (`react-native start --port 8082`), but I cannot let them use react-devtools together, it would be better if I set
different `__REACT_DEVTOOLS_PORT__` in `index.ios.js` and `index.android.js`.
Closes https://github.com/facebook/react-native/pull/10522
Differential Revision: D4144011
Pulled By: hramos
fbshipit-source-id: de67931f377092871a0fe92e7d9a18799625217e
Summary:
This is a minor edit to link the showcase page to the curated list of oss apps kept at react native news.
Closes https://github.com/facebook/react-native/pull/10758
Differential Revision: D4143534
Pulled By: hramos
fbshipit-source-id: 83f9b16a866ae25b13cf27f5f3a3c97a8d0b7271
Summary:
Solves issue #7632 where fonts with only a single font weight/type would not render.
Example of a built-in font that would not render is `Zapfino` and other custom fonts like `Impact` would not render.
Closes https://github.com/facebook/react-native/pull/10572
Differential Revision: D4143335
Pulled By: hramos
fbshipit-source-id: 2f64aad2fb5ddc7aae2ca7a5362a89b45e550e13
Summary:
The inline keyword is available only in C++. The __inline and __forceinline keywords are available in both C and C++. For compatibility with previous versions, _inline is a synonym for __inline.
https://msdn.microsoft.com/en-us/library/z8y1yy88(v=vs.120).aspx
Closes https://github.com/facebook/css-layout/pull/239
Reviewed By: astreet
Differential Revision: D4138941
Pulled By: emilsjolander
fbshipit-source-id: cb59dc91ef285e5378036c4912217fd4ec8d9f79
Summary:
This PR updates #6851 from srikanthkh, fixing coding conventions and javadoc, and adding a test plan.
Added testing functions into the WebSocketExample page of the UIExplorer, including a tiny http server to set a cookie on demand. Instructions included in the UIExplorer app.
Closes https://github.com/facebook/react-native/pull/9114
Differential Revision: D4140534
Pulled By: lacker
fbshipit-source-id: e020ad0c6d1d3ea09c0c3564c1795b4e1bc4517d
Summary:
Fixes#4740, where views would unnecessarily be retained after performing `navigator.pop()` - this was particularly problematic for big lists and memory-intensive custom views.
This fix causes no functional change: `_previousViews` are only used in the loop starting at line 564 to ensure that the JavaScript and Native navigation stacks are equivalent at all times. As we do in this fix, that loop limits itself to only the views expected to be on the React navigation stack. So overall this change makes the code logically 'more correct'.
Tested by checking that `_previousViews.count` is always equivalent to `previousReactCount` in the loop (which means we could remove the complex `MIN(... MIN(previousReactCount, _previousViews.count)` in the loop too, but I wanted to keep the diff as small as possible for now).
Closes https://github.com/facebook/react-native/pull/10789
Differential Revision: D4140502
Pulled By: ericvicenti
fbshipit-source-id: 4491ad3c16642914c3081295cf95c4cf36be9f94
Summary:
In the JNI portion of CSSLayout, there's a subtle bug where we were caching the jmethodid of the 'measure' of the first object that had measure called on it. However, if that class had overriden measure, then the jmethodid would be specific to that subclass's implementation and would not work for other classes. Conversely, if a regular CSSNode had been called first, then the super method would be called on the subclass instead of the proper overriden method.
Since there's not really a reason to overriden measure anyway (since you can just provide a different measure function), it's safest to just mark it final and explicitly cache the appropriate methodid
Reviewed By: emilsjolander
Differential Revision: D4132428
fbshipit-source-id: 6fb51597d80f1c03681e6611153b52b73b392245
Summary: We don't need to allocate a list for every node since leaf nodes don't have children.
Reviewed By: emilsjolander
Differential Revision: D4130818
fbshipit-source-id: 80d3e98fce9d2daa0676fd1cbed0e81edcf7adb3
Summary: Instead of silently ignorning non-leaf nodes with measure functions, we should assert that we don't create those kinds of trees.
Reviewed By: emilsjolander
Differential Revision: D4130770
fbshipit-source-id: a3ef10a2e63bbc12b5aa07977e4b84c8d59e3ffe
Summary:
The RunningOnDeviceAndroid doc had some Linux-specific instructions that are not relevant to macOS/Windows users.
Closes https://github.com/facebook/react-native/pull/10726
Differential Revision: D4139089
Pulled By: JoelMarcey
fbshipit-source-id: cc57c1d7e3c9dec94e123c3597ac78b3efb15dd0
Summary:
This does 2 things:
- modernize the component to use ES6 + flow
- assign `rootTag` to the child context
Each view in RN has its own `reactTag`. The reactTag for a root view is called `rootTag`. When there are multiple react root views active within the app (e.g. in a hybrid environment), rootTag is the only reliable "label" to differentiate them. This is especially useful when we want to limit an event/activity on a particular root view, instead of affecting all active root views. This allows components to do:
```
class Foo extends React.Component {
static contextTypes = {
rootTag: React.PropTypes.number,
};
componentDidMount() {
// Get the root tag of this component, which is static for all components under the same root view
console.log(this.context.rootTag);
}
}
```
In a pure JS RN app environment, there will always be exactly 1 root view, so `rootTag` may usually be ignored.
Reviewed By: yungsters
Differential Revision: D4130376
fbshipit-source-id: 559b67615f487bad754b5832ad4a02bcef05be2a
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/10763
Differential Revision: D4139069
Pulled By: JoelMarcey
fbshipit-source-id: ecc36f4e0ff4a44c95d63a256e0cdf67a4d386b3
Summary:
This diff updates `lodash` so that it's optimally deduped, resulting in:
* reducing the packager's load time by ~300-400ms.
* reduces the size of `node_modules` from ~225MB to ~148MB.
* reduces the time to do a clean `yarn install` from 35s to 18s.
Lots of dependencies (including every `babel-*`) use `lodash@4`, by having `lodash@3` as a root dependency, each package had to have it's own copy of `lodash@4`. Now, there's only one.
The uses of `lodash` in RN are restricted to the CLI/packager, and the uses are pretty basic. The breaking APIs don't really seem to affect us https://github.com/lodash/lodash/wiki/Changelog#v400.
Reviewed By: bestander
Differential Revision: D4124836
fbshipit-source-id: 0849c385fcafe10b463e684fea47be6775982386
Summary: The warning is only relevant to open source RN but shown to employees too.
Reviewed By: fkgozali
Differential Revision: D4137216
fbshipit-source-id: 21d5c3051c7964231eeb3f555681a83eacb4c972
Summary:
This reverts a change in #10660 that swapped the locations of the prev/next links across the entire site. It made sense in the blog, but not so much in the docs.
Closes https://github.com/facebook/react-native/pull/10753
Differential Revision: D4133501
Pulled By: lacker
fbshipit-source-id: 92ee35b1bd5575401e548f8290db3fb7cf0f56a1
Summary:
`NavigationCardStackPanResponder` uses `__getValue` and the `stopAnimation` callback value which both doesn't work with native driven animation. The workaround here is to add a value listener so the JS value of the AnimatedValue gets updated too so `__getValue` has a relatively up to date value. This value should be good unless JS lags behind native a lot but that should not happen during a navigation gesture. Also added a comment that explains the hack.
**Test plan**
Tested in an app that uses native driven animations with a back gesture. This also needs #10643 and #10641 for everything to work properly.
Closes https://github.com/facebook/react-native/pull/10642
Differential Revision: D4135496
Pulled By: ericvicenti
fbshipit-source-id: 395aff78b16a37ad9407207a05504fdd6311f733
Summary:
Fixes breakage on https://circleci.com/gh/facebook/react-native/12763 after the upgrade of React
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Jest preset has been upgraded so that requiring `React` capitalized can be possible
**Test plan (required)**
Couldn't reproduce it locally, we need to see if Circle passes.
Closes https://github.com/facebook/react-native/pull/10749
Differential Revision: D4132150
Pulled By: bestander
fbshipit-source-id: e41fb95b6677113fc6a3bf8bbce9247f59aa81dd
Summary:
Since native and non-native animations do not work together check if the animated value is native and set useNativeDriver accordingly. So untill we move to always using the native driver this is needed. This and another fix in NativeAnimations module will allow using native animations to transitions with gestures.
**Test plan**
Tested in an app that uses native driven animations with a back gesture. This also needs #10643 and #10642 for everything to work properly.
Closes https://github.com/facebook/react-native/pull/10641
Differential Revision: D4135972
Pulled By: ericvicenti
fbshipit-source-id: 8e65574ebb296da044f4d03bf1eedee4a37ebdac
Summary:
further discussion: should there be a `onClose` or `onClosed` to pair with `onShow`? which would make a workaround for #10471 much easier
Closes https://github.com/facebook/react-native/pull/10669
Differential Revision: D4133832
Pulled By: hramos
fbshipit-source-id: 644a5bb6b9da697c81fc96ae4da196ba5b4050cb
Summary:
Check that 'react-native init' itself used yarn to install React Native.
When using an old global react-native-cli@1.0.0 (or older), we don't want to install React Native with npm, and React + Jest with yarn. Let's be safe and not mix yarn and npm in a single project.
**Test plan**
Publish the code in this PR to Sinopia, use that when creating a new project.
Using old CLI:
npm install -g react-native-cli@1.0.0
react-native init AwesomeApp
The generated project doesn't contain `yarn.lock` (everything was installed with the npm client).
---
Using new CLI:
npm install -g react-native-cli@1.2.0
react-native init AwesomeApp
The generated project contains `yarn.lock`, output shows that yarn is used to install React Native, React, Jest.
---
In both cases the project runs and Reload JS works:
![screenshot 2016-11-04 17 20 50](https://cloud.githubusercontent.com/assets/346214/20015719/719effb0-a2b4-11e6-84a0-43474314009b.png)
Closes https://github.com/facebook/react-native/pull/10752
Differential Revision: D4131812
Pulled By: bestander
fbshipit-source-id: efaaf97a27005e2c2d10cae5d07afe108d5c0dee
Summary: In addition to adding flow in that file, I also had to fix `Module.js` and others to make everything compatible together.
Reviewed By: davidaurelio
Differential Revision: D4118829
fbshipit-source-id: 4f6dbc515741c38817cc4c9757e981fabb03915a
Summary:
Hi!
Just noticed an incorrect description for the `hidden` argument for `StatusBar.setHidden()` on the website, this trivial change fixes that.
FYI I followed the start procedure for the website mentioned in [CONTRIBUTING.md](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests), and noticed one needs to run `npm install` in the project root directory as well before starting the website. Do you want me to add that instruction as part of this PR, or as a separate PR entirely?
Closes https://github.com/facebook/react-native/pull/10735
Differential Revision: D4131223
fbshipit-source-id: b70c5ef12e72807445c51f13811537b9fa3b6b3e
Summary:
The new Packager/Buck integration passes module factory functions as first argument, so that the complete call can be amended at the end safely at a later point in time.
The call expression as a whole is covered perfectly by the created source map. Appending to that code later won’t break mappings.
`__d` now also accepts an additional `dependencyMap` parameter, which so far is only used by the new Packager/Buck integration. It enables module-local dependency IDs, thus eliminating the need to insert `correct` module IDs when building a bundle. Advantages are that source maps are no longer affected, and that builds can be quicker.
Reviewed By: cpojer
Differential Revision: D4124333
fbshipit-source-id: 12eba15d0b9d8c6624280a2ba1e7e4bc654bc83d
Summary:
increase the `MAX_WAIT_TIME` in FileWatcher since live reloading doesn't work for a lot of users on windows when developing android. There may be a better timeout than arbitrarily tripling it, I'm sure the original developer would be able to pick out a good one, but many of us have used this change to finally be able to use RN here on windows.
fixes https://github.com/facebook/react-native/issues/8784https://github.com/facebook/react-native/issues/7257
Closes https://github.com/facebook/react-native/pull/10690
Differential Revision: D4126110
Pulled By: mkonicek
fbshipit-source-id: 9b6f188fe9d39bcdcc2b38392dfc644a518296b2
Summary:
Compared to the `<MapView>` that comes with React Native, [react-native-maps](https://github.com/airbnb/react-native-maps) work on Android and is more feature complete. It is actively maintained and used extensively (9.2k installs / month, see [JS.Coach](https://js.coach/react-native/react-native-maps?search=react-native-maps)).
We think now is a good time to switch to react-native-maps in your applications and make `react-native-maps` the official `<MapView>` implementation for React Native.
We are going to release the deprecated `<MapView>` as a separate npm module so you can migrate to `react-native-maps` at your own pace.
**Test Plan**
Checked the docs render correctly on the website:
```
cd website
npm install
npm start
```
<img width="696" alt="screenshot 2016-11-01 20 17 31" src="https://cloud.githubusercontent.com/assets/346214/19905831/480074b8-a070-11e6-8779-8e12343c2883.png">
Warning is shown:
<img width="423" alt="screenshot 2016-11-01 20 39 21" src="https://cloud.githu
Closes https://github.com/facebook/react-native/pull/10500
Differential Revision: D4119602
Pulled By: mkonicek
fbshipit-source-id: 86780a98bf999e6047565ab66a5ebbd15e499a46