Summary: Fixes#3679, see https://github.com/facebook/react-native/issues/3679
The idea is to always load images from the same folder that we loaded JS bundle.
This doesn't change the current behavior, since `imageNamed:` inferred the
absolute path to the image from app's bundle, but now we make it explicit.
The benefit for OTA updates implementations is that they can simply ask RN
to load js from some `~/Documents/<build-id>/main.jsbundle` folder and RN will
look for images in `~/Documents/<build-id>/assets/`.
Note that for Android we will have to come out with a different plan, since
in prod we load images from built-in resources.
public
Reviewed By: vjeux
Differential Revision: D2616995
fb-gh-sync-id: 2906c62380280ecb987525edf9a0e3e727a1008b
Summary: Log level 'log' from JS should be equivalent to 'info'. Also added knowledge of 'trace' log level in RCTLog.
public
Reviewed By: vjeux
Differential Revision: D2615500
fb-gh-sync-id: 7a02f49bf7953c1a075741c21e984470c44b5551
Summary: public
Add RCTFatal for reporting fatal runtime conditions. This centralizes failure handling to one function and allows you to customize how they should be handled. RCTFatal will be logged to the console and as a redbox and will also be triggered by fatal exceptions coming from RCTExceptionsManager.
Note that there is no RCTLogFatal, since just logging the fatal condition does not allow us to handle it consistently.
Reviewed By: nicklockwood
Differential Revision: D2615490
fb-gh-sync-id: 7d8e134419e10a8fb549297054ad955db3f6bee0
Summary: The memory leaks root from the TabBarController not removing itself
when its holder view deallocs. So to fix the issue, it’s just to remove
it from its parentViewController when the holding RCTTabBar
deallocs. This should be safe, since the RCTTabBar seems the owner
of the TabBarController.
Closes https://github.com/facebook/react-native/pull/3915
Reviewed By: svcscm
Differential Revision: D2620905
Pulled By: nicklockwood
fb-gh-sync-id: ce22eb3ebf82562827f6b1bae22aea5ac7d3b51a
Summary: See #3888 for why this is necessary. Essentially, `[NSBundle mainBundle]` loads the file path for the target app which is the only way to reference images.
cc javache nicklockwood
Closes https://github.com/facebook/react-native/pull/3889
Reviewed By: svcscm
Differential Revision: D2615580
Pulled By: nicklockwood
fb-gh-sync-id: d06ce0987dde666b06bb5a7edf609ed45f325d2c
Summary: * allowFontScaling false was still changing lineHeight as if it were true
fixes#2783
Closes https://github.com/facebook/react-native/pull/3840
Reviewed By: svcscm
Differential Revision: D2615710
Pulled By: nicklockwood
fb-gh-sync-id: 7e4205c58967640762deb5837ecaa2dde236782c
Summary: The default value (to retain current behavior) is set to `true`. Setting the value to `false` will prevent the textField from blurring but still fire the `onSubmitEditing` callback. However, the `onEndEditing` callback will not be fired.
Addresses issue: https://github.com/facebook/react-native/issues/2129
Closes https://github.com/facebook/react-native/pull/2149
Reviewed By: svcscm
Differential Revision: D2619822
Pulled By: nicklockwood
fb-gh-sync-id: 9a61152892f4afb5c6c53e7b38dffae13bc7e13f
Summary: I was getting the following error when running `testAsyncStorageTest`
```
uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSError)'
```
nicklockwood pointed out that it might be because we're attempting to send a `NSError *` over the bridge at some point. So I went looking for cases where that might happen and found this instance.
public
Reviewed By: jingc
Differential Revision: D2619240
fb-gh-sync-id: dc26ec268f976fec44f2804831398d3b01ab6115
Summary: I'm planning to split up `DependencyResolver` into the react-native specific implementation of it and a new, generic resolver that is going to replace `node-haste` for jest and other places where we might need JS dependency resolution.
The plan is to split the two folders up so that:
* `Resolver` is the folder for all the react-native specific resolver code
* `DependencyResolver` will become a standalone library, eventually moving into a package called `node-haste`.
There is still a lot to be figured out. This is just the first diff of likely many. The current goal is to make `DependencyResolver` standalone to be able to create an instance of a resolver and resolve all dependencies for a file. This is when I can start integrating it more seriously with jest.
This diff simply moves a bunch of things around and turns `HasteModuleResolver` into an ES2015 class ( :) ).
bypass-lint
public
Reviewed By: davidaurelio
Differential Revision: D2614151
fb-gh-sync-id: ff4e434c4747d2fb032d34dc19fb85e0b0c553ac
Summary: public
Now if you scroll up out of the end threshold and then back down into it,
onEndReached will get triggered again. This closes https://github.com/facebook/react-native/issues/1967
This also resets onEndReached when the data source changes. This would fix
issues where the data source changes and onEndReached should fire again since
the new data may have more pages, whereas the old data had reached the end and
stopped.
Reviewed By: jingc
Differential Revision: D2610799
fb-gh-sync-id: f6cef513a42d4765514bf4bc55d9e31a760117f1
Summary: From http://developer.android.com/guide/topics/resources/runtime-changes.html
> Some device configurations can change during runtime (such as screen orientation, keyboard availability, and language). When such a change occurs, Android restarts the running Activity (onDestroy() is called, followed by onCreate()). The restart behavior is designed to help your application adapt to new configurations by automatically reloading your application with alternative resources that match the new device configuration.
However, in a React Native app, there is only a single activity for the entire app, unlike a single activity per screen in Android, and resources are not specific to orientation etc. Destroying activity means reloading the entire app. Most of the time, this is not the intended behaviour, and can cause data loss for the user if the developer doesn't disable it explicitly. I'm proposing to disable it by default.
Closes https://github.com/facebook/react-native/pull/3813
Reviewed By: svcscm
Differential Revision: D2616083
Pulled By: foghina
fb-gh-sync-id: 8794e436f61581ff0bf569b1b112845cae77b688
Summary: public
The initial implementation used a lock to manage the stored profile information,
blocking the caller thread for longer than it should. Replace it with a private
queue, since the only thing we need to from the caller is to record the immediate
call time and the caller thread/queue, all the rest has absolutely no priority.
Use macros to also defer work done when generate the name of the events.
Reviewed By: nicklockwood
Differential Revision: D2603120
fb-gh-sync-id: e3e36160c893e7ae9ed3558f07c854ea76396661
Summary: public
Re-recorded UIExplorerIntegrationTests::testTextExample snapshot to include
new opaque nested text example.
Reviewed By: nicklockwood
Differential Revision: D2610584
fb-gh-sync-id: 119dbf381f0b412ed8705597b03b367c5098b80d
Summary: public
Add simpler example and remove clutter used to test rendering.
Reviewed By: nicklockwood
Differential Revision: D2605648
fb-gh-sync-id: 84900c290c7af9439f5ce726dd84565bb006ff37
Summary: public
Do not set a default backgroundColor of white when top-level RCTShadowText has
backgroundColor == nil.
Reviewed By: nicklockwood
Differential Revision: D2605636
fb-gh-sync-id: f2076d302e7ed574f7804080ccc80db1c9b9401c
Summary: public
Added opacity property to RCTShadowText, and use it to adjust the alpha
color component of nested text nodes when collapsing the RCTShadowText tree
into an NSAttributedString. The opacity is propagated down the tree,
multiplying the aggregate with the current node's opacity at each step. Also,
foreground and background colors are propagated down the tree so that in case
a node has an opacity style but no colors, the ancestor's colors can be used
when adjusting the alpha components.
Reviewed By: nicklockwood
Differential Revision: D2600402
fb-gh-sync-id: 2adb7b598b0a73c984bb2edaab545c02ab911c6b
I've added the Harmonizome application to the showcase. It is also available for Android, however, I'll wait until we can add multiple links to one app before I include it.
Summary: public
Original github title: Exported a callback for native webview delegate method shouldStartLoadWithRequest
We have a requirement in our app, to open in mobile Safari, any http:// and https:// links displayed in a web view. Our web view is not full screen and is loaded with an HTML string from the backend. Displaying external content in that web view is outside of the scope of our app, so we open them in mobile Safari.
I've forked the WebView component and added a callback property, shouldStartLoadWithRequest, and modified the RCTWebView implementation of `webView:shouldStartLoadWithRequest:navigationType:`
to check if the shouldStartLoadWithRequest property is set.
If the property is set, `webView:shouldStartLoadWithRequest:navigationType:` passes the URL & navigationType to the callback. The callback is then able to ignore the request, redirect it, open a full screen web view to display the URL content, or even deep link to another app with LinkingIOS.openURL().
Original author: PJ Cabrera <pj.cabrera@gmail.com>
Closes https://github.com/facebook/react-native/pull/3643
Reviewed By: nicklockwood
Differential Revision: D2600371
fb-gh-sync-id: 14dfdb3df442d899d9f2af831bbc8d695faefa33