Summary:
public
Added JS wrappers for ImageStore(Manager) and ImageEditor(Manager) so they can be required in the normal way instead of accessed directly via NativeModules.
Reviewed By: dmmiller
Differential Revision: D2773822
fb-gh-sync-id: 6eeafd3f80a87b1b91a04a2aebad6e2fd31b0e98
Summary:
It wasn't in UIExplorerList.ios.js (only in UIExplorerList.js) so it was not being pulled in on the iOS UIExplorer.
Closes https://github.com/facebook/react-native/pull/2196
Reviewed By: majak
Differential Revision: D2780150
Pulled By: nicklockwood
fb-gh-sync-id: f111ec6e29465c4c7f22ca8faec8fc17a96a80cb
Summary:
Allows you to do:
```
var { RecyclerViewBackedScrollView } = require('react-native')
```
Rather than:
```
var RecyclerViewBackedScrollView = require('react-native/Libraries/Components/ScrollView/RecyclerViewBackedScrollView')
```
Also...
- Export `ScrollView` by default rather than `UnimplementedView` for `RecyclerViewBackedScrollView` on iOS -- this makes it easier on the user, so you don't have to always do a conditional for: `if IOS then use ScrollView else use RecyclerViewBackedScrollView`. I can't think of a case where this would lead to undesirable behaviour.
- Add `RecyclerViewBackedScrollView` to `MainReactPackage`
- Fix an issue with `MapView` that threw a red-screen when trying to access constants on Android because there is no `MapView` in open source and MapView.js doesn't have a platform extension.
Closes https://github.com/facebook/react-native/pull/4514
Reviewed By: svcscm
Differential Revision: D2753466
Pulled By: mkonicek
fb-gh-sync-id: 0b6e2133975c911d5117e7531cb9093faf314c52
Summary:
Support dashed and dotted border styles on iOS
public
Reviewed By: nicklockwood
Differential Revision: D2773579
fb-gh-sync-id: f4b99943f38e849602295a86bdb1780c0abbc8e8
Summary:
This is a followup to PR #3850 but now separates min/max track images into different properties.
Closes#4476
Add examples for `minimumTrackTintColor`, `maximumTrackTintColor`, `minimumTrackImage`, `maximumTrackImage` to UIExplorer.
Closes https://github.com/facebook/react-native/pull/4586
Reviewed By: svcscm
Differential Revision: D2779193
Pulled By: nicklockwood
fb-gh-sync-id: 0510a0f496816baacdd0d4be0f3cd3a63a5a9865
Summary:
public
While it's nice to see such a masterclass in strict typing with Flow, having it an example serves no useful purpose, and makes the example unnecessarily fragile with respect to API changes.
Reviewed By: gabelevi
Differential Revision: D2769981
fb-gh-sync-id: db5550d5674bf32ef8d331861751a4e6aa1f6536
Summary:
Keep `WebView.android.js` and `WebView.ios.js`, there are
some small differences. Use the same example on both platforms.
public
Reviewed By: bestander
Differential Revision: D2769446
fb-gh-sync-id: be3d0afcbfd6ddcbaa49f70555063b3081ba03cb
Summary:
public
The `DialogModule` requires `android.support.v4.app.FragmentManager` which means
every app that wants to use Dialogs would need to have its Activity extend the legacy
`android.support.v4.app.FragmentActivity`.
This diff makes the `DialogModule` work with both the Support `FragmentManager`
(for AdsManager & potentially other fb apps) and the `android.app.FragmentManager`
(for new apps with no legacy dependencies).
Also wrap the native module in the same `Alert` API that we have on iOS and provide
a cross-platform example. In my opinion the iOS Alert API is quite nice and easy to use.
We still keep `AlertIOS` around because of its `prompt` function which is iOS-specific
and also for backwards compatibility.
Reviewed By: foghina
Differential Revision: D2647000
fb-gh-sync-id: e2280451890bff58bd9c933ab53cd99055403858
Summary:
public
This diff adds the ability to specify a custom React component (aka view) to be displayed as a MapView pin.
This makes it possible to use remote images (using an <Image/> component), or text (using a <Text/> component), or anything else.
One consequence of this is that MapView can no longer support arbitrary subviews. To place views in front the map, add them to a separate container view.
Reviewed By: tadeuzagallo
Differential Revision: D2764790
fb-gh-sync-id: e16b44e866c2d76c76b0cb35ef9eefbfc68d6719
Summary:
Using resizeMode on Image component returns a warning, it needs to be passed by param
Closes https://github.com/facebook/react-native/pull/4791
Reviewed By: svcscm
Differential Revision: D2767093
Pulled By: spicyj
fb-gh-sync-id: 5ab6a2e949d4c68244b5e890a429aaf1f15118a9
Summary:
public
Rename the executor to so it actually says something about the implementation.
Reviewed By: jspahrsummers, nicklockwood
Differential Revision: D2759688
fb-gh-sync-id: 5b1ac447e75109fbbc2ee71c804710d9926785aa
Summary:
public
A lot of the core modules have to use private methods in the bridge, specially
since the `RCTBatchedBridge` interface is never exposed. That was leading to a
lot of different private bridge categories spread across different modules,
which makes harder to identify which modules are affected by private API changes.
Replace all the categories with a single private header.
Reviewed By: nicklockwood
Differential Revision: D2757564
fb-gh-sync-id: 793158b9082d542b74a6094ed0db4d5dc3a88f78
Summary:
Closes#4290
`mostRecentEventCount` was always being set after `text` on iOS, so let's be really explicit about the order here as we were doing on Android: always call `setNativeProps` providing the `mostRecentEventCount` before we call `onChange` or `onChangeText`.
I also ripped out storing `mostRecentEventCount` in the state, which isn't necessary since we're always doing it through `setNativeProps`.
Closes https://github.com/facebook/react-native/pull/4588
Reviewed By: svcscm
Differential Revision: D2754565
Pulled By: nicklockwood
fb-gh-sync-id: a1401f39b4e19248095517c2a3503cd2af59fa47
Summary:
I had to go through each component while debugging for another issue and decided to clean these warnings up along the way.
Closes https://github.com/facebook/react-native/pull/4653
Reviewed By: svcscm
Differential Revision: D2752740
Pulled By: androidtrunkagent
fb-gh-sync-id: 94da8ad693cae04e353f33f540c15214f6f3e7d8
Summary:
public
This diff replaces the RegEx module method parser with a handwritten recursive descent parser that's faster and easier to maintain.
The new parser is ~8 times faster when tested on the UIManager.managerChildren() method, and uses ~1/10 as much RAM.
The new parser also supports lightweight generics, and is more tolerant of white space.
(This means that you now can – and should – use types like `NSArray<NSString *> *` for your exported properties and method arguments, instead of `NSStringArray`).
Reviewed By: jspahrsummers
Differential Revision: D2736636
fb-gh-sync-id: f6a11431935fa8acc8ac36f3471032ec9a1c8490
Summary:
The JavaScript ecosystem doesn't have the notion of a built-in native module loader. Even Node is decoupled from its module loader. The module loader system is just JS that runs on top of the global `process` object which has all the built-in goodies.
Additionally there is no such thing as a global require. That is something unique to our providesModule system. In other module systems such as node, every require is contextual. Even registered npm names are localized by version.
The only global namespace that is accessible to the host environment is the global object. Normally module systems attaches itself onto the hooks provided by the host environment on the global object.
Currently, we have two forms of dispatch that reaches directly into the module system. executeJSCall which reaches directly into require. Everything now calls through the BatchedBridge module (except one RCTLog edge case that I will fix). I propose that the executors calls directly onto `BatchedBridge` through an instance on the global so that everything is guaranteed to go through it. It becomes the main communication hub.
I also propose that we drop the dynamic requires inside of MessageQueue/BatchBridge and instead have the modules register themselves with the bridge.
executeJSCall was originally modeled after the XHP equivalent. The XHP equivalent was designed that way because the act of doing the call was the thing that defined a dependency on the module from the page. However, that is not how React Native works.
The JS side is driving the dependencies by virtue of requiring new modules and frameworks and the existence of dependencies is driven by the JS side, so this design doesn't make as much sense.
The main driver for this is to be able to introduce a new module system like Prepack's module system. However, it also unlocks the possibility to do dead module elimination even in our current module system. It is currently not possible because we don't know which module might be called from native.
Since the module system now becomes decoupled we could publish all our providesModule modules as npm/CommonJS modules using a rewrite script. That's what React Core does.
That way people could use any CommonJS bundler such as Webpack, Closure Compiler, Rollup or some new innovation to create a JS bundle.
This diff expands the executeJSCalls to the BatchedBridge's three individual pieces to make them first class instead of being dynamic. This removes one layer of abstraction. Hopefully we can also remove more of the things that register themselves with the BatchedBridge (various EventEmitters) and instead have everything go through the public protocol. ReactMethod/RCT_EXPORT_METHOD.
public
Reviewed By: vjeux
Differential Revision: D2717535
fb-gh-sync-id: 70114f05483124f5ac5c4570422bb91a60a727f6
Summary:
- PickerIOS accepts now a new prop: style
- this prop modifies the native style of the RCTPicker allowing to modify the font size of the items (fontSize), color of the items (color, only 6 char HEX values for now) and alignment of the items (textAlign)
Closes https://github.com/facebook/react-native/pull/4490
Reviewed By: svcscm
Differential Revision: D2723190
Pulled By: nicklockwood
fb-gh-sync-id: ab9188192f1d0d087787dfed8c128073bfaa3235
Summary:
The naming "Layout" is an Android-specific thing and not useful in JS. Let's stay consistent with naming like "ScrollView", "MapView" etc.
public
Reviewed By: bestander
Differential Revision: D2723163
fb-gh-sync-id: 6b86e5a649254c41e9d6b0ef6f1fe2ff4b9f3e9a
Summary:
public
Setting `blurOnSubmit=true` on a multiline `<TextInput>` now causes it to behave like a single-line input with respect to the return key:
With the default value of `false`, pressing return will enter a newline character into the field. If you set the value to `true`, pressing return will now blur the field and trigger the onSubmitEditing event. The newline character will *not* be added to the text.
(See associated github task for dicussion: https://github.com/facebook/react-native/pull/2149)
Reviewed By: javache
Differential Revision: D2710448
fb-gh-sync-id: c9706ae11f8b399932d3400ceb4c7558e455570d
Summary: Request from issue #3893
* Added support for `secure-text` and `login-password` types to AlertIOS.
* Fixed and extended the cancel button highlighting functionality, which was broken at some point
* Added localization for default `OK` and `Cancel` labels when using UIAlertController
Closes https://github.com/facebook/react-native/pull/4401
Reviewed By: javache
Differential Revision: D2702052
Pulled By: nicklockwood
fb-gh-sync-id: cce312d7fec949f5fd2a7c656e65c657c4832c8f
Summary: public
onFocus and onBlur were not firing for multiline TextInputs.
Reviewed By: tadeuzagallo
Differential Revision: D2699846
fb-gh-sync-id: 7e64309bc631a42a99f989f615fef927dc50217c
Summary: public
RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly.
Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites.
This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with.
Reviewed By: tadeuzagallo
Differential Revision: D2700348
fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f
Summary: Per issue #1925, add support for Polyline to MapView.
Briefly, if you have a MapView declared as:
<MapView
annotations={this.state.annotations}
overlays={this.state.overlays}
style={styles.map}
region={this.state.region}
ref="mapView"
/>
then setting
this.state.overlays = [{
coordinates: [
{ latitude: 35.5, longitude: -5.5 },
{ latitude: 35.6, longitude: -5.6 },
...
],
strokeColor: 'rgba(255, 0, 0, 0.5)',
lineWidth: 3,
}];
will draw a red line between the points in locations with a width of 3 and equally blended with the background.
Closes https://github.com/facebook/react-native/pull/4153
Reviewed By: svcscm
Differential Revision: D2697347
Pulled By: nicklockwood
fb-gh-sync-id: a436e4ed8d4e43f2872b39b4694fad7c02de8fe5
Summary: public
This diff extends RCTMap annotations with an `image` and `tintColor` property, which can be used to render completely custom pin graphics.
The tintColor applies to both regular pins and custom pin images, allowing you to provide varied pin colors without needing multiple graphic assets.
Reviewed By: fredliu
Differential Revision: D2685581
fb-gh-sync-id: c7cf0af5c90fd8d1e9b3fec4b89206440b47ba8f
Summary: ~~This is a WIP, just finished the first bit and wanted to get some feedback to see if this approach seems appropriate, as I haven't done a lot of Android development.~~
Looks ready for review now.
Closes https://github.com/facebook/react-native/pull/3791
Reviewed By: svcscm
Differential Revision: D2672262
Pulled By: mkonicek
fb-gh-sync-id: 1e8f1cc6658fb719a68f7da455f30a7c9b1db730
Summary: public
The `bridge.modules` dictionary provides access to all native modules, but this API requires that every module is initialized in advance so that any module can be accessed.
This diff introduces a better API that will allow modules to be initialized lazily as they are needed, and deprecates `bridge.modules` (modules that use it will still work, but should be rewritten to use `bridge.moduleClasses` or `-[bridge moduleForName/Class:` instead.
The rules are now as follows:
* Any module that overrides `init` or `setBridge:` will be initialized on the main thread when the bridge is created
* Any module that implements `constantsToExport:` will be initialized later when the config is exported (the module itself will be initialized on a background queue, but `constantsToExport:` will still be called on the main thread.
* All other modules will be initialized lazily when a method is first called on them.
These rules may seem slightly arcane, but they have the advantage of not violating any assumptions that may have been made by existing code - any module written under the original assumption that it would be initialized synchronously on the main thread when the bridge is created should still function exactly the same, but modules that avoid overriding `init` or `setBridge:` will now be loaded lazily.
I've rewritten most of the standard modules to take advantage of this new lazy loading, with the following results:
Out of the 65 modules included in UIExplorer:
* 16 are initialized on the main thread when the bridge is created
* A further 8 are initialized when the config is exported to JS
* The remaining 41 will be initialized lazily on-demand
Reviewed By: jspahrsummers
Differential Revision: D2677695
fb-gh-sync-id: 507ae7e9fd6b563e89292c7371767c978e928f33
Summary: this change will allow the slider to have different thumb images .
Sets an image for the thumb. It only supports static images
Closes https://github.com/facebook/react-native/pull/3849
Reviewed By: svcscm
Differential Revision: D2665699
Pulled By: nicklockwood
fb-gh-sync-id: 3a767e43170074e2419067d5c8eae61668ebb5e9
Summary: public
This diff fixes the jumpy scrolling for multiline `<TextInput>` when using nested `<Text>` components to implement rich text highlighting.
The fix is to disable scrolling on the underlying UITextView, and nest it inside another UIScrollView that we control.
Reviewed By: ericvicenti, tadeuzagallo
Differential Revision: D2674670
fb-gh-sync-id: bacee3ae485523cc26ca8102b714e081df230629
Summary: This adds a persistent cookie store that shares cookies with WebView.
Add a `ForwardingCookieHandler` to OkHttp that uses the underlying Android webkit `CookieManager`.
Use a `LazyCookieHandler` to defer initialization of `CookieManager` as this will in turn trigger initialization of the Chromium stack in KitKat+ which takes some time. This was we will incur this cost on a background network thread instead of during startup.
Also add a `clearCookies()` method to the network module.
Add a cookies example to the XHR example. This example should also work for iOS (except for the clear cookies part). They are for now just scoped to Android.
Closes#2792.
public
Reviewed By: andreicoman11
Differential Revision: D2615550
fb-gh-sync-id: ff726a35f0fc3c7124d2f755448fe24c9d1caf21
Summary: I've added a subject property to the ActionSheetIOS.showShareActionSheetWithOptions options object. This will allow users to set a subject for things like emails when they are sharing to them through the ActionSheetIOS.
Options are now as follows:
```
{
url: 'https://code.facebook.com',
message: 'message to go with the shared url',
subject: 'a subject to go in the email heading',
}
```
Closes https://github.com/facebook/react-native/pull/4238
Reviewed By: svcscm
Differential Revision: D2674536
Pulled By: nicklockwood
fb-gh-sync-id: 3dfad39f94f19999233bf777253ef71b6e692a6d
Summary: Fixed THUMB_URLS in examples. Have kept a local copy of images as decided. Refer #4159 for more details.
Closes https://github.com/facebook/react-native/pull/4178
Reviewed By: svcscm
Differential Revision: D2663613
Pulled By: nicklockwood
fb-gh-sync-id: f2410c4a5df1736bb12afa393539b00e8dc5dbbf
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.
Reconsolidate iOS and Android implementations.
Closes#3772
(The previous commit was reverted)
public
Reviewed By: astreet
Differential Revision: D2658153
fb-gh-sync-id: b1a32d22db7cc2995c673edd31f4bbaf16ca36cb
Summary: This adds the basic support for embedding an image in a TextView.
Implementation details :
We create a ReactTextInlineImageShadowNode whenever an Image is embedded within a Text context.
That uses the same parsing code as ReactImageView (copied, not shared) to parse the source property to figure out the Uri where the resource is.
In ReactTextShadowNode we now look for the ReactTextInlineImageShadowNode and place a TextInlineImageSpan so that we can layout appropriately
Later at the time we go to setText on the TextView, we update that TextInlineImageSpan so that the proper Drawable (downloaded via Fresco) can be shown
public
Reviewed By: mkonicek
Differential Revision: D2652667
fb-gh-sync-id: 8f24924d204f78b8bc4d5d67835cc73b3c1859dd
Summary: In some cases it's desirable to set the page in the ViewPager without animating it -- we have this in ScrollView with `scrollWithoutAnimationTo`. This PR adds `setPageWithoutAnimation` on ViewPager.
cc ide kmagiera
Closes https://github.com/facebook/react-native/pull/3621
Reviewed By: svcscm
Differential Revision: D2652056
Pulled By: mkonicek
fb-gh-sync-id: 6f1f38558c41ffdd863c0ebb2f046c75b5c0392c
Summary: Send part of the response body every 100 ms if the client has set onreadystatechange. This
is done by using the same events as the iOS code and removing the callback that Android previously
used.
Reconsolidate iOS and Android implementations.
Closes#3772
public
Reviewed By: mkonicek
Differential Revision: D2647005
fb-gh-sync-id: d006e566867fa47d5f8dff71219cb390bcb8e15a
Summary: Move the code to the github folder, add more docs and improve the example.
We might want to merge this with `LinkingIOS` later (it has the same functionality
plus support for deep links) but want to see how people use the `IntentAndroid`
API first (and what other methods we should add) to have more data points.
public
Reviewed By: lexs
Differential Revision: D2646936
fb-gh-sync-id: 751f35784d387efcd031f9b458821cdfde048a54
Summary: public
Added support for #rgba and #rrggbbaa colors, which are now officially recognized in the css spec, and supported by WebKit:
http://trac.webkit.org/changeset/192023
Reviewed By: davidaurelio
Differential Revision: D2631386
fb-gh-sync-id: 207a14f77f94bac8088568dc1bbe2bb29f0176c3
Summary: public
It is now possible to display and edit rich text inside a multiline `<textInput>` by nesting a `<Text>` node inside it.
Note that this doesn't yet provide everything needed to build a full rich text editor (as there is no facility to capture or control the selected text range, or insert/remove text) but it does make it possible to apply token-based styling to text as the user types.
See the 'Attributed text' example in the UIExplorer > TextInput demo for details.
Reviewed By: javache
Differential Revision: D2622493
fb-gh-sync-id: b6bc9a46005322c806934541966460edccb59e70
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: 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: 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
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
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
Summary: Currently, the components get registered by `UIExplorerApp.ios.js` as a side effect of requiring `UIExplorerList.ios.js`. This removes the side effect and makes the registration explicit so that it works well with inline requires.
public
Reviewed By: jingc
Differential Revision: D2613174
fb-gh-sync-id: 799dd8b11985708b05fc4c03f367487b47f46bc6
Summary: public
Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.
Fixed some type bugs and improved bridge validation in a few places.
Reviewed By: javache
Differential Revision: D2600189
fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
Summary: public
White space between the end of the first part of the method selector and the first colon was being included in the JS method name.
(See: https://github.com/facebook/react-native/issues/3804)
Reviewed By: javache
Differential Revision: D2605713
fb-gh-sync-id: b4402c9ede5eb31dd38021c902f046a4e0557814
Summary: public
We moved to using `new` instead of `alloc] init` but there was still some calls
left.
Reviewed By: javache
Differential Revision: D2604679
fb-gh-sync-id: ff7300ecbedb55dd5e93873592598810c9b87808
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.
Closes#3724Closes#2952
public
Reviewed By: nicklockwood
Differential Revision: D2595938
fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
Summary: public
* No longer sends events when not observing valueChanged.
* Snaps to step value while dragging.
* Added additional example to UIExplorer.
Reviewed By: javache
Differential Revision: D2595594
fb-gh-sync-id: 1e92427d2ab2e71e4eb4a9a7a75cd0f5f4a3a529
Summary: public
UIExplorer tests were broken due to a refactor that didn't update the RCTShadowViewTests + an off-by-one error in the logic for exporting async methods.
Reviewed By: javache
Differential Revision: D2595810
fb-gh-sync-id: c25a8b8956bff1ef2754bba4a8f10d72a16e2954
Summary: public
Use arrays instead of dictionaries for encoding module method information.
This further reduces UIExplorer startup JSON from 16104 bytes to 14119 (12% reduction)
Reviewed By: javache
Differential Revision: D2570057
fb-gh-sync-id: 4a53a9ead4365a136e7caeb650375733e1c24c0e
Summary: public
UIActionSheet no longer works on iPad when building with the iOS 9 SDK, as reported here: https://github.com/facebook/react-native/issues/3498
This diff implements an alernative code path that uses UIAlertController instead when its available.
Also added `anchor` support for action sheets (previously only supported for share sheet).
Reviewed By: javache
Differential Revision: D2560068
fb-gh-sync-id: feda20f6f1fee5e2ba624761fbeb812e23d96fff
Summary: public
If the frame is set, or the image view moves to a window, we should attempt to load the "real" image. The sizing logic shouldn't kick in if we're only displaying the default image.
Resolves https://github.com/facebook/react-native/issues/3460.
Reviewed By: tadeuzagallo
Differential Revision: D2555316
fb-gh-sync-id: c0c13070ee080bad2b30ca01d9d5173bead406e3
Summary: public
Added RCTDataRequestHandler, which is responsible for loading data URLs. This moves the logic for data URL handling out of RCTImageDownloader (no longer needed) and into the RCTNetwork library, where it makes more sense.
This also means that it is now possible to load data URLs via XHR, and use them for purposes other than just images.
Reviewed By: javache
Differential Revision: D2540964
fb-gh-sync-id: 4f0418bd6b9186f047cc8297276bb970795af104
Summary: public
Implement the iOS side of the optmisation previously implemented in android
(D2485402)
Depends on D2540746
Reviewed By: javache
Differential Revision: D2541118
fb-gh-sync-id: f3590600a6defa2da75c5b7b2cced6ad8bfea6cb
Summary: public
Benchmarking our startup path has shown we spend a lot of time decoding strings (iPhone 4S / iPhone 5):
* reading a 2MB JS bundle: 35ms / 15ms
* decoding is to an `NSString`: 186ms / 78ms
* transforming that to a `JSString`: 29ms / 10ms
Instead of going through an `NSString` transformation, we generate a null-terminated bundle (0.1ms / 0.05ms to copy the data) and use `JSStringCreateWithUTF8CString` (121ms / 53ms) to generate the string. That makes decoding 70% faster.
Reviewed By: javache
Differential Revision: D2541140
fb-gh-sync-id: 09a016b8edfd46a9b62682c76705564d2024e75e
Summary: Partially fixes#3316 by addressing 16 linter warnings:
- Strings should be singlequote
- Missing semicolon
Travis build jobs 1.1 through 1.4 complete successfully. 1.5 fails through what appears to be an unrelated issue on master.
Closes https://github.com/facebook/react-native/pull/3332
Reviewed By: @svcscm
Differential Revision: D2531718
Pulled By: @javache
fb-gh-sync-id: ca22fbeac5fe3b4f725775a72f21b6dd7a75d94b
Summary: Updated the commands provided in the comments to re-generate the static bundle in the Movies and UIExplorer examples, making them match the URL used in `sourceURL` while in dev mode.
Closes https://github.com/facebook/react-native/pull/3132
Reviewed By: @svcscm
Differential Revision: D2547140
Pulled By: @vjeux
fb-gh-sync-id: 450049d3c3d4eb9919d0a3a6bd6c611e90d0f958
Summary: @public
The idea was to depend on a fixed version from Maven to make running the examples easy, however that only works if we depend on both fixed version of JS and the Android artifacts.
The current way leads to version mismatches and causes confusion: https://github.com/facebook/react-native/issues/3329
This commit makes the Android examples consistent with iOS (always build the latest JS and native code from master).
Added docs here: 8abfb5e0e2
Reviewed By: @foghina
Differential Revision: D2531525
fb-gh-sync-id: 7c0844b63ddeb94ad008a3f0e7a43e1af69031c4
Summary: @public
Take a step back and de-batch the bridge calls so we can have better profiling data and a better starting point to work on future optimisations. Also gave a 10~15% win on first render.
Reviewed By: @javache
Differential Revision: D2493674
fb-gh-sync-id: 05165fdd00645bdf43e844bb0c4300a2f63e7038
Summary: @public
This diff implements inline image support for <Text> nodes. Images are specified using <Image> tags, however all properties of the image are currently ignored apart from the source (including width/height styles).
Images are loaded asyncronously, and will trigger a text re-layout when they have loaded.
Reviewed By: @javache
Differential Revision: D2507725
fb-gh-sync-id: 59d0696d00a1bc531915cc35242a16b2dec96e85
Summary: This pull request fixes a glitch that occurred when scrolling horizontally, as described in the #3060.
Closes https://github.com/facebook/react-native/pull/3169
Reviewed By: @svcscm
Differential Revision: D2500186
Pulled By: @mkonicek
Summary: The sample app's code has been converted to Yeoman generator templates. Tell people to run the UIExplorer instead, or the `react-native init` project (which is the same as the SampleApp). This will slightly reduce the size of the npm package and cleans up unused files.
Closes https://github.com/facebook/react-native/pull/3025
Reviewed By: @svcscm
Differential Revision: D2484901
Pulled By: @foghina
Summary: @public
RCTNetworking currently relies on network responses to include an accurate text encoding, otherwise it is unable to convert the response data to text unless it's encoded as UTF8.
See: https://github.com/facebook/react-native/issues/1780#issuecomment-139334294 for details.
This diff makes use of a new feature in iOS8 to detect the encoding of the text authomatically
Reviewed By: @sahrens
Differential Revision: D2443446
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.
See the Known Issues guide on the website.
We will work with the community to reach platform parity with iOS.
Summary: In 7a6f116ed4, IntegrationsTests.m got renamed but for some reason the xcode project still referenced that file and broke the tests.
I opened xcode, found the red file, deleted it and saved. Tests are now passing again :)
I already landed it: f9b2709c8d
Reviewed By: @vjeux
Differential Revision: D2424063
Summary:
The CameraRoll-related APIs were mixed in with the Image classes due to legacy coupling issues. Now that the APIs have been decoupled, it makes more sense for the CameraRoll classes to live in a separate library.
This will be a breaking change for apps using the CameraRoll or related APIs. Fix is to add the RCTCameraRoll lib to your project.
Summary:
GIF images are currently loaded as a CAKeyframeAnimation, however returning this animation directly from RCTImageLoader was dangerous, as any code that expected a UIImage would crash.
This diff changes RCTGIFImageLoader to return a UIImage of the first frame, with the keyframe animation attached as an associated object. This way, code that is not expecting an animation will still work correctly.
Summary:
We currently wait until after views have been updated on the main thread before sending layout events. This means that any code that relies on those events to update the UI will lag the atual layout by at least one frame.
This changes the RCTUIManager to send the event immediately after layout has occured on the shadow thread. This noticably improves the respinsiveness of the layout example in UIExplorer, which now updates the dimension labels immediately instead of waiting until after the layout animation has completed.
Summary:
Two of the allocation were disabled due to eventual failures on Travis, but
haven't failed internally nor locally. I'm bumping the time out and re-enabling
them to see if that was the case.
Summary:
TabBarItemIOS supports setting the scale for base64-encoded images using an optional scale parameter, however this was broken due to the JS code only passing the uri, not the whole source object, to the native side.
(See: https://github.com/facebook/react-native/issues/2413)
Summary:
require('./image.jpg') returns a number and therefore the propType is wrong. Adding it to the propType to fix the warning and dealing with flow which is completely broken for this.
Summary:
There were two issues:
(1) it was using /Users/sahrens as a path
(2) needed to remove RCTAnimationExperimental which doesn't exist anymore and add RCTWebSocket
Summary:
The arg block for handling structs did not return a value, which was being intepreted as failure. This diff returns YES for success, and also adds an error log for this case so future regressions won't fail silently.
Summary:
There's no good reason for initialProperties to be mutable after the RCTRootView has been created. Passing it in through the constructor means we can skip one dispatch_async.
Summary:
This freezes the app in the UIExplorer because we try to push a new view controller onto the screen before the navigator finishes loading. This was exacerbated by @tadeuzagallo's diff that made the loading even faster. Hehe
Summary:
Our events all follow a common pattern, so there's no good reason why the configuration should be so verbose. This diff eliminates that redundancy, and gives us the freedom to simplify the underlying mechanism in future without further churning the call sites.
Summary:
Moved the view creation & property binding logic out of RCTUIManager into a separate RCTComponentData class - this follows the pattern used with the bridge.
I've also updated the property binding to use pre-allocated blocks for setting the values, which is more efficient than the previous system that re-contructed the selectors each time it was called. This should improve view update performance significantly.
Summary:
- Enables async/await in .babelrc and transformer.js
- Adds regenerator to package.json. Users still need to explicitly require the regenerator runtime -- this is so that you only pay for what you use.
- Update AsyncStorage examples in UIExplorer to use async/await
- Update promise tests in UIExplorer to use async/await in addition to the promise API
Closes https://github.com/facebook/react-native/pull/1765
Github Author: James Ide <ide@jameside.com>
Summary:
Some of the log statements inside argument blocks in RCTModuleMethod were directly accessing ivars, thereby causing a retain cycle that retained the class. I've fixed this by making the access explicit via weakSelf.
Summary:
Dynamic Text Sizes for Text component.
Text gains new prop - allowFontScaling (false by default).
There is also AccessibilityManager module that allows you to tune multipliers per each content size category.
Summary:
The bridge implementation on React Android does not currently support boxed numeric/boolean types (the equivalent of NSNumber arguments on iOS), nor does Java support Objective-C's nil messaging system that transparently casts nil to zero, false, etc for primitive types.
To avoid platform incompatibilities, we now treat all primitive arguments as non-nullable rather than silently converting NSNull -> nil -> 0/false.
We also now enforce that NSNumber * objects must be explicitly marked as `nonnull` (this restriction may be lifted in future if/when Android supports boxed numbers).
Other object types are still assumed to be nullable unless specifically annotated with `nonnull`.
Summary:
This diff adds support for enforcing nullability in the arguments for exported methods.
We previously supported use of the nullable/nonnull attributes on method arguments, but didn't do anything to ensure that they were respected.
Now, if an argument is marked as nonnull, and a null value is sent for that argument, it will display a redbox.
In future, nonnull will be assumed by default, but for now we assume that un-annotated arguments can be null (to avoid breaking existing code).
Summary:
Add a new bridge delegate protocol to allow a more flexible bridge configuration.
For now it just support the pre-existent configurations + providing the JavaScript
source to the bridge, that should allow pre-loading sources.
Summary:
Occasionally people create RCTBridgeModule subclasses or base classes that are not intended to be accessed from JS, and so they don't export them. This was previously flagged as an error by the system. I've now downgraded this error to a warning at startup, and deferred the redbox error until the module is directly accessed by native or JS code.
Summary:
This diff implements highlighting of tapped text subranges for the iOS `<Text>` component, styled to match how iOS webkit views highlight links (translucent grey overlay with rounded corners).
Highlighting is enabled by default for any `<Text>` component which has an onPress handler. To disable the highlight, add `suppressHighlighting={true}` to the component props.
Summary:
Added the ability to turn on and off the network activity indicator using:
```
StatusBarIOS.setNetworkActivityIndicatorVisible(true)
```
and
```
StatusBarIOS.setNetworkActivityIndicatorVisible(false)
```
Also added an example to the UIExplorer example app.
Fix#986
Closes https://github.com/facebook/react-native/pull/2079
Github Author: Mark Miyashita <negativetwelve@gmail.com>