Summary:
One of the impacts of this bug is that Java is firing timer
completion events into JavaScript for timers that should have
been deleted. JavaScript filters these out so it doesn't impact
the app developer. However, Java is completing more timers
than necessary.
When cleaning up a timer, we were accidentally deleting the
whole set of timers for that context. Instead, we should
just delete that timer from its context.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9361
Differential Revision: D3797573
fbshipit-source-id: c30ed600af741601f2babdfc61da9aac549cbadb
Summary: Add a static `Image.queryCache` function that can query multiple URLs at once. The result is a map where each URL that is in cache is mapped to the cache type (memory/disk). URLs that are not cached do not appear in the result.
Reviewed By: lexs
Differential Revision: D3791333
fbshipit-source-id: b183015d97423f0c095bf891f035dac2e23d8d11
Summary: I noticed we're doing too much manual work here, when Fresco has a nice handy shortcut for clearing all caches.
Reviewed By: kirwan
Differential Revision: D3791356
fbshipit-source-id: 4a55d0280e9483267741ae75383b50ca0b74c5c6
Summary:
`BackAndroid.addEventListener()` returns a subscription object with a `remove()` function in android. Before this fix, the iOS equivalent doesn't return anything, which means, if there's a component doing something like this, it would redbox:
```
componentWillMount() {
this._subscription = BackAndroid.addEventListener('hardwareBackPress', () => {...});
}
componentWillUnmount() {
this._subscription.remove(); // --> redbox in iOS before this fix
}
```
Differential Revision: D3790480
fbshipit-source-id: 1e607171bf2892a6b64977c4fd052c5df0bc4a0d
Summary:
This makes the Text component more consistent with the contracts implemented by the Touchable* components.
**Test plan (required)**
Verified the event object gets passed to the `onPress` and `onLongPress` handlers in a test app. Also, this change is being used by my team's app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9657
Differential Revision: D3790550
fbshipit-source-id: 026b579ef6b354d9519abd5e9a92f0d562159132
Summary:
`mRCTEventEmitter` is used by 2 different threads. It's assigned on the UI thread and it's accessed on the JavaScript thread. Currently, it can be the case that the UI thread assigns `mRCTEventEmitter` and later the JS thread accesses it but still sees null.
This change fixes the issue by marking the `mRCTEventEmitter` variable as `volatile` to ensure that both threads see the same value for `mRCTEventEmitter`.
**Test plan (required)**
This change is currently used in my team's app. We're no longer seeing a crash in `EventDispatcher`.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9655
Differential Revision: D3790888
Pulled By: andreicoman11
fbshipit-source-id: 68cdbc74faffb36dc2bca8ad3d4a78929badbe9c
Summary:
The overflow prop needs to be set on the shadow view so that it can make its way into the layout engine. In some situations, the value of the overflow prop affects the calculations of the layout engine.
**Test plan (required)**
Verified in a test app that the `overflow` prop makes its way into the layout engine. Also, my team's app is currently using this change.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9659
Differential Revision: D3790552
fbshipit-source-id: 61513ece63ae214f48c6cb6f40fb29757a0ac706
Summary:
Several blog and sharing improvements are included in this update.
* A larger default preview image is used when a blog post or doc is shared on social media as recommended by [best practices](https://developers.facebook.com/docs/sharing/best-practices#images).
* Follow other Facebook Sharing best practices such as associating the site with a Facebook Page (React) and a Page Admin (121800083 is my fbid, and I am an admin for the React page).
* If the shared blog post contains a hero image, use it as a share preview image.
* Use actual doc content instead of generic site description when sharing docs.
* Update existing hero images to use the larger recommended size.
* Add titles to each author's byline.
* Add author's avatar to their byline.
* Add Twitter Card support.
* Link to individual blog posts from the title and hero image in the blog index.
Old metadata tags (blog post):
```
<meta property="og:title" content="Toward Better Documentation – React Native | A framework for building native
Closes https://github.com/facebook/react-native/pull/9648
Differential Revision: D3790332
Pulled By: hramos
fbshipit-source-id: 4f284c6440482df8a42a2b8467ccf56b1fd725d1
Summary: Added support for WebViews to take in an onContentSizeChange prop, which will return a native event that contains the width and height of the html content in the WebView. Also moved the ContentSizeChangeEvent from the recyclerview dir to the uimanager/events dir
Reviewed By: andreicoman11
Differential Revision: D3775399
fbshipit-source-id: 19a0579f8345e5853cc7311b80f1f1393c77ab58
Summary:
**Motivation:** We have a project that dynamically changes classes in runtime. This component is initialised within the React Native context. Therefor `RCTBatchedBridge` copies the classes before changes are made to them. While React Native is running, changes are made to the classes dynamically. When the project reloads the `RCTBatchedBridge`, it now has an invalid list of classes containing trash pointers. This causes the project to crash on https://github.com/facebook/react-native/blob/master/React/Base/RCTBatchedBridge.m#L288 with EXC_BAD_ACCESS in the DEBUG-mode.
**Solution:** Copy the class list on each reload to get the current state. Since this is only a DEBUG-feature the overhead of this should not be a major issue.
Closes https://github.com/facebook/react-native/pull/9541
Differential Revision: D3775012
Pulled By: javache
fbshipit-source-id: d55fa0742ca100d8018c73080230cf718aa5a7e9
Summary:
Provide a sample new issue template to encourage people to provide additional detail as needed. This should help us reduce the number of new issues that are opened without sufficient information or actionable requests.
The minimal use of markdown is intentional, as these guidelines are more likely to be found in raw text inside the [new issue composer](https://github.com/facebook/react-native/issues/new) rather than rendered to HTML.
Closes https://github.com/facebook/react-native/pull/9074
Differential Revision: D3785606
Pulled By: hramos
fbshipit-source-id: 9982566a0f0d86c71eeface33bd0624a4a9935b2
Summary: added API to in UIManager to find the rootTag/View of any reactTag based on its layout (shadow views) hierarchy (not to be used by JS)
Reviewed By: javache
Differential Revision: D3750410
fbshipit-source-id: 68611e39930d53ece478f25245ddc7f7838daaa6
Summary:
The MessageQueue has a _debugInfo object where it stores debug information associated with each callback. The size of this structure is currently unbounded.
It looks like the code attempted to restrict _debugInfo to a fixed number of entries but due to a logic bug, it leaked around 30 entries for every 1 entry it cleaned up.
This change limits the _debugInfo object to around 30 entries.
**Test plan (required)**
This change is currently being used in my team's app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9611
Differential Revision: D3781875
fbshipit-source-id: 58c645c52c3e295fe571b7ca7e0d882169c301ef
Summary:
Running the command `./gradlew clean` resulted in the following error:
```
./node_modules/react-native/ReactAndroid/src/main/jni//xreact/jni/Android.mk:42: *** Android NDK: Aborting. . Stop.
Android NDK: ./node_modules/react-native/ReactAndroid/src/main/jni//xreact/jni/Android.mk: Cannot find module with tag 'cxxreact' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
```
The problem was that `REACT_COMMON_DIR` wasn't defined.
**Test plan (required)**
Running `./gradlew clean` now works.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9607
Differential Revision: D3780364
fbshipit-source-id: 2b45d538413f7ee2cf0b36a1fa33287f0b1bf23f
Summary:
This adds cookie clearing support for iOS to match the existing support on Android. Helpful for resetting the app to a clean state (say, when logging a user out).
Closes https://github.com/facebook/react-native/pull/9264
Differential Revision: D3776492
Pulled By: javache
fbshipit-source-id: 59ae19ac09d3cf0d0e229cd9e8e30865e65ca96c
Summary:
This is a revised follow up version from #8574 ( originally implemented in `objc` )
This PR change the implementation in JS suggested by javache
**motivation**
To supports vibration pattern like android.
The [iOS vibration implementation link](http://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios/13047464#13047464) mentioned by skv-headless at https://github.com/facebook/react-native/pull/6061#discussion_r54062592, which will not be accepted by apple since that implementation uses a private API. Thus, I use pure public API `NSTimer` to implement it.
**Note**
Since vibration time on iOS is not configurable, there are slightly differences with android.
for example:
**Android Usage:**
`Vibration.vibrate([0, 500, 200, 500])`
==> V(0.5s) --wait(0.2s)--> V(0.5s)
`Vibration.vibrate([300, 500, 200, 500])`
==> --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s)
**iOS Usage:**
if first argument is 0, it will not be included in pattern array.
( vibration
Closes https://github.com/facebook/react-native/pull/9233
Differential Revision: D3775085
Pulled By: javache
fbshipit-source-id: 370495857d5581399de32d2bed1ea1bcce193e9d
Summary:
Due to an earlier commit, we now have to use the full path for requiring `performanceNow`.
**Test plan (required)**
Verified that the IncrementalExample works when adding it to UIExplorer.
Closes https://github.com/facebook/react-native/pull/9595
Differential Revision: D3775101
Pulled By: javache
fbshipit-source-id: 6252ce8c872896f4cfdb9a31bdbc79d6aaf4684d
Summary:
This adds support for a controlled `selection` prop on `TextInput` on iOS (Android PR coming soon). This is based on the work by ehd in #2668 which hasn't been updated for a while, kept the original commit and worked on fixing what was missing based on the feedback in the original PR.
What I changed is:
- Make the prop properly controlled by JS
- Add a RCTTextSelection class to map the JS object into and the corresponding RCTConvert category
- Make sure the selection change event is properly triggered when the input is focused
- Cleanup setSelection
- Changed TextInput to use function refs to appease the linter
** Test plan **
Tested using the TextInput selection example in UIExplorer on iOS.
Also tested that it doesn't break Android.
Closes https://github.com/facebook/react-native/pull/8958
Differential Revision: D3771229
Pulled By: javache
fbshipit-source-id: b8ede46b97fb3faf3061bb2dac102160c4b20ce7
Summary:
fontVariant implemented in #9045. Appears to have lost platform annotation. Also fixes indentation.
Closes https://github.com/facebook/react-native/pull/9587
Differential Revision: D3774192
Pulled By: javache
fbshipit-source-id: 9bce0b9c39fa31ef40d01e94b699b1299914b67b
Summary:
Linkify the blog post title when the excerpt is displayed in the blog index.
Update Facebook OpenGraph meta tags for individual blog posts to fix sharing previews.
Closes https://github.com/facebook/react-native/pull/9590
Differential Revision: D3771630
Pulled By: bestander
fbshipit-source-id: dc428ecc2d7939c143f000b8af9d4df9b512d0fc
Summary:
Revised the Activity implementation
- added flow annotations
- fixed some lint warnings
- added event `options`, specifically a `telemetric` option which indicates that events tagged in this manner are relevant for telemetry. The duration of these events is now highlighted in the Activity log
Reviewed By: bestander, kentaromiura
Differential Revision: D3770753
fbshipit-source-id: 6976535fd3bf5269c6263d825d657ab0805ecaad
Summary:
Not seeing a hairline thick line is a common source of confusion with a simple cause. Let's warn about it.
Closes https://github.com/facebook/react-native/pull/9589
Differential Revision: D3770879
Pulled By: mkonicek
fbshipit-source-id: f1637e17832982fa8fb9b7f485056c452b38b3db
Summary:
I wasn't able to run Android instrumentation tests locally from Android Studio without bumping the gradle plugin version and gradle version.
I know that Facebook is planning to move away from Gradle into BUCK only, but this is a pretty straightforward change that seemed to fix it for me.
Closes https://github.com/facebook/react-native/pull/9573
Differential Revision: D3770659
Pulled By: bestander
fbshipit-source-id: 14cefef6071c4ade985a9b3b27cf37d16d670520
Summary:
Setting the line height with the help of Android-provided StaticLayout is incorrect. A
simple example app will display the following when `setLineSpacing(50.f, 0.f)`
is set: {F62987699}. You'll notice that the height of the first line is a few
pixels shorter than the other lines.
So we use a custom LineHeightSpan instead, which needs to be applied to the text
itself, and no height-related attributes need to be set on the TextView itself.
Reviewed By: lexs
Differential Revision: D3751097
fbshipit-source-id: 6c5a8d01a6dca4ff6eef9c3aadd1b550054432d2
Summary:
> Thousands of applications use React Native
🎉
> To be useful to someone looking through the showcase, either the app must be something that most readers would recognise
* Artsy is known in the art world.
* Artsy is known to Apple customers as both the site and the iOS app have been featured by Apple in marketing materials and presentations various times.
* Artsy is known to developers for its many open-source contributions.
> or the makers of the application must have posted useful technical content about the making of the app
We’re writing [a series](http://artsy.github.io/series/react-native-at-artsy/) of posts related to RN on our engineering blog, of which the initial one can be found [here](http://artsy.github.io/blog/2016/08/15/React-Native-at-Artsy/). In `showcase.js` I link to the series overview, though.
> So, each app in the showcase should link to either:
>
> 1. An English-language news article discussing the app, built either by a funded startup or for a public company
Closes https://github.com/facebook/react-native/pull/9569
Differential Revision: D3765119
Pulled By: hramos
fbshipit-source-id: a2b6fbe4c0a01292ecbd7104d14b6bd4645e70eb