Commit Graph

999 Commits

Author SHA1 Message Date
Hedger Wang 480e9abec5 Sets up example for LegacyNavigator.
Summary:We'd plan to build the `NavigationLegacyNavigator` that is meant to replace
Navigator seemlessly without  API changes. While the APIs remain
compatible with Navigator, it should be built with the new
Navigation API such as `NavigationAnimatedView`...etc.

To ensure that the new NavigationLegacyNavigagtor delivers the same
UX and maintains APIs compability, we'd start with using the exact same
examples as the same ones that Navigator uses.

Reviewed By: ericvicenti

Differential Revision: D2955273

fb-gh-sync-id: b4723cf54ea2258e5589f39dceeaee88be2b93f0
shipit-source-id: b4723cf54ea2258e5589f39dceeaee88be2b93f0
2016-02-25 14:57:03 -08:00
Kyle Corbitt 2d921eeb70 Resolve react flow definitions
Summary:Currently, we're not taking advantage of Flow's built-in type definitions for the React library in all cases because Flow's definition uses `declare module react` and this file uses `import('React')`, which Flow thinks is a different library. After this change, the following starts working which didn't before:

```js
import { Component } from 'react-native';

class MyText extends Component<void, {text: string}, void> {
  render() { return <Text>{this.props.text}</Text> }
}

// Correctly throws a Flow error for the missing "text" prop
const renderedText = <MyText />;
```
Closes https://github.com/facebook/react-native/pull/5489

Differential Revision: D2856176

fb-gh-sync-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
shipit-source-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
2016-02-25 02:45:34 -08:00
Hedger Wang 6bcb2a05eb Introducing NavigationCardStack
Summary:Basic implementation of the component NavigationCardStack that animates
a list of NavigationCard.

This will be used to port the UX of teh current Navigator.

Reviewed By: ericvicenti, fkgozali

Differential Revision: D2967065

fb-gh-sync-id: a72920e141364fab328e45a083aef21ca5e6fe0c
shipit-source-id: a72920e141364fab328e45a083aef21ca5e6fe0c
2016-02-24 18:51:30 -08:00
Nick Lockwood 4b4455f827 Removed 'screen' option from snapshot API
Summary:Unfortunately the 'screen' option in the `UIManager.takeSnapshot` API appears to work only on the iOS simulator, not on an actual device.

This diff removes the 'screen' option until a solution can be found that works on the device.

(Taking a snapshot of the window still works fine - it just won't include the status bar, etc.)

Reviewed By: javache

Differential Revision: D2971091

fb-gh-sync-id: 026b9d4eb2f59f686f58c18a16381ff325df612b
shipit-source-id: 026b9d4eb2f59f686f58c18a16381ff325df612b
2016-02-24 09:06:31 -08:00
Kureev Alexey b4992efca9 Add disabled TouchableNativeFeedback button example
Summary:Follow-up PR for #5931: Adding missing `TouchableNativeFeedback` example.

**Test plan**

- Run UIExplorer on iOS and Android devices

[Android]
- Go to Touchable* examples and scroll down to the `Disabled Touchable*` section. There are two new buttons there: `Enabled TouchableNativeFeedback` and `Disabled TouchableNativeFeedback`. Buttons should behave according their titles.

[iOS]
- Go to Touchable* examples and scroll down to the `Disabled Touchable*` section. As far as `TouchableNativeFeedback` is supported on Android only, you **wouldn't see** any new buttons there

**Code formatting**

This PR code style match the desired [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

cc mkonicek
Closes https://github.com/facebook/react-native/pull/6123

Differential Revision: D2971021

fb-gh-sync-id: 3be18bda15b5b495caaf9e4444fd0deb47a44839
shipit-source-id: 3be18bda15b5b495caaf9e4444fd0deb47a44839
2016-02-24 05:26:33 -08:00
Kureev Alexey f7f3e7be38 Fix UIExample typos: hightlight -> highligh
Summary:Follow-up PR for fixing typos in #5931

**Test plan (required)**
This PR contains only copy changes, so no additional testing is required.

**Code formatting**

This PR code style match the desired [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

cc mkonicek
Closes https://github.com/facebook/react-native/pull/6122

Differential Revision: D2970751

Pulled By: javache

fb-gh-sync-id: 007ab6e732e88f39c7f392f00b2bd668ebb4d7d5
shipit-source-id: 007ab6e732e88f39c7f392f00b2bd668ebb4d7d5
2016-02-24 04:34:31 -08:00
Kureev Alexey 9951e1ab04 Introduce disabling for Touchable* elements
Summary:Introduce a `disabled` property for Touchable* components.

Fix https://github.com/facebook/react-native/issues/2103
Closes https://github.com/facebook/react-native/pull/5931

Differential Revision: D2969790

Pulled By: mkonicek

fb-gh-sync-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
shipit-source-id: 570a4ff882219f52f2d2ebef3eb73b1df50a0877
2016-02-23 19:39:33 -08:00
Nick Lockwood ac12f98689 Added support for taking snapshots of the screen, window or individual views
Summary:This adds a `takeSnapshot` method to UIManager that can be used to capture screenshots as an image.

The takeSnapshot method accepts either 'screen', 'window' or a view ref as an argument.

You can also specify the size, format and quality of the captured image.

I've added an example of capturing a screenshot at UIExplorer > Snapshot / Screenshot.
I've also added an example of sharing a screenshot to the UIExplorer > ActionSheetIOS demo.

Reviewed By: javache

Differential Revision: D2958351

fb-gh-sync-id: d2eb93fea3297ec5aaa312854dd6add724a7f4f8
shipit-source-id: d2eb93fea3297ec5aaa312854dd6add724a7f4f8
2016-02-23 02:26:33 -08:00
Eric Vicenti e0019f69c1 App linking for UIExplorer iOS
Summary: Add a simple URL parser to add linking support for UIExplorer iOS. Android should be very similar

Reviewed By: javache

Differential Revision: D2931764

fb-gh-sync-id: 0b029106160620267b82bdba510635ce224c5381
shipit-source-id: 0b029106160620267b82bdba510635ce224c5381
2016-02-22 16:17:23 -08:00
Eric Vicenti 19f81be9b4 NavigationAnimatedView configurable navigation timing
Summary:Add setTiming prop for custom timing configuration

Also improve the current timing of the navigation animation to look more natural and less springy

Reviewed By: javache

Differential Revision: D2938500

fb-gh-sync-id: 3e6c6dd6077ff9d6a343f760f7b762096ce76600
shipit-source-id: 3e6c6dd6077ff9d6a343f760f7b762096ce76600
2016-02-22 16:17:18 -08:00
Eric Vicenti dcb68db758 Add sub-reducer support to NavigationStackReducer
Summary: Revise APIs of reducers, and ensure the stack reducer can support sub-reducers

Reviewed By: javache

Differential Revision: D2959915

fb-gh-sync-id: 20b28b9ead7ace3373489a806486999048d32aef
shipit-source-id: 20b28b9ead7ace3373489a806486999048d32aef
2016-02-22 16:17:12 -08:00
Eric Vicenti 876ecb291f Adopt NavigationExperimental in UIExplorer
Summary:Use the new Navigation library to make the UIExplorer navigation more flexible.

Deep linking examples are coming soon (hint: we just need to convert URIs to UIExplorerActions!)

Reviewed By: javache

Differential Revision: D2798050

fb-gh-sync-id: c7775393e2d7a30a161d0770192309567dcc8b0c
shipit-source-id: c7775393e2d7a30a161d0770192309567dcc8b0c
2016-02-22 16:17:06 -08:00
Scott Dixon c79fed476c Resolved UIExplorer StatusBarIOS deprecation warning
Summary:UIExplorer `<NavigatorIOS> - Custom` was displaying a deprecation warning. I took the warning's advice and updated with `StatusBar.setBarStyle`.

Before:
![image](https://cloud.githubusercontent.com/assets/4726068/13193296/f5adfcbc-d72a-11e5-923f-f327382f0137.png)

After:
![image](https://cloud.githubusercontent.com/assets/4726068/13193303/0536ae4a-d72b-11e5-90ac-7338280ecac0.png)
Closes https://github.com/facebook/react-native/pull/6042

Differential Revision: D2960522

fb-gh-sync-id: 07569372d3f3446395bbad9f87aba91d4f693440
shipit-source-id: 07569372d3f3446395bbad9f87aba91d4f693440
2016-02-22 08:28:33 -08:00
Nick Lockwood e6c65102d4 Add support for sharing images or other media via iOS share sheet
Summary:`ActionSheetIOS` now supports sharing images or other media via the `showShareActionSheetWithOptions` method. Simply specify a local file or data uri using the `url` argument to share the file.

NOTE: this mechanism doesn't currently support sharing images from the camera roll, however you can work around this by first saving the image to the ImageStore, and then fetching the base64 data.

Reviewed By: javache

Differential Revision: D2954273

fb-gh-sync-id: d5158f9d167fe92199933ca703f40f561732ac37
shipit-source-id: d5158f9d167fe92199933ca703f40f561732ac37
2016-02-22 05:34:32 -08:00
Janic Duplessis ad17a2f290 Use ReactActivity for UIExplorer and Movies examples
Summary:This also fixes the examples since the app lifecycle methods were renamed recently.
Closes https://github.com/facebook/react-native/pull/6053

Differential Revision: D2959525

Pulled By: mkonicek

fb-gh-sync-id: 4a445b5e69b55aa75a1063054cf4c78de1f15da6
shipit-source-id: 4a445b5e69b55aa75a1063054cf4c78de1f15da6
2016-02-21 16:36:33 -08:00
Janic Duplessis 91788d2bbd Deprecate PullToRefreshViewAndroid and remove it from the website
Summary:I forgot to add a deprecation warning to PullToRefreshViewAndroid when I worked on RefreshControl. This adds one as well as remove it from the website and remove the UIExplorer example. Now that we have versioned doc I think it is fine to remove deprecated stuff from the website so it is easier for users to know what component they should use. Last thing, I enabled flow in RefreshControl and fixed the one warning.
Closes https://github.com/facebook/react-native/pull/6055

Differential Revision: D2959502

Pulled By: mkonicek

fb-gh-sync-id: 9b23f84ea35c770bfe2a83d0fd3ec7e439669c33
shipit-source-id: 9b23f84ea35c770bfe2a83d0fd3ec7e439669c33
2016-02-21 16:17:36 -08:00
Eric Vicenti 2b46fd424d Clean up UIExplorer and seperate RCTRootView examples
Reviewed By: nicklockwood

Differential Revision: D2951030

fb-gh-sync-id: e7cf64035d8e9e30aafe8b4944b6a20e4bc55078
shipit-source-id: e7cf64035d8e9e30aafe8b4944b6a20e4bc55078
2016-02-19 16:55:54 -08:00
AbilashK 4b97137eee Enable scalesPageToFit on Android
Summary:PR for https://github.com/facebook/react-native/issues/5958. The viewport meta tags if present, are overridden from the page and it is rendered according to the screen size. An example has been added in the Web View section of UIExplorer demo app.
Closes https://github.com/facebook/react-native/pull/6013

Differential Revision: D2953940

Pulled By: nicklockwood

fb-gh-sync-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
shipit-source-id: 012769f3a2a3f7dc942b60de02a9d1b80a27236e
2016-02-19 06:28:34 -08:00
Huang Yu a6a4389bf4 add the ability to create triangles using css tricks
Summary:- modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
Closes https://github.com/facebook/react-native/pull/5911

Differential Revision: D2953734

Pulled By: dmmiller

fb-gh-sync-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
shipit-source-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
2016-02-19 02:59:30 -08:00
Eric Vicenti a91466f84a Rename NavigationState module to NavigationStateUtils
Summary: There is a NavigationState type within this module so the name cannot be shared

Reviewed By: hedgerwang

Differential Revision: D2938311

fb-gh-sync-id: c5208755c9dfa5bf0e67666957c01e203ddd4218
shipit-source-id: c5208755c9dfa5bf0e67666957c01e203ddd4218
2016-02-19 01:24:54 -08:00
Eric Vicenti 26402ea0b5 Seperate NavigatorIOS Example from UIExplorer Navigation
Summary: We want to use a different navigation system for UIExplorer

Reviewed By: javache

Differential Revision: D2948412

fb-gh-sync-id: 43f2ff5e00582f065a992e32ea6d6ef159b92f60
shipit-source-id: 43f2ff5e00582f065a992e32ea6d6ef159b92f60
2016-02-18 21:56:33 -08:00
Jesse Ruder 0176ac488e Add hitSlop prop on iOS and Android
Summary:New prop `hitSlop` allows extending the touch area of Touchable components. This makes it easier to touch small buttons without needing to change your styles.

It takes `top`, `bottom`, `left`, and `right` same as the `pressRetentionOffset` prop. When a touch is moved, `hitSlop` is combined with `pressRetentionOffset` to determine how far the touch can move off the button before deactivating the button.

On Android I had to add a new file `ids.xml` to generate a unique ID to use for the tag where I store the `hitSlop` state. The iOS side is more straightforward.

terribleben worked on the iOS and JS parts of this diff.

Fixes #110
Closes https://github.com/facebook/react-native/pull/5720

Differential Revision: D2941671

Pulled By: androidtrunkagent

fb-gh-sync-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
shipit-source-id: 07e3eb8b6a36eebf76968fdaac3c6ac335603194
2016-02-16 16:51:39 -08:00
Hedger Wang f74981ac32 Add `@providesModule NavigatorExample` to NavigatorExample.js
Reviewed By: fkgozali

Differential Revision: D2936536

fb-gh-sync-id: 06923aa269d1687a562624de00e7a06328e6861d
shipit-source-id: 06923aa269d1687a562624de00e7a06328e6861d
2016-02-16 11:59:36 -08:00
Janic Duplessis edbe6a2b24 Add imperative API to StatusBar
Reviewed By: svcscm

Differential Revision: D2938743

fb-gh-sync-id: 30af304efd5b089854d9a8defc1b77fd8e817d13
shipit-source-id: 30af304efd5b089854d9a8defc1b77fd8e817d13
2016-02-16 03:04:49 -08:00
Satyajit Sahoo 14ec6f011e Use promises in 'NetInfo'
Reviewed By: svcscm

Differential Revision: D2938010

fb-gh-sync-id: 4a24ce680b37e49759f3325987b4b440eb033b94
shipit-source-id: 4a24ce680b37e49759f3325987b4b440eb033b94
2016-02-15 13:34:33 -08:00
Eric Vicenti 1beced56c8 Navigation TicTacToe Example
Reviewed By: hedgerwang

Differential Revision: D2931575

fb-gh-sync-id: a60509315da4732d67b9b30bfc61f6d6a16be234
shipit-source-id: a60509315da4732d67b9b30bfc61f6d6a16be234
2016-02-12 15:38:57 -08:00
Brent Vatne e9f2ff0ee1 Add NavigationExperimental to UIExplorer on Android too
Reviewed By: svcscm

Differential Revision: D2933949

fb-gh-sync-id: fab82a3f15813efb3dfdbce56c7e3e0473d8c899
shipit-source-id: fab82a3f15813efb3dfdbce56c7e3e0473d8c899
2016-02-12 15:07:36 -08:00
Martin Konicek 8e9b70aa86 Bot testing: Update TicTacToeApp.js
Summary:
Just testing the shipit bot
Closes https://github.com/facebook/react-native/pull/5843

Reviewed By: svcscm

Differential Revision: D2917790

Pulled By: mkonicek

fb-gh-sync-id: f73a9bf3aee82d1074f68d650f2bf30ac720a66d
shipit-source-id: f73a9bf3aee82d1074f68d650f2bf30ac720a66d
2016-02-11 08:32:31 -08:00
Nick Lockwood e7005f7f54 Fixed missing rows on UIExplorer <ListView> - Grid Layout example
Summary:
public
I was looking into the missing panels at the bottom of the <ListView> - Grid Layout example, and found that it was caused by several problems, some in the example and some in ListView itself.

The first problem seemed to be a bug in the `_getDistanceFromEnd()` method, which calculates whether the ListView needs to load more content based on the distance of the visible content from the bottom of the scrollview. This was previously using the function

    Math.max(scrollProperties.contentLength, scrollProperties.visibleLength) - scrollProperties.visibleLength - scrollProperties.offset

to calculate the amount the user could scroll before they run out of content. This sort-of works in most cases because `scrollProperties.contentLength` is usually longer than `scrollProperties.visibleLength`, so this would generally evaluate to

    scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset

which meant that it would be positive as long as there was content still to be displayed offscreen, and negative when you reached the end of the content. This logic breaks down if `contentLength` is less than `visibleLength`, however. For example, if you have 300pts of content loaded, and your scrollView is 500pts tall, and your scroll position is zero, this evaluates to

    Math.max(300, 500) - 500 - 0 = 0

In other words, the algorithm is saying that you have zero pts of scroll content remaining before you need to reload. But actually, the bottom 200pts of the screen are empty, so you're really 200pts in debt, and need to load extra rows to fill that space. The correct algorithm is simply to get rid of the `Math.max` and just use

    scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset

I originally thought that this was the cause of the gap, but it isn't, because ListView has `DEFAULT_SCROLL_RENDER_AHEAD = 1000`, which means that it tries to load at least 1000pts more content than is currently visible, to avoid gaps. This masked the bug, so in practice it wasn't causing an issue.

The next problem I found was that there is an implict assumption in ListView that the first page of content you load is sufficient to cover the screen, or rather, that the first _ second page is sufficient. The constants `DEFAULT_INITIAL_ROWS = 10` and `DEFAULT_PAGE_SIZE = 1`, mean that when the ListView first loads, the following happens:

    1. It loads 10 rows of content.
    2. It checks if `_getDistanceFromEnd() < DEFAULT_SCROLL_RENDER_AHEAD` (1000).
    3. If it is, it loads another `DEFAULT_PAGE_SIZE` rows of content, then stops.

In the case of the ListView Grid Layout example, this meant that it first loaded 10 cells, then loaded another 1, for a total of 11. The problem was that going from 10 to 11 cells isn't sufficient to fill the visible scroll area, and it doesn't change the `contentSize` (since the cells wrap onto the same line), and since ListView doesn't try to load any more until the `contentSize` or `scrollOffset ` changes, it stops loading new rows at that point.

I tried fixing this by calling `_renderMoreRowsIfNeeded()` after `_pageInNewRows()` so that it will continue to fetch new rows until the `_getDistanceFromEnd()` is less than the threshold, rather than stopping after the first page and waiting until the `contentSize` or `scrollOffset` change, but although this solves the problem for the Grid Layout example, it leads to over-fetching in the more common case of a standard row-based ListView.

In the end, I just increased the `pageSize` to 3 for the Grid Layout example, which makes more sense anyway since loading a page that is not a multiple of the number of cells per row confuses the `_renderMoreRowsIfNeeded` algorithm, and leads to gaps at the bottom of the view.

This solved the problem, however there was still a "pop-in" effect, where the additional rows were paged in after the ListView appeared. This was simply a misconfiguration in the example itself: The default of 10 rows was insufficient to fill the screen, so I changed the `initialListSize` prop to `20`.

Reviewed By: javache

Differential Revision: D2911690

fb-gh-sync-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3
shipit-source-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3
2016-02-10 08:37:57 -08:00
Eric Vicenti 7b2b0c3c1c Navigation Back support and examples for Android
Summary:
public
- Intro new back action
- Add support in the two main reducers
- Use it in examples to support Android back button
- Disable NavigationCard gestures on Android

Reviewed By: hedgerwang

Differential Revision: D2914154

fb-gh-sync-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
shipit-source-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
2016-02-08 20:03:31 -08:00
mattds 4937a4c5cd Added support for corner radii in Android
Summary:
This is a cut down version of a previous pull request with just the 4 corners catered for.
Closes https://github.com/facebook/react-native/pull/4252

Reviewed By: svcscm

Differential Revision: D2911959

Pulled By: androidtrunkagent

fb-gh-sync-id: 7ddcd684d90d4d92ccefed906c0126e92818dcde
2016-02-08 10:43:35 -08:00
Csaba Palfi 0a6604fa96 Fix Movies example deprecation warning
Summary: Closes https://github.com/facebook/react-native/pull/5802

Reviewed By: svcscm

Differential Revision: D2911814

Pulled By: androidtrunkagent

fb-gh-sync-id: b623827442fdde53a64e17b7d7842e3a268cf016
2016-02-08 10:07:35 -08:00
Eric Vicenti a3085464f6 NavigationExperimental
Summary:
A new API to unify internal navigation. Also addresses a highly-rated community 'pain': https://productpains.com/post/react-native/better-navigator-api-and-docs/

Offers the following improvements:

- Redux-style navigation logic is easy to reason about
- Navigation state can be easily saved and restored through refreshes
- Declarative navigation views can be implemented in native or JS
- Animations and gestures are isolated and now use the Animated library

public

Reviewed By: hedgerwang

Differential Revision: D2798048

fb-gh-sync-id: 88027ef9ead8a80afa38354252bc377455cc6dbb
2016-02-05 14:26:35 -08:00
fangmobile 33d8db599e added accessibility props for touchables
Summary:
accessibilityLabels are missing in these touchable*.js files.
for #5322
ide This is not tested yet. I will update with test.
Closes https://github.com/facebook/react-native/pull/5346

Reviewed By: svcscm

Differential Revision: D2882061

Pulled By: gkassabli

fb-gh-sync-id: dff0ef373e5f5895027cb1cc08c8887a6ace8eee
2016-02-04 05:13:32 -08:00
Nick Lockwood 81fb985335 Support non-image assets in packager
Summary:
public
The packager currently assumes that all assets that are not JSON or JS files must be images. Although it is possible to add other extension types, they crash the packager if you try to require them, because it attempts to get their dimensions, assuming that they are an image.

This is a crude workaround for that problem, which skips the image-specific processing for non-image assets, but really it would be better if the packager was properly aware of different asset types and treated them differently (e.g. for sounds it could include the duration, for HTML pages it could parse and include linked CSS files, etc).

I've also added an example of using `require('...')` to load a packager-managed HTML page in the UIExplorer WebView example. In future I anticipate that all static asset types (sounds, fonts, etc.) could be handled in this way, which allows them to be edited or added/removed on the fly instead of needing to restart the app.

Reviewed By: martinbigio

Differential Revision: D2895619

fb-gh-sync-id: cd93794ca66bad838621cd7df3ff3c62b5645e85
2016-02-03 17:30:39 -08:00
Janic Duplessis b979128c54 Cross platform status bar API
Summary:
I started working on improving the `StatusBar` API and make it work on Android. I added support for `setColor`, `setTranslucent` (the status bar is still visible but the app can draw under) and `setHidden` on Android. Looking for feedback on how to improve the API before I put more time on this :).

Right now I went for a cross platform API and functions that don't exist on a platform are just a no-op but I'm not sure it is the best choice since at the moment what is supported is very different between both platforms. I was wondering what you guys think and if it would be better off as 2 different modules.

It is also possible to port some of the features I added for Android to iOS even if there is no 'standard' way to do it. Like `setColor` could be implemented by drawing a colored view under the status bar and translucent by adding/removing some padding.
Closes https://github.com/facebook/react-native/pull/5360

Reviewed By: svcscm

Differential Revision: D2840417

Pulled By: nicklockwood

fb-gh-sync-id: 5c8d988bccf8035341f0efe27e54dd8402c18d24
2016-02-03 06:41:35 -08:00
Dave Miller 0c91931adf Add support for selectionColor on Android TextInput
Summary:
public
This adds support to set the highlight color on TextInput on Android.  See https://github.com/facebook/react-native/pull/5678 for the iOS implementation.

Note : We will merge these two properties with one name 'selectionColor' in a follow on diff, and may move it to a style.

Reviewed By: nicklockwood

Differential Revision: D2895253

fb-gh-sync-id: 6f2c08c812ff0028973185356a8af285f7dd7969
2016-02-03 05:49:32 -08:00
Martin Kralik 91e5829419 flush events queue when an event cannot be coalesced (4/7)
Summary:
Currently only scroll events are send through `sendEvent`, and all of them are can be coalesced. In future (further in the stack) touch events will go through there as well, but they won't support coalescing.
In order to ensure js processes touch and scroll events in the same order as they were created, we will flush the coalesced events when we encounter one that cannot be coalesced.

public
___
//This diff is part of a larger stack. For high level overview what's going on jump to D2884593.//

Reviewed By: nicklockwood

Differential Revision: D2884591

fb-gh-sync-id: a3d0e916843265ec57f16aad2f016a79764dcce8
2016-02-03 05:23:55 -08:00
Martin Kralik 7f2b72528e RCTEvent protocol changes (3/7)
Summary:
I want to use the `RCTEvent` protocol for touch events as well. That's why I'm removing not very well defined `body` property and replacing it with `arguments` method, which will return an array that will be passed directly to the js call.
I think this makes sense because there is no unified arguments format for all events and and the called  js method (`moduleDotMethod`) is already event specific.
This way touch events and scroll events can result in calling a completely different js function with a completely different arguments (what they indeed currently do).

public
___
//This diff is part of a larger stack. For high level overview what's going on jump to D2884593.//

Reviewed By: nicklockwood

Differential Revision: D2884590

fb-gh-sync-id: 2c1885c3414e255d8572c0fbbbfe62a23d94dd06
2016-02-03 05:23:50 -08:00
Martin Kralik 3e89c3ea3b removed `coalescingKey` from events (2/7)
Summary:
This property was never used, so I'm removing it.

public
___
//This diff is part of a larger stack. For high level overview what's going on jump to D2884593.//

Reviewed By: javache

Differential Revision: D2884587

fb-gh-sync-id: acd5e576cd13a02e77225f3b308232f8331d3b61
2016-02-03 05:23:43 -08:00
Martin Kralik ee533037f6 removed unused RCTBaseEvent (1/7)
Summary:
`RCTBaseEvent` was never used. This diff removes it.

public
___
//This diff is part of a larger stack. For high level overview what's going on jump to D2884593.//

Reviewed By: javache

Differential Revision: D2884585

fb-gh-sync-id: 66a6afcda3b5baec7f768682da215570f6d33bb1
2016-02-03 05:23:36 -08:00
Nick Lockwood 6941c4e027 Replace `ScrollView.scrollTo()` API with something less ambiguous.
Summary:
public
The current `ScrollView.scrollTo()` API is confusing due to the `(y, x)` parameter order, and the boolean `animated` argument. E.g.

    ScrollView.scrollTo(5, 0, true) // what do these arguments mean?

This diff replaces the API with a configuration object, so the arguments are all explicit:

    ScrollView.scrollTo({x: 0, y: 5, animated: true}) // much better

The `scrollTo()` method checks the argument types, and provides backwards compatibility with the old argument format for now. Using the old API will generate a warning, and this will eventually be upgraded to an error.

Reviewed By: davidaurelio

Differential Revision: D2892287

fb-gh-sync-id: cec4d504242391267c6e863816b6180ced7a7d5e
2016-02-03 04:00:40 -08:00
joranz c2233ef7e6 Add iOS tintColor prop to TextInput
Summary:
In response to https://github.com/facebook/react-native/issues/5595

Adds tintColor property to TextInput component for iOS:

<img width="375" alt="screen shot 2016-01-28 at 1 39 35 pm" src="https://cloud.githubusercontent.com/assets/3868826/12730689/eae58a36-c8e1-11e5-9453-70716617bfab.png">

Usage:

<img width="454" alt="screen shot 2016-01-28 at 1 42 37 pm" src="https://cloud.githubusercontent.com/assets/3868826/12730711/fedeed8e-c8e1-11e5-87d0-1621d19a0418.png">
Closes https://github.com/facebook/react-native/pull/5678

Reviewed By: svcscm

Differential Revision: D2895115

Pulled By: nicklockwood

fb-gh-sync-id: bfb52b992d5e02754fe47f409f6e8df426514718
2016-02-03 00:22:34 -08:00
Nick Lockwood 46106f756a Ported `source` prop over to iOS WebView
Summary:
public
https://github.com/facebook/react-native/pull/5494 added a new `source` property to WebView on Android that provides a better API, as well as allowing for request headers to be set.

This diff ports that functionality over to iOS, so we can have a consistent API cross-platform.

I've also extended the API to include `method` (GET or POST) and `body` when setting the WebView content with a URI, and `baseUrl` when setting static HTML.

Reviewed By: javache

Differential Revision: D2884643

fb-gh-sync-id: 83f24494bdbb4e1408aa8f3b7428fee33888ae3a
2016-02-01 18:01:35 -08:00
glevi@fb.com 5ec1d354c2 Deploy v0.21.0
Reviewed By: jeffmo

Differential Revision: D2888689

fb-gh-sync-id: fe94e50c7872b9a1344a054acccab365d385f6ed
2016-02-01 17:13:35 -08:00
Brent Vatne cb2eeb484d Add defaultSource example
Summary: Closes https://github.com/facebook/react-native/pull/5074

Reviewed By: svcscm

Differential Revision: D2798023

Pulled By: nicklockwood

fb-gh-sync-id: d8aa87bf8dcbecf53b341d5914bbe3354cc753aa
2016-02-01 10:20:35 -08:00
Christoph Jerolimov cb874a55aa Add MapView annotation callback when it gets / lost the focus
Summary:
For my project it was required to receive a notification when the MapView annotation was deselected.

So I renamed `onAnnotationPress` to `onAnnotationSelected` and added a new method `onAnnotationDeselected`, this names was "inspired" by the underlaying iOS API. The old API was still called and marked as deprecated.

But maybe you have an idea for a better naming (onAnnotationFocus/-Blur?) -- or should a deselected call the press method again without an annotation (undefined)?
Closes https://github.com/facebook/react-native/pull/5167

Reviewed By: svcscm

Differential Revision: D2869695

Pulled By: nicklockwood

fb-gh-sync-id: 91795ac3f1e4533b250af8901534d8870729d9db
2016-01-29 06:26:30 -08:00
Martin Konicek 1dd5ba7021 Add a cross-platform Picker
Summary:
The basic API is consistent with iOS; there are several platform-specific props.

Also fixed the flickering when a value is selected.

public

Reviewed By: bestander

Differential Revision: D2871092

fb-gh-sync-id: f5cdf6858cb7344b28ee46954cb6b0a3b144b646
2016-01-29 03:59:54 -08:00
Kudo Chien 8de86a0d65 Add onPageScrollStateChanged for ViewPagerAndroid
Summary:
I have an issue when combining `PullToRefreshViewAndroid` and `ViewPagerAndroid`.
`ViewPagerAndroid` will not able to scroll that gesture handler is being taken by `PullToRefreshViewAndroid`
One solution is to disable `PullToRefreshViewAndroid` if `ViewPagerAndroid` is scrolling (i.e. not idle).
[Reference solution here](http://stackoverflow.com/a/29946734/2590265)

So here need to expose the `onPageScrollStateChanged` event.
Some code referenced from  DrawerLayoutAndroid, especially the `VIEWPAGER_PAGE_SCROLL_STATES` array.
Please feel free give me comments.
Thanks.
Closes https://github.com/facebook/react-native/pull/5026

Reviewed By: svcscm

Differential Revision: D2830623

Pulled By: andreicoman11

fb-gh-sync-id: c2a6920c6f4c7daab0115f13864db83b93b31abf
2016-01-29 01:17:35 -08:00
Nick Lockwood a322ab61fb Fix ImageEditor example
Summary:
public

A fix added to make the ImageEditor example usable on Android inadvertantly broke the cropping logic on iOS, so that zoomed images were cropped incorrectly.

This diff fixes that, and also sets the min/max zoom scale correctly based on the image scale, instead of using a hard-coded value.

Reviewed By: bestander

Differential Revision: D2874576

fb-gh-sync-id: 02c62940c24f4d4266655de6ddbf4fe3bc9c13ce
2016-01-28 09:43:34 -08:00
August Flanagan 0f7477f9f9 add flag to enable momentum scrolling on iOS
Summary:
Expose a `decelerationNormalEnabled` flag on WebView, which, when enabled, will WebView's ScrollView's `decelerationRate` to `UIScrollViewDecelerationRateNormal`. This gives the WebView the same "momentum" style scrolling as other iOS views.

This was discussed with ide in #5447. Please let me know if there's anything I'm missing, or anything else you'd like to see in this pull request.
Closes https://github.com/facebook/react-native/pull/5527

Reviewed By: svcscm

Differential Revision: D2870312

Pulled By: nicklockwood

fb-gh-sync-id: 7dbfd06a349e3365a5df40c3bacf25a4fdb306cf
2016-01-28 05:36:33 -08:00
Nick Lockwood 4511993ffa Fix duplicate platform labels in UIExplorer examples
Summary:
public
This fixes a bug in UIExplorer, where platform labels on examples like (ios only) or (android only) would be re-appended to the title each time the example was viewed.

Reviewed By: javache

Differential Revision: D2869690

fb-gh-sync-id: 07f3f14007f75eea23a5328b7850f3f620691ac2
2016-01-28 04:07:34 -08:00
Janic Duplessis af2f40754a Add global flow types to eslint globals
Summary:
Added a subset of the global flow types from the fbjs eslint config to remove the no-undef errors for flow types as well as a few missing browser globals that were used in the codebase.

I also added a .eslintrc file to Examples to allow using alert there without warnings.
Closes https://github.com/facebook/react-native/pull/5585

Reviewed By: svcscm

Differential Revision: D2872016

Pulled By: vjeux

fb-gh-sync-id: f9b1b511289425393074b7237049dec38ea407b6
2016-01-27 15:55:34 -08:00
Andreas Drivenes b85a52a461 Update Image docs and examples to the new asset system
Summary:
After the release of 0.14, static images should be placed in the source code tree and then required as explained in the [Images guide] (https://facebook.github.io/react-native/docs/images.html). This pull request updates the image documentation and examples to the new asset system. UIExplorer tested on iOS and Android.
Closes https://github.com/facebook/react-native/pull/4987

Reviewed By: svcscm

Differential Revision: D2796276

Pulled By: bestander

fb-gh-sync-id: 732ffa2f136391bb8a3e40a54b5b1ff5022c97f2
2016-01-27 13:47:45 -08:00
Konstantin Raev 1d819e9503 Open sourced <ImageEditor>, <ImageStore> for Android
Reviewed By: mkonicek

Differential Revision: D2869751

fb-gh-sync-id: 862c266601dd83ca3bf9c9bcbf107f7b17b8bdfd
2016-01-27 10:50:54 -08:00
Nick Lockwood f685878938 Improved 3D touch implementation, and added example
Summary:
public
This diff improves the implementation of 3D touch by adding a `forceTouchAvailable` constant to View that can be used to check if the feature is supported.

I've also added an example of how you can use the `force` property of the touch event to measure touch pressure in React Native.

Reviewed By: vjeux

Differential Revision: D2864926

fb-gh-sync-id: 754c54989212ce4e4863716ceaba59673f0bb29d
2016-01-27 09:05:36 -08:00
Martin Konicek 9a0539d2c4 Open source Android date and time pickers
Reviewed By: bestander

Differential Revision: D2856486

fb-gh-sync-id: 0bb81136289e2f121387649765ba682103e4701b
2016-01-26 10:31:17 -08:00
Nick Lockwood 7419a82bd7 Handle bad JSON data without crashing
Summary:
public
NSJSONSerialization throws an exception when it encounters bad JSON data, including NaN values, which may not be a programming error.

This diff adds code to catch those exceptions and convert to an error. Also, if no error handling is in place, RCTJSONStringify will now display a redbox, and attempt to recover by sanitizing the JSON data and retrying.

Reviewed By: javache

Differential Revision: D2854778

fb-gh-sync-id: 18e6990af0d91083496d6a0b75c31a94ed9454a5
2016-01-26 06:13:29 -08:00
Nick Lockwood 481f560f64 Added support for auto-resizing text fields
Summary:
public
This diff adds support for auto-resizing multiline text fields. This has been a long-requested feature, with several native solutions having been proposed (see https://github.com/facebook/react-native/pull/1229 and D2846915).

Rather than making this a feature of the native component, this diff simply exposes some extra information in the `onChange` event that makes it easy to implement this in pure JS code. I think this is preferable, since it's simpler, works cross-platform, and avoids any controversy about what the API should look like, or how the props should be named. It also makes it easier to implement custom min/max-height logic.

Reviewed By: sahrens

Differential Revision: D2849889

fb-gh-sync-id: d9ddf4ba4037d388dac0558aa467d958300aa691
2016-01-25 05:46:29 -08:00
Dale Jefferson 969c520126 Use renderSeparator in List View Example
Summary: Closes https://github.com/facebook/react-native/pull/5443

Reviewed By: svcscm

Differential Revision: D2856259

Pulled By: androidtrunkagent

fb-gh-sync-id: 68b4f5d16c852bbf06cd65346c32b8c6d3f2d36c
2016-01-22 14:21:37 -08:00
Nick Lockwood 2cbc912756 Added support for width & height for text images
Summary:
public

Previously, `<Image>` elements embedded inside `<Text>` ignored all style attributes and props apart from `source`. Now, the `width`, `height` and `resizeMode` styles are observed. I've also added a transparent placeholder to be displayed while the image is loading, to prevent the layout from changing after the image has loaded.

Reviewed By: javache

Differential Revision: D2838659

fb-gh-sync-id: c27f9685b6976705ac2b24075922b2bf247e06ba
2016-01-22 11:32:32 -08:00
Sokovikov c2d75d7a65 Android AppState
Summary: Closes https://github.com/facebook/react-native/pull/5152

Reviewed By: svcscm

Differential Revision: D2850250

Pulled By: mkonicek

fb-gh-sync-id: 0b5063fa7121d4e304a70da8573c9ba1d05a757c
2016-01-21 11:47:21 -08:00
Huang Yu f453e14c8f Fix StyleSheet 'textAlign' for AndroidTextInput. Closes #2702
Summary:
change `setTextAlign` and `setTextAlignVertical` to receive argument of type `String` (the same as in `StyleSheet`), so that native props and stylesheet props are calling the same ReactMethod

- add demo (may not be necessary)
Closes https://github.com/facebook/react-native/pull/4481

Reviewed By: svcscm

Differential Revision: D2823456

Pulled By: mkonicek

fb-gh-sync-id: 349d17549f419b5bdc001d70b583423ade06bfe8
2016-01-21 11:08:34 -08:00
Kyle Corbitt ba4101dc4a Simplified AlertIOS
Summary:
Ok, so this started as fixing #5273 but ended up getting a little more complicated. 😄

Currently, AlertIOS has the following API:

* `alert(title, message, buttons, type)`
* `prompt(title, defaultValue, buttons, callback)`

I've changed the API to look like the following:

* `alert(title, message, callbackOrButtons)`
* `prompt(title, message, callbackOrButtons, type, defaultValue)`

I know that breaking changes are a big deal, but I find the current alert API to be fairly inconsistent and unnecessarily confusing. I'll try to justify my changes one by one:

1. Currently `type` is an optional parameter of `alert`. However, the only reason to change the alert type from the default is in order to create one of the input dialogs (text, password or username/password). So we're in a weird state where if you want a normal text input, you use `prompt`, but if you want a password input you use `alert` with the 'secure-text' type. I've moved `type` to `prompt` so all text input is now done with `pro
Closes https://github.com/facebook/react-native/pull/5286

Reviewed By: svcscm

Differential Revision: D2850400

Pulled By: androidtrunkagent

fb-gh-sync-id: 2986cfa2266225df7e4dcd703fce1e322c12b816
2016-01-21 10:57:26 -08:00
Dave Miller 747be0bf5c Change the js signature to be Promise based and dynamically detect it used as a callback
Summary:
Making the default people see when they look at the module the Promise based version

public

Reviewed By: davidaurelio

Differential Revision: D2850048

fb-gh-sync-id: e0815983ed798c202047cb071e65ce63a52fd1af
2016-01-21 09:49:34 -08:00
Nick Lockwood 21fcbbc32c Generalized image decoding and resizing logic
Summary:
public

Standardises the image decoding logic for all image sources, meaning we get the benefits of efficient downscaling of images from all sources, not just ALAssets.

Reviewed By: javache

Differential Revision: D2647083

fb-gh-sync-id: e41456f838e4c6ab709b1c1523f651a86ff6e623
2016-01-20 11:11:13 -08:00
tantan 15f806957f Return a Promise for `Clipboard.getString()`
Summary:
For clipboard, add error callback in Android. Code like
```javascript
Clipboard.getString((content)=>{
    //do something
},(error)=>{
   //do something for error
})
```
Closes https://github.com/facebook/react-native/pull/4792

Reviewed By: svcscm

Differential Revision: D2844937

Pulled By: nicklockwood

fb-gh-sync-id: 19953807ff07238e6a6ef5aedf1a3fcbca7e62a1
2016-01-20 10:54:32 -08:00
Konstantin Raev 18437093f2 Open sourced spinner aka picker aka drop down for android
Reviewed By: mkonicek

Differential Revision: D2830803

fb-gh-sync-id: e6b6fcdbe33d942180cf2c1041076ad71d0473ce
2016-01-15 06:25:16 -08:00
Kyle Corbitt cd89016ee7 PixelRatio.pixel()
Summary:
This implements #5073. It adds a static method `PixelRatio.pixel()` which returns the smallest drawable line width, primarily for use in styles.

It also updates the example apps to use the new function.
Closes https://github.com/facebook/react-native/pull/5076

Reviewed By: svcscm

Differential Revision: D2799849

Pulled By: nicklockwood

fb-gh-sync-id: b83a77790601fe882affbf65531114e7c5cf4bdf
2016-01-15 05:15:31 -08:00
Nick Lockwood e4c53c28ae Improved shadow performance
Summary:
public
React Native currently exposes the iOS layer shadow properties more-or-less directly, however there are a number of problems with this:

1) Performance when using these properties is poor by default. That's because iOS calculates the shadow by getting the exact pixel mask of the view, including any tranlucent content, and all of its subviews, which is very CPU and GPU-intensive.
2) The iOS shadow properties do not match the syntax or semantics of the CSS box-shadow standard, and are unlikely to be possible to implement on Android.
3) We don't expose the `layer.shadowPath` property, which is crucial to getting good performance out of layer shadows.

This diff solves problem number 1) by implementing a default `shadowPath` that matches the view border for views with an opaque background. This improves the performance of shadows by optimizing for the common usage case. I've also reinstated background color propagation for views which have shadow props - this should help ensure that this best-case scenario occurs more often.

For views with an explicit transparent background, the shadow will continue to work as it did before ( `shadowPath` will be left unset, and the shadow will be derived exactly from the pixels of the view and its subviews). This is the worst-case path for performance, however, so you should avoid it unless absolutely necessary. **Support for this may be disabled by default in future, or dropped altogether.**

For translucent images, it is suggested that you bake the shadow into the image itself, or use another mechanism to pre-generate the shadow. For text shadows, you should use the textShadow properties, which work cross-platform and have much better performance.

Problem number 2) will be solved in a future diff, possibly by renaming the iOS shadowXXX properties to boxShadowXXX, and changing the syntax and semantics to match the CSS standards.

Problem number 3) is now mostly moot, since we generate the shadowPath automatically. In future, we may provide an iOS-specific prop to set the path explicitly if there's a demand for more precise control of the shadow.

Reviewed By: weicool

Differential Revision: D2827581

fb-gh-sync-id: 853aa018e1d61d5f88304c6fc1b78f9d7e739804
2016-01-14 14:04:34 -08:00
Andrei Coman 25c3dd140f Add phone-pad keyboard
Summary:
With the numeric keyboard now being an actual numeric keyboard (before
it was actually phone-pad), we need a proper phone-pad keyboard as well.

public

Reviewed By: dmmiller

Differential Revision: D2830707

fb-gh-sync-id: 80a1d314eac730e691de73a31342c014a2fa5ba6
2016-01-14 11:42:34 -08:00
Nick Lockwood e5381072dd Fixed transparent border around UIExplorer headers
Summary:
public

This was caused by the change to background color propagation, but was actually due to having an unnecessary wrapper view around the headers, which was itself a workaround for a padding bug that was fixed some time ago :-)

Reviewed By: tadeuzagallo

Differential Revision: D2830890

fb-gh-sync-id: b64e701dedb90b357ed7c463b745de021f38637b
2016-01-14 09:56:35 -08:00
Konstantin Raev 892497408c Open sourced Camera Roll module
Reviewed By: mkonicek

Differential Revision: D2827804

fb-gh-sync-id: c1f06f148855bc4f69da8e19b8445988f1b022b3
2016-01-14 04:33:11 -08:00
trave7er 48cb144c2d fix lint warnings: single/double quotes, and semi-colons
Summary:
fixed lint warnings for TextInputExample.ios.js file
Closes https://github.com/facebook/react-native/pull/5216

Reviewed By: svcscm

Differential Revision: D2818390

Pulled By: mkonicek

fb-gh-sync-id: 8ada7038a1ca73f8c158945264cf6dbfe1c23fcc
2016-01-12 08:18:32 -08:00
Andreas Drivenes 05f31a0cbf Update examples for the converged Switch component
Reviewed By: mkonicek

Differential Revision: D2811302

Pulled By: bestander

fb-gh-sync-id: 069dc618510124d6978464979774828c46670124
2016-01-11 12:46:50 -08:00
trave7er d8830fb2b8 fix lint warnings: white spaces and es6 arrow func
Summary:
fixed some lint warnings: semi-colons, white spaces, and es6 arrow function syntax
Closes https://github.com/facebook/react-native/pull/5218

Reviewed By: svcscm

Differential Revision: D2818388

Pulled By: androidtrunkagent

fb-gh-sync-id: 812792dfae87d117fd7a5ffc6faa375c161c3b15
2016-01-09 01:35:31 -08:00
Nick Lockwood 7341706884 Disable background color propagation for everything except text nodes
Summary:
public
Blending semitransparent pixels against their background is fairly a fairly expensive operation on mobile GPUs. To reduce blending, React Native has a system called "background color propagation", where the background color of parent views is automatically inherited by child views unless explicitly overridden. This means that translucent pixels can be blended directly against a known background color, avoiding the need to do this dynamically on the GPU.

In practice, this is only useful for views that do their own drawing, which is basically just `<Image/>` and `<Text/>` components, and for image components it only really matters when the image has an alpha component.

The automatic background propagation is a bit of a hack, and often does the wrong thing - for example if a view overflows its bounds, or if it overlaps a sibling, the background color will often be incorrect and need to be manually disabled. Because the only place that it provides a significant performance benefit is for text, this diff disables the behavior for everything except `<Text/>` nodes. It might still be useful for `<Image/>` nodes too, but looking through the examples in UIExplorer, the number of places where it does the wrong thing for images outnumbers the cases where it provides significant reduction in blending.

Note that this diff does not prevent you from eliminating blending on image components by manually setting an opaque background color, nor does it stop you from disabling color propagation on text components by manually setting a transparent background.

Reviewed By: javache

Differential Revision: D2811031

fb-gh-sync-id: 2eb08918c9031c582a3dd2d40e04b27a663dac82
2016-01-08 03:38:31 -08:00
realaboo b659d7f0d1 Get response url from XMLHttpRequest
Summary:
An HTTP request may be redirected to another URL, sometimes we need to know the URL where the  response comes from.

If the server is in control, we can add an HTTP header X-Request-URL for the redirect URL. However there will be cases that 3rd party services are used.

This PR retrieves the response URL from native networking module and passes to it XMLHttpRequest. The fetch API built on XMLHttpRequest also benefits from this feature.
Closes https://github.com/facebook/react-native/pull/4981

Reviewed By: svcscm

Differential Revision: D2811392

Pulled By: lexs

fb-gh-sync-id: 3ec356fb92f8011b6a243d6879172877a3dc498a
2016-01-07 12:03:48 -08:00
Nick Lockwood b115277d00 Fixed border smearing issue
Summary:
public
The iOS border rendering code did not follow the CSS spec in cases where the sum of adjacent border radii was greater than the width of the view, resulting in drawing glitches such as pixel smear and borders appearing stretched or squashed.

This diff brings our implementation closer to spec-compliance in these cases. I also fixed a longstanding issue with ghostly diagonal lines appearing at the corners due to antialiasing rounding errors!

Fixes

https://github.com/facebook/react-native/issues/1572
https://github.com/facebook/react-native/issues/2089
https://github.com/facebook/react-native/issues/4604

Reviewed By: tadeuzagallo

Differential Revision: D2811249

fb-gh-sync-id: c3dd2721e0a01a432fa4dc78daa05680595edd08
2016-01-07 12:03:17 -08:00
realaboo a45219966c ProgressBarAndroid: default value for styleAttr
Summary:
Current default value of ProgressBarAndroid's styleAttr is "Large" which sets the ProgressBar's style to [Widget_ProgressBar_Large](http://developer.android.com/reference/android/R.style.html#Widget_ProgressBar_Large) at native side. But large is not the default style for the native side ProgressBar.

For example, the size of the ProgressBar is 48dip for default style, but 76dip for large and 16dip for small as in the Material themes. Although the size of ProgressBarAndroid could be set in JS, it'll be better to have the same default style as in native side themes.

My PR adds a "Normal" value for styleAttr prop and makes it the default value.
Closes https://github.com/facebook/react-native/pull/4974

Reviewed By: svcscm

Differential Revision: D2811229

Pulled By: bestander

fb-gh-sync-id: 087f68d1919fe933d86e5194112bf7a5f5b3f3c6
2016-01-07 12:02:37 -08:00
Martín Bigio 0f9c88514c Remove `hot` query string attribut when HL is disabled
Summary:
public

By doing this we fix 2 problems:

1. We use the same url, both the first time the simulator starts with Hot Loading disabled (no `hot` attribute), and after HL has been enabled and then disabled ('hot=false'). By doing so, the packager will rebuild more than one bundle as file changes. We could have ignored this attribute on the packager but I'd rather not contaminate the server with it and instead make the clients send only 2 types of URLs.

2. The code on `RCTBatchedBridge.m` that decides whether or not to enable HMR does so by looking at presence of the query string parameter `hot`. If the parameter is present, even when it's false, it will try to enable HL, which is wrong.

Reviewed By: nicklockwood

Differential Revision: D2807512

fb-gh-sync-id: 728b680c2383c328d8967d34c10e7a6288e455ac
2016-01-06 11:55:33 -08:00
gitim 37b724eaa6 Fix missing keys in animation example
Summary:
There were two warnings about missing keys, fixed them.
Closes https://github.com/facebook/react-native/pull/5153

Reviewed By: svcscm

Differential Revision: D2807602

Pulled By: androidtrunkagent

fb-gh-sync-id: ef7a5eecd297e89b7338fdec65639785a1232f13
2016-01-06 11:12:30 -08:00
Quentin Valmori 3d0ff69e40 Map follow user location
Summary:
Fix #3105

It's the same PR as #3119 but as I force-pushed in my branch, I can't reopen the PR. I added an example.
![capture d ecran 2016-01-05 a 07 15 37](https://cloud.githubusercontent.com/assets/1107936/12108841/2727f504-b37c-11e5-8250-b53785930aba.png)
Closes https://github.com/facebook/react-native/pull/5126

Reviewed By: svcscm

Differential Revision: D2803052

Pulled By: nicklockwood

fb-gh-sync-id: 2e8978ff1b293d699462a8290b45fa74cc16b4dd
2016-01-06 11:00:34 -08:00
Pieter De Baets 435efadbba Re-enable testUnderlyingBridgeIsDeallocated
Reviewed By: jspahrsummers

Differential Revision: D2803543

fb-gh-sync-id: d62b68b1e23fad2a0b3d4e490459b1f38ca2dca1
2016-01-06 09:03:33 -08:00
Pieter De Baets 8772a6a542 Wait for JSExecutor to tear down in RCTBridgeTests
Reviewed By: tadeuzagallo

Differential Revision: D2803092

fb-gh-sync-id: 71ccac2c13221bfbcb2f09a14d48ac2d2901d04e
2016-01-05 15:30:33 -08:00
Nick Lockwood 180fc06b7a Fixed iOS 7 support for URL query functions
Summary:
public
Unfortunately, it turns out that NSURLComponents.queryItems only works on iOS 8 and above. This diff re-implements the RCTGetURLQueryParam and RCTURLByReplacingQueryParam functions using functionality available in iOS 7.

Reviewed By: javache

Differential Revision: D2803679

fb-gh-sync-id: 56f10bef4894d16197975b6023b7aa5ab106d8cb
2016-01-05 12:57:44 -08:00
odino 6edcebef9c Stop using platform-specific names for props
Summary:
Follows up on [this comment](https://github.com/facebook/react-native/pull/5065#issuecomment-168353782) by nicklockwood in #5065.

Rely on using the platform annotation and keep the API / naming less redundant.
Closes https://github.com/facebook/react-native/pull/5081

Reviewed By: svcscm

Differential Revision: D2803143

Pulled By: nicklockwood

fb-gh-sync-id: 9bdf028f5022ef46fcb63aa6c3fc931fdcc46f2b
2016-01-05 10:32:43 -08:00
Justin Spahr-Summers a5d82c2823 Add context executor API for sync hooks
Summary:
public

This exposes a proper API for adding synchronous callbacks to JS, as an optional feature of the executor.

This is based on nicklockwood's work in D2764492, but avoids refactoring bridge/executor interactions for the time being, since we agree on this API and can move the actual callsites around later.

Reviewed By: nicklockwood

Differential Revision: D2799506

fb-gh-sync-id: af209d9a0be927f3404205feb16e59745cc37aec
2016-01-05 08:00:38 -08:00
James Zhang a6bca4041b Fix AlertIOS Examples
Summary:
This fixes the examples that are out of date.
Closes https://github.com/facebook/react-native/pull/5116

Reviewed By: svcscm

Differential Revision: D2800319

Pulled By: androidtrunkagent

fb-gh-sync-id: da1810c6146950be4be670fc69b9da32fb266303
2016-01-04 13:38:33 -08:00
Nick Lockwood ed4478a4ff Refactor hot loading implementation on iOS
Reviewed By: milend

Differential Revision: D2795580

fb-gh-sync-id: ad33ba152e40b622b10bfa0122afd6edc28a11bf
2016-01-04 10:40:32 -08:00
Janic Duplessis 44f7a00e95 Cross platform PullToRefreshView component
Summary:
Both iOS and Android currently support some sort of native pull to refresh control but the API was very different. I tried implementing a component based on PullToRefreshViewAndroid but that works on both platforms.

I liked the idea of wrapping the ListView or ScrollView with the PullToRefreshView component and allow styling the refresh view with platform specific props if needed. I also like the fact that 'refreshing' is a controlled prop so there is no need to keep a ref to the component or to the stopRefreshing function.

It is a pretty rough start so I'm looking for feedback and ideas to improve on the API before cleaning up everything.

On iOS we could probably deprecate the onRefreshStart property of the ScrollView and implement the native stuff in a PullToRefreshViewManager. We could then add props to customize the look of the UIRefreshControl (tintColor). We could also deprecate the Android only component and remove it later.
Closes https://github.com/facebook/react-native/pull/4915

Reviewed By: svcscm

Differential Revision: D2799246

Pulled By: nicklockwood

fb-gh-sync-id: 75872c12143ddbc05cc91900ab4612e477ca5765
2016-01-04 08:00:29 -08:00
Jason Brown b8aac8b77a Implement draggable annotations on MapView. Closes #2512
Summary: Closes https://github.com/facebook/react-native/pull/4441

Reviewed By: svcscm

Differential Revision: D2707897

Pulled By: nicklockwood

fb-gh-sync-id: 6f67f711c1ec1f821d03b9b1ea5cc39859d28fd1
2016-01-04 06:38:30 -08:00
Kudo Chien 4972cabaa5 Add <Text> shadow support
Summary:
Add three new TextStylePropTypes for \<Text>
- textShadowOffset
- textShadowRadius
- textShadowColor
Closes https://github.com/facebook/react-native/pull/4975

Reviewed By: svcscm

Differential Revision: D2796278

Pulled By: nicklockwood

fb-gh-sync-id: f8c3fa210e664428b029b9fba8eca4a8eb81c08d
2016-01-01 09:33:31 -08:00
Nick Lockwood 718cd7953f Added getImageSize method
Summary:
public

This diff adds a `getSize()` method to `Image` to retrieve the width and height of an image prior to displaying it. This is useful when working with images from uncontrolled sources, and has been a much-requested feature.

In order to retrieve the image dimensions, the image may first need to be loaded or downloaded, after which it will be cached. This means that in principle you could use this method to preload images, however it is not optimized for that purpose, and may in future be implemented in a way that does not fully load/download the image data.

A fully supported way to preload images will be provided in a future diff.

The API (separate success and failure callbacks) is far from ideal, but until we agree on a unified standard, this was the most conventional way I could think of to implement it. If it returned a promise or something similar, it would be unique among all such APIS in the framework.

Please note that this has been a long time coming, in part due to much bikeshedding about what the API should look like, so while it's not unlikely that the API may change in future, I think having *some* way to do this is better than waiting until we can define the "perfect" way.

Reviewed By: vjeux

Differential Revision: D2797365

fb-gh-sync-id: 11eb1b8547773b1f8be0bc55ddf6dfedebf7fc0a
2015-12-31 18:51:30 -08:00
odino 6793128435 Allowing turning on / off DOM storage on android webviews
Summary:
Was developing on a WebView and couldnt get it to run. Turns out its JS code mostly depends on `localStorage` and I realized it wasnt turned on in RN. This PR adds a prop, similar to `javascriptEnabledAndroid` to be able to turn DOM storage on / off.

TBH I dont really know how it works on IOS, so I created an android specific thingy. I assume DOM storage is enabled by default on IOS.
Closes https://github.com/facebook/react-native/pull/5065

Reviewed By: svcscm

Differential Revision: D2797735

Pulled By: androidtrunkagent

fb-gh-sync-id: cd60cfa4d24d80fb82e4f54f387a4517a99e75ab
2015-12-31 18:04:29 -08:00
Satvik Jagannath 596109fa0a Fix THUMBNAILS to follow the require Syntax
Summary:
The THUMB_URLS is following the older syntax.
Fixed THUMBNAILS to follows require Syntax. And now you see the thumbnails appearing in the Sample app.
Closes https://github.com/facebook/react-native/pull/4995

Reviewed By: svcscm

Differential Revision: D2796019

Pulled By: nicklockwood

fb-gh-sync-id: c7be50d4dea73fc383db1c6b5a6afa7444505889
2015-12-30 14:50:29 -08:00
Ben Alpert 6a838a4201 Consume react, fbjs from npm
Summary:
We don't (yet) treat these the same as any other modules because we still have special resolution rules for them in the packager allowing the use of `providesModule`, but I believe this allows people to use npm react in their RN projects and not have duplicate copies of React. Fixes facebook/react-native#2985.

This relies on fbjs 0.6, which includes `.flow` files alongside the `.js` files to allow them to be typechecked without additional configuration. This also uses react 0.14.5, which shims a couple of files (as `.native.js`) to avoid DOM-specific bits. Once we fix these in React, we will use the same code on web and native. Hopefully we can also remove the packager support I'm adding here for `.native.js`.

This diff is not the desired end state for us – ideally the packager would know nothing of react or fbjs, and we'll get there eventually by not relying on `providesModule` in order to load react and fbjs modules. (fbjs change posted here but not merged yet: https://github.com/facebook/fbjs/pull/84.)

This should also allow relay to work seamlessly with RN, but I haven't verified this.

public

Reviewed By: sebmarkbage

Differential Revision: D2786197

fb-gh-sync-id: ff50f28445e949edc9501f4b599df7970813870d
2015-12-30 11:41:09 -08:00
Nick Lockwood f9ad70bd81 Fix UIExplorer list
Summary:
public
On fresh install, UIExplorer produces a blank list due to the search text being null. This fixes that by replacing the null with an empty string.

Reviewed By: milend

Differential Revision: D2795411

fb-gh-sync-id: 4bdde5d4f9e88dd933c7946dcbfb8b591a54baf6
2015-12-30 10:43:36 -08:00
Wesley Ellis 36d26c7d3b Don't set height to avoid clipping textinput for XHRExample on android
Summary:
When adding fields to the multipart/form-data Upload section the two `TextInput` fields have a height set that is causing them to be clipped on my Nexus 5 (5.1.1) like so:

![screenshot_2015-09-15-16-50-41](https://cloud.githubusercontent.com/assets/362769/9889808/485a080c-5bca-11e5-9858-6aa51823928b.png)

I've removed the height property, so now it looks like:

![screenshot_2015-09-15-16-50-22](https://cloud.githubusercontent.com/assets/362769/9889806/484f416a-5bca-11e5-9a54-255f0cfc1051.png)
Closes https://github.com/facebook/react-native/pull/2730

Reviewed By: svcscm

Differential Revision: D2789188

Pulled By: androidtrunkagent

fb-gh-sync-id: 4a9ec9bc88d6af8f1db1a6208f138ff05f4eb392
2015-12-24 13:13:36 -08:00
Pieter De Baets 4fde511f5c Remove warnings in RCTBridgeTests
Reviewed By: majak

Differential Revision: D2771228

fb-gh-sync-id: dd935094ceeff196c272565bf7efea5112059a1a
2015-12-23 14:42:31 -08:00
Nick Lockwood 83c2e0303b Added JS wrappers for ImageStore and ImageEditor
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
2015-12-23 10:08:07 -08:00
Brent Vatne 43ca8a0da4 Add TransformExample to UIExplorerList.ios.js
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
2015-12-23 10:07:56 -08:00
Brent Vatne 6df737d1e7 Expose in public interface
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
2015-12-23 10:07:34 -08:00
Milen Dzhumerov 15aa146255 Support dashed and dotted border styles on iOS
Summary:
Support dashed and dotted border styles on iOS

public

Reviewed By: nicklockwood

Differential Revision: D2773579

fb-gh-sync-id: f4b99943f38e849602295a86bdb1780c0abbc8e8
2015-12-23 10:07:28 -08:00
Christopher Dro 4cb775286c Add option for both min/max track image.
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
2015-12-21 10:30:39 -08:00
glevi@fb.com dc6ca95c3a Fixed Flow errors
Reviewed By: nicklockwood

Differential Revision: D2773940

fb-gh-sync-id: 3d632c57c411ddaf428c1d96d145da62dd115a14
2015-12-18 11:17:29 -08:00
Justin Spahr-Summers f47c79c113 Disable RCTAllocationTests:testUnderlyingBridgeIsDeallocated by hand
fb-gh-sync-id: e584ac013468763b2844112f27af9ef82065bd66
2015-12-18 02:04:27 -08:00
Pieter De Baets 5b4e873c68 Guard against invalid JS bundle
Reviewed By: tadeuzagallo

Differential Revision: D2767961

fb-gh-sync-id: 4e9162ddbb2986a56dd129743e316d6e83bb8cb3
2015-12-17 17:26:33 -08:00
Nick Lockwood ba3a5f0eec Removed overly-strict typing in MapViewExample
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
2015-12-17 16:34:09 -08:00
Martin Konicek 8cd7730080 Open source Android WebView
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
2015-12-17 12:47:39 -08:00
Martin Konicek 3a3af8a385 Open souce the Android Dialog module
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
2015-12-17 11:11:13 -08:00
Nick Lockwood f9dfb90a35 Added ability to use a custom view for MapView annotations
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
2015-12-17 06:46:33 -08:00
Jorge Maroto 2a241a242b Move Image.resizeMode to component
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
2015-12-16 16:00:36 -08:00
Tadeu Zagallo 809627379b Rename RCTContextExecutor to RCTJSCExecutor
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
2015-12-16 02:51:28 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Tadeu Zagallo 2d61dfd9c1 Replace private bridge categories with private header
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
2015-12-15 05:40:27 -08:00
Brent Vatne c8108bdbe1 Fixed controlled component on iOS and remove unnecessary code
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
2015-12-14 06:46:31 -08:00
Christopher Dro e4fe557089 Fix all warnings for missing keys.
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
2015-12-11 21:23:29 -08:00
Nick Lockwood 88ac40666c Replaced RegExp method parser with recursive descent
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
2015-12-10 10:12:29 -08:00
Qiao Liang 423202072c fix android movie example by adding missing permission
Summary:
```log
12-10 04:15:40.321 1482-1482/com.facebook.react.movies E/AndroidRuntime: FATAL EXCEPTION: main
                                                                         Process: com.facebook.react.movies, PID: 1482
                                                                         java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in com.facebook.react.modules.netinfo.ConnectivityModule$ConnectivityBroadcastReceiver@529210a0
                                                                             at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778)
                                                                             at android.os.Handler.handleCallback(Handler.java:733)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at
Closes https://github.com/facebook/react-native/pull/4694

Reviewed By: svcscm

Differential Revision: D2743536

Pulled By: androidtrunkagent

fb-gh-sync-id: 7d93ca701c3d6b17add370ab13a68b150910e6a6
2015-12-09 22:40:28 -08:00
Martin Konicek 139f9945df Don't use arrow functions with Flow types to fix website generation
Summary:
Our custom jsdocs parser doesn't support the syntax yet.

public

Reviewed By: bestander

Differential Revision: D2739861

fb-gh-sync-id: eefc3c54b98e06597ca7d93396aa4fe3a92d4a58
2015-12-09 14:56:40 -08:00
tantan 90c7ad112f add Clipboard component for ios and android
Summary:
add Clipboard component for ios and android
 ```javascript
    import Clipboard from 'react-native'

    Clipboard.get((content)=>{
          console.log('here is content in clipboard:%s',content)
    });
    var content = 'here is a string';
    Clipboard.set(content);
```
Closes https://github.com/facebook/react-native/pull/4384

Reviewed By: svcscm

Differential Revision: D2738881

Pulled By: mkonicek

fb-gh-sync-id: a06df32d1eb2824cc9ca3de9d45e4e67fd2edbc9
2015-12-09 10:04:21 -08:00
Christopher Dro 86bb656e6f Add tintColor for buttons.
Summary:
Closes #3374
Closes https://github.com/facebook/react-native/pull/4590

Reviewed By: javache

Differential Revision: D2729616

Pulled By: mkonicek

fb-gh-sync-id: 4a3b6de10a09cad73dbd9d5d552adc3f6ba054e0
2015-12-09 05:19:25 -08:00
Sebastian Markbage 8d397b4cbc Decouple Module System from Native Calls
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
2015-12-08 16:03:37 -08:00
Gabe Levi 99bba8ca4e Use .flow files to tell Flow about react-native module
Reviewed By: jeffmo

Differential Revision: D2735788

fb-gh-sync-id: 7a15caa5effb89b902bba7e0031822f534813c52
2015-12-08 14:51:31 -08:00
glevi@fb.com 066ebc021f Fix PickerIOSExample
Reviewed By: nicklockwood

Differential Revision: D2735834

fb-gh-sync-id: 8f2777ec2afe007523ea85cca27f40497910d2d1
2015-12-08 13:48:28 -08:00
Nick Lockwood 7b13ce30f2 Fix flow
Reviewed By: gabelevi

Differential Revision: D2734936

fb-gh-sync-id: 0c085c4968e52907a60bbd1d8af30dac6f449e46
2015-12-08 12:03:34 -08:00
Konstantin Raev c9d796fc6a NetInfo: Cleaned up code and examples
Reviewed By: andreicoman11

Differential Revision: D2723578

fb-gh-sync-id: b7bb9ce69f24ff5dcf38409de92d57f53da003fa
2015-12-08 09:35:22 -08:00
Emilio Rodriguez e2c35dddba Added support for styling the PickerIOS
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
2015-12-08 07:48:26 -08:00
Martin Konicek 611e0619ca Rename PullToRefreshLayoutAndroid -> PullToRefreshViewAndroid
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
2015-12-07 08:33:25 -08:00
mkonicek-pr-test 752a86786f Test PR 12
Summary:
Testing the shipit bot
Closes https://github.com/facebook/react-native/pull/4536

Reviewed By: svcscm

Differential Revision: D2717972

Pulled By: mkonicek

fb-gh-sync-id: 6cb1fe6a054d050d4bc9d693adda44381d6ad6e2
2015-12-03 07:49:27 -08:00
Qiao Liang 5030cae757 add permission for android geolocation example
Summary:
<img width="860" alt="screen shot 2015-12-03 at 3 38 02 pm" src="https://cloud.githubusercontent.com/assets/5563225/11554542/e7a33554-99d3-11e5-8d3a-e9ea47952a28.png">
Closes https://github.com/facebook/react-native/pull/4524

Reviewed By: svcscm

Differential Revision: D2717843

Pulled By: mkonicek

fb-gh-sync-id: 7828a7f28bb95be3d292d0ae3351c9d9678bb964
2015-12-03 06:27:24 -08:00
Konstantin Raev 0779dd1e87 Open source the Android NetInfo module
Reviewed By: mkonicek

Differential Revision: D2703432

fb-gh-sync-id: 4a85844f1734ec433df543c89f0fdd56fe5db13c
2015-12-02 11:52:22 -08:00
mkonicek-pr-test 7424af6078 Test PR 6: Tweak colors in 2048 example
Summary:
Just testing the shipit bot
Closes https://github.com/facebook/react-native/pull/4503

Reviewed By: svcscm

Differential Revision: D2712738

Pulled By: androidtrunkagent

fb-gh-sync-id: 267f55991ca8267cb651734093bc62fb9c77a056
2015-12-02 09:04:28 -08:00
Nick Lockwood 37042573b8 Added blurOnSubmit support to multine TextInput (aka RCTTextView)
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
2015-12-02 08:16:27 -08:00
Gabe Levi 892dd5b86a Fix errors uncovered by v0.19.0
Reviewed By: mroch

Differential Revision: D2706663

fb-gh-sync-id: 017c91bab849bf18767cacd2ebe32d1a1b10c715
2015-12-01 20:11:26 -08:00
Olivier Notteghem 098fcb3a27 LayoutAnimation support for Android RN
Reviewed By: dernienl

Differential Revision: D2710141

fb-gh-sync-id: 28d6af84441b7c2dbc423b73eb05e71f62f7cdea
2015-12-01 19:06:32 -08:00
Christopher Dro f025049b6c Add secure and login-password types to AlertIOS.
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
2015-11-30 19:51:41 -08:00
mkonicek-pr-test 8f50ace8b3 Remove newline in TicTacToe example
Summary: Really just for testing the shipit bot :)
Closes https://github.com/facebook/react-native/pull/4434

Reviewed By: svcscm

Differential Revision: D2703503

Pulled By: mkonicek

fb-gh-sync-id: 4b93638e01eaf86d63c429e6797d08095c4824ee
2015-11-30 11:11:24 -08:00
Andreas Amsenius 0f0b57880f ActionSheetIOS sharing exclude activity types
Summary: Closes https://github.com/facebook/react-native/pull/4427

Reviewed By: svcscm

Differential Revision: D2702825

Pulled By: nicklockwood

fb-gh-sync-id: f12e83332f2083cee2c04625b5113774c8a907e0
2015-11-30 06:20:30 -08:00
Der-Nien Lee e8e7a2db57 @build-break revert of D2217731
Differential Revision: D2702368

fb-gh-sync-id: 64f53168610c5bf5f3dc22cd7e4dd6b4bb620b4c
2015-11-29 17:41:28 -08:00
olivier notteghem 593a45e319 LayoutAnimation support for Android RN
Reviewed By: astreet

Differential Revision: D2217731

fb-gh-sync-id: d990af4b630995f95433690d5dcf510382dc34d2
2015-11-29 16:33:26 -08:00
Nick Lockwood 01a0facf33 Fixed onFocus/onBlur events for multiline TextInput
Summary: public

onFocus and onBlur were not firing for multiline TextInputs.

Reviewed By: tadeuzagallo

Differential Revision: D2699846

fb-gh-sync-id: 7e64309bc631a42a99f989f615fef927dc50217c
2015-11-27 07:47:28 -08:00
Nick Lockwood 60db876f66 Wrapped UIManager native module for better abstraction
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
2015-11-27 07:00:32 -08:00
Tim Park 8911b72d9e Add Polyline support to MapView
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
2015-11-26 08:54:16 -08:00
Nick Lockwood 5b5b55027b Added support for custom color and image for map annotations
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
2015-11-26 03:07:28 -08:00
Brent Vatne ae09a10c95 Add onLoadX support on Android
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
2015-11-25 18:30:31 -08:00
Nick Lockwood 060664fd3d Refactored module access to allow for lazy loading
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
2015-11-25 04:49:45 -08:00
Manuel Nakamurakare 9fc3991615 added method to set thumb image
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
2015-11-24 16:10:04 -08:00
Nick Lockwood b5be05d82b Fix flaky scrolling for TextInput when using rich text
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
2015-11-24 15:38:27 -08:00
Konstantin Raev 37f81341a0 Open source SwipeRefreshLayoutAndroid
Reviewed By: mkonicek

Differential Revision: D2679605

fb-gh-sync-id: 7f3e7384b37f29002ddd8cb7a4567fa96c76f047
2015-11-24 10:15:14 -08:00
Alexander Blom 274c5c78c4 Support cookies on Android
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
2015-11-23 03:21:31 -08:00
Tim Yung 8ab51828ff RN: Revamp YellowBox for Warnings
Reviewed By: vjeux

Differential Revision: D2667624

fb-gh-sync-id: f3c6ed63f3138edd13e7fe283cf877d598018813
2015-11-20 13:09:16 -08:00
Pieter De Baets 1a1c3f76a2 Port CatalystLoggingTestCase to iOS
Reviewed By: nicklockwood

Differential Revision: D2658485

fb-gh-sync-id: e6803aefee69ee058651fc4c8c202619543f0cd2
2015-11-20 04:41:24 -08:00
Pawel Sienkowski 0d17d6a8c0 RCTRootView integration tests
Reviewed By: javache

Differential Revision: D2631527

fb-gh-sync-id: 377471d9e8546d7c05a045286a6ef7c5277ded16
2015-11-19 13:34:31 -08:00
dajomu 0bf7928ebe Added Subject to ActionSheetIOS share options and updated example
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
2015-11-19 08:42:31 -08:00
Nick Lockwood 6dca903a73 Fixed zero-size images
Summary: public

See: https://github.com/facebook/react-native/pull/4178

Reviewed By: tadeuzagallo

Differential Revision: D2670839

fb-gh-sync-id: 99a70e90c40301639f00fe4fc762da3205da1d36
2015-11-18 15:23:30 -08:00
Martin Konicek 494930afb2 Open source the Android Location module
Reviewed By: foghina

Differential Revision: D2658581

fb-gh-sync-id: e95b21c5c7c06f3332d2a7c9fab8be9a2e6441cb
2015-11-18 10:15:21 -08:00
Pieter De Baets a027218641 Move JS integration tests to root folder
Reviewed By: mkonicek

Differential Revision: D2658454

fb-gh-sync-id: b639ea995411a7e43903264318b5fca4d2f1e9f7
2015-11-18 09:35:19 -08:00
satvik 6e01c514d2 THUMB_URLS of Examples are fixed. Issue #4159
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
2015-11-17 08:50:33 -08:00
Martin Konicek 8f0615080b Merge pull request #4165 from chriskwan/examples-readmes
Add git clone step to READMEs for Examples
2015-11-17 16:31:46 +00:00
Pieter De Baets c043c68e7e Return viewsWithNewFrame instead of passing it around
Reviewed By: nicklockwood

Differential Revision: D2663281

fb-gh-sync-id: 6218c2ff68f7e4d8132ef1f95fb22f5007434319
2015-11-17 06:37:31 -08:00
Alexander Blom 532c9112b4 Send HEADERS_RECEIVED and LOADING events on Android
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
2015-11-17 06:31:31 -08:00
Chris Kwan 7a98aeae18 Add git clone step to READMEs 2015-11-16 22:55:45 -05:00
Nick Lockwood 7aa789ad57 Fix onSelectionChange "this" binding
Reviewed By: tadeuzagallo

Differential Revision: D2660071

fb-gh-sync-id: 3fc50c0af8566dd7db5a56b220df979625673d07
2015-11-16 14:09:23 -08:00
Nick Lockwood fa0b45c58b Replaced RCTSparseArray with NSDictionary
Reviewed By: jspahrsummers

Differential Revision: D2651920

fb-gh-sync-id: 953e2ea33abfc7a3a553da95b13e9ab2bccc5a1c
2015-11-14 10:28:28 -08:00
Nathan Spaun 39ec693866 revert D2631410
Differential Revision: D2655673

fb-gh-sync-id: 115247373767690e63a0d6ce812a578d26b47289
2015-11-13 17:51:30 -08:00
Dave Miller a0268a7bfc Initial checkin for Image within Text nodes
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
2015-11-13 11:16:27 -08:00
Pawel Sienkowski 3a42661b47 Custom logic blocks for RCTTestRunner's runTest: method
Reviewed By: majak

Differential Revision: D2626497

fb-gh-sync-id: c78e3b47be4ee192e899594bd05b13521af7172e
2015-11-13 08:38:31 -08:00
Brent Vatne 50b8b00768 Add setPageWithoutAnimation
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
2015-11-13 08:05:27 -08:00
Alexander Blom 4d4c48d32b Send HEADERS_RECEIVED and LOADING events on Android
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
2015-11-13 07:28:28 -08:00
Martin Konicek ab7b3b2dea Open source IntentAndroid
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
2015-11-12 12:41:32 -08:00
Pawel Sienkowski d5209a0829 'RCTRootView's size flexibility' UIExplorer demo
Reviewed By: javache

Differential Revision: D2622491

fb-gh-sync-id: de79a96ee0fef432bbd0512eba8994719a0adad3
2015-11-12 11:43:43 -08:00
Pawel Sienkowski f1712b0cc3 'Update app properties in runtime' UIExplorer demo
Reviewed By: javache

Differential Revision: D2615815

fb-gh-sync-id: 557ce1b2bc76360fe19a0893e0f317c09b685e23
2015-11-12 11:43:34 -08:00
Pieter De Baets 215872c2eb Provide log source to handler
Reviewed By: majak

Differential Revision: D2615567

fb-gh-sync-id: a245813220436f2d83ae2ae28bde916cecb3f416
2015-11-11 06:44:30 -08:00
Christopher Dro f407211131 Add keyboardAppearance prop to TextInput component.
Summary: Resolves #3649.
Closes https://github.com/facebook/react-native/pull/4012

Reviewed By: javache

Differential Revision: D2636538

Pulled By: nicklockwood

fb-gh-sync-id: 022e79d8f8fa684cad43af1a51f728d60ac652a8
2015-11-11 05:38:35 -08:00
Nick Lockwood 3c04bfcf53 Added support for #rgba and #rrggbbaa colors
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
2015-11-09 08:02:46 -08:00
Pasquale Anatriello bfeaa6a4f5 Custom fonts support added
Reviewed By: andreicoman11

Differential Revision: D2629077

fb-gh-sync-id: 8d647aff13f97d90c5047ad0ddbcae90215ca4ca
2015-11-06 18:15:31 -08:00
Adrov Igor b6340ee2b0 implement android maxlength prop
Summary: Fixes https://github.com/facebook/react-native/issues/3864
But I don't sure that this code is correct.

But it works and works same as in iOS.
Closes https://github.com/facebook/react-native/pull/3873

Reviewed By: mikearmstrong001

Differential Revision: D2626122

Pulled By: andreicoman11

fb-gh-sync-id: 316915c99b218ed5f32ca90fd72ce9810571383a
2015-11-06 13:25:34 -08:00
Alexander Blom 527d11ce01 Support progress in ProgressBarAndroid
Differential Revision: D2626321

fb-gh-sync-id: a358a1db8c8f3b4a41dc9a600ee691e6e60310f3
2015-11-06 12:08:29 -08:00
Andrei Coman de586bfa18 Fix text input spans
Differential Revision: D2626072

fb-gh-sync-id: 35087d65b8f4a52e44fedc229058c3f88827e539
2015-11-06 08:23:29 -08:00
Nick Lockwood 7779e06a7f Added rich text input support
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
2015-11-06 07:26:27 -08:00
Nick Lockwood e98d3cdab8 Added single border examples
Reviewed By: sahrens

Differential Revision: D2622604

fb-gh-sync-id: 28205e27a323e41c6e7f11b7d4a41add4e57be71
2015-11-06 04:51:28 -08:00
Alexander Blom a797be6ffd Support 'color' attribute in ProgressBarAndroid
Differential Revision: D2625690

fb-gh-sync-id: 34ef656be7ce3304add3fae3e697c6b39b866af1
2015-11-06 02:34:32 -08:00
Mark Miyashita f8df38424e Use mainBundle in RCTConvert to resolve asset paths
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
2015-11-05 09:30:36 -08:00
Dave Sibiski 7af752403e Implements `blurOnSubmit`
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
2015-11-04 21:05:42 -08:00
Josh Berdine 02a8c38361 Update UIExplorer TextExample test snapshot
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
2015-11-04 08:55:49 -08:00
Josh Berdine a670ed1d3c Simplify opaque nested Text UIExplorer example
Summary: public

Add simpler example and remove clutter used to test rendering.

Reviewed By: nicklockwood

Differential Revision: D2605648

fb-gh-sync-id: 84900c290c7af9439f5ce726dd84565bb006ff37
2015-11-04 08:55:42 -08:00
Josh Berdine 6b9e4ec4b2 Mimic opacity style of nested Text nodes using alpha color component
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
2015-11-04 08:55:30 -08:00
Pieter De Baets 0a290e22da Exporting a synchronous UIWebView to JS
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
2015-11-04 08:44:29 -08:00
Bhuwan Khattar db229aab87 Make component registration in UIExplorerApp explicit
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
2015-11-03 17:20:30 -08:00
Nick Lockwood c5b990f65f Added lightweight generic annotations
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
2015-11-03 14:49:30 -08:00
Pieter De Baets 071f7c9bfa Enable and fix UIExplorer tests
Reviewed By: nicklockwood

Differential Revision: D2605623

fb-gh-sync-id: 493084d67026b86b5f0c00e8147dde3fd344bc97
2015-11-02 10:30:32 -08:00
Dave Sibiski 6c7c845145 Implements `onKeyPress`
Summary: - When a key is pressed, it's `key value` is passed as an argument to the callback handler.
 - For `Enter` and `Backspace` keys, I'm using their `key value` as defined [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key#Key_values). As per JonasJonny & brentvatne's [suggestion](https://github.com/facebook/react-native/issues/1882#issuecomment-123485883).

- Example
```javascript
 _handleKeyPress: function(e) {
      console.log(e.nativeEvent.key);
  },

  render: function() {
    return (
      <View style={styles.container}>
        <TextInput
            style={{width: 150, height: 25, borderWidth: 0.5}}
            onKeyPress={this._handleKeyPress}
        />
        <TextInput
            style={{width: 150, height: 100, borderWidth: 0.5}}
            onKeyPress={this._handleKeyPress}
            multiline={true}
        />
      </View>
    );
  }
```
- Implements [shouldChangeCharactersInRange](https://developer.apple.com/library/prerelease/ios/documentat
Closes https://github.com/facebook/react-native/pull/2082

Reviewed By: javache

Differential Revision: D2280460

Pulled By: nicklockwood

fb-gh-sync-id: 1f824f80649043dc2520c089e2531d428d799405
2015-11-02 09:15:31 -08:00
Nick Lockwood 6539b26810 Fixed whitespace bug with RCTModuleMethod parsing
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
2015-11-02 08:53:29 -08:00
Tadeu Zagallo ccd90e25c1 Convert remaining uses of alloc] init] to new]
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
2015-11-02 08:03:17 -08:00
Aaron Chiu f8b8fa40fd fix calls to ReactInstanceManager.onResume()
Differential Revision: D2604172

fb-gh-sync-id: 8993b221c55ebe9f1882d203b1729dfce45795ef
2015-10-31 06:26:27 -07:00
Pieter De Baets 6ab2719bff Make <Modal> visible by default
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.

Closes #3724
Closes #2952

public

Reviewed By: nicklockwood

Differential Revision: D2595938

fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
2015-10-30 17:09:27 -07:00
Ryan Olson cf0a28265a Use UIAlertController when available in AlertIOS
Reviewed By: nicklockwood

Differential Revision: D2579164

fb-gh-sync-id: 310361585f8380429b631194147553d014ca5076
2015-10-30 11:26:27 -07:00
Adrov Igor fe42a28de1 Add response headers to XHR response
Summary: This is code from https://github.com/facebook/react-native/pull/3062 with fix for support multiple values from qbig
Closes https://github.com/facebook/react-native/pull/3709

Reviewed By: svcscm

Differential Revision: D2595944

Pulled By: astreet

fb-gh-sync-id: 2ff78de412f53932e29953b4e2ae6ff7be78eae3
2015-10-30 11:23:25 -07:00
Nick Lockwood 0d14d0f1ce Improved SliderIOS
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
2015-10-30 09:13:26 -07:00
Milen Dzhumerov 77272d5a91 Hit testing now treats views with 0.0 opacity as interactable
Reviewed By: nicklockwood

Differential Revision: D2574937

fb-gh-sync-id: 63629cd61cbd7cab93346b4dd91a32703d4f56e0
2015-10-30 04:14:25 -07:00
Nick Lockwood 9f4da92195 Fixed UIExplorer tests + async methods
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
2015-10-29 15:57:29 -07:00
David Aurelio 40f513aa71 Bring back D2570057 (previously backed out) + fixes
Reviewed By: nicklockwood

Differential Revision: D2590604

fb-gh-sync-id: 63a0e0c6afda740f22aacb3f469d411f236fa16b
2015-10-28 18:44:26 -07:00
David Aurelio 4ac898fceb Backout D2570057
Reviewed By: kmagiera

Differential Revision: D2590341

fb-gh-sync-id: 8a6073de3ef2a6e87b785a2bb252468a37c081cf
2015-10-28 08:28:25 -07:00
Nick Lockwood cae4761006 Use arrays for module method data
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
2015-10-23 10:16:26 -07:00
Pieter De Baets 039dab078a Fix configuration for OSS UIExplorer tests
Reviewed By: nicklockwood

Differential Revision: D2575356

fb-gh-sync-id: 0ab5bd29aa3c17a8cb067a8a17abed3e178c5bcf
2015-10-23 09:35:25 -07:00
Charles Marsh 66717d802b Allow for styling of ToolbarAndroid's overflow icon
Summary: Fixes #2858.

Here's a screenshot of the custom overflow icon in action:
<img width="638" alt="overflow" src="https://cloud.githubusercontent.com/assets/1309177/10567090/693e395a-75ae-11e5-84cd-20b19149c620.png">
Closes https://github.com/facebook/react-native/pull/3497

Reviewed By: svcscm

Differential Revision: D2559787

Pulled By: foghina

fb-gh-sync-id: f188711ec094af3fa307722527f22aefff722e64
2015-10-22 04:43:25 -07:00
Nick Lockwood a859d9e931 Fixed ActionSheetIOS on iOS 9 SDK
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
2015-10-21 12:21:28 -07:00
Pieter De Baets 68c52814d6 Enable ReactKit tests on iOS9
Reviewed By: majak

Differential Revision: D2565213

fb-gh-sync-id: 6a70f7e7403b396af8d10b844c5e41ea472ab9b5
2015-10-21 09:31:24 -07:00
Jimmy Mayoukou 77154a7581 Fix typos in example descriptions.
Summary: Closes https://github.com/facebook/react-native/pull/3095

Reviewed By: svcscm

Differential Revision: D2559729

Pulled By: foghina

fb-gh-sync-id: 70dbd39de86e6377d32d1628c77ff10510ac3ae5
2015-10-20 04:38:21 -07:00
Justin Spahr-Summers 123516d556 Reload RCTImageView when it's displaying the default image
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
2015-10-19 10:26:24 -07:00
Nick Lockwood 1076f4a172 Added RCTDataRequestHandler
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
2015-10-19 09:07:06 -07:00
Tadeu Zagallo 31f9a690f3 Flush queue every 5ms during JS execution
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
2015-10-19 08:04:24 -07:00
Frédéric Sagnes 4a3857ef1d Use JSStringCreateWithUTF8CString and skip NSString decoding when loading the bundle
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
2015-10-16 08:11:25 -07:00
Bill Glover 8fb9cc8fc1 Fix 16 linter warnings in Examples/
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
2015-10-16 04:03:23 -07:00
Will Ngo b3c72a5632 Fix command to re-generate the static bundle in Examples
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
2015-10-16 03:41:02 -07:00
Martin Konicek 855f7be4b8 Make Android examples depend on source again
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
2015-10-14 07:48:25 -07:00
Dave Miller 19e11232fe Move SnapshotView to SnapshotViewIOS and create an unimplemented android version
Reviewed By: @andreicoman11

Differential Revision: D2536373

fb-gh-sync-id: 0f671e8198175a15540b74d54e53eee941aa0c1b
2015-10-13 11:48:38 -07:00
Tadeu Zagallo baf5b7b4d5 De-batch native->js calls and react updates
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
2015-10-13 06:44:25 -07:00
Russell Stewart 7b7625b1fe Update ToastAndroidExample.android.js
Summary: Closes https://github.com/facebook/react-native/pull/3236

Reviewed By: @​svcscm

Differential Revision: D2517317

Pulled By: @mkonicek

fb-gh-sync-id: cfbcffd5fdf5e5d2a59b35b35d890717ce64f4a3
2015-10-12 10:16:27 -07:00
Li Qichao 5198ed438a Fix the wrong offline bundle link in Movie example
Summary: When I am trying to figure out if there are several js files, there is only one bundle file. I am trying to use the command line in the comment which is
<code>curl 'http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle' -o main.jsbundle</code>
But after react native has upgraded to 0.12, this command line didn't work. You need to use:
<code>curl 'http://localhost:8081/Examples/Movies/MoviesApp.ios.bundle?platform=ios&dev=true' -o main.jsbundle</code>
And then it will work
Closes https://github.com/facebook/react-native/pull/3361

Reviewed By: @​svcscm

Differential Revision: D2531487

Pulled By: @javache

fb-gh-sync-id: 5fd96d427b1097de4e264cb047a13d5a382c6d0f
2015-10-12 08:59:22 -07:00
Martin Konicek 8abfb5e0e2 Add docs for examples 2015-10-12 16:16:39 +01:00
Atticus White 7abf8ba631 PanResponderExample fix for responding to events
Summary: Fixes #3312.

The example was no longer reacting to touch/drag events.

It looks like `setNativeProps` requires the `style` property to contain the style rules. It appears that this warning is [only in development mode](381e2acd18/Libraries/ReactIOS/NativeMethodsMixin.js (L115-L117)), but after fixing it I am seeing the gestures recognized and properly handled. Running outside of the dev environment yielded the circle to be positioned at the top left of the screen, below the navigation bar, and inaccessible.

<img src="https://cloud.githubusercontent.com/assets/656630/10407224/1449b1b2-6eb6-11e5-8116-20d08f7721ec.png" width="350" />

![after](http://g.recordit.co/UIbeHcKZUg.gif)
Closes https://github.com/facebook/react-native/pull/3315

Reviewed By: @​svcscm

Differential Revision: D2529010

Pulled By: @vjeux

fb-gh-sync-id: 6b79573f42a2520197f77dcb76cd640ea614477f
2015-10-09 17:31:25 -07:00
Pieter De Baets 37202f6c8f Missing file rename 2015-10-09 18:51:50 +01:00
Ben Alpert ab6f375c66 Log React warnings internally, fix warnings in Android tests
Reviewed By: @javache

Differential Revision: D2517993

fb-gh-sync-id: c91a42a0abe4037b72c4497a5dc8b52a922fbf98
2015-10-09 09:33:24 -07:00
Pieter De Baets 67a69906e7 Allow image extensions when loading from asset catalogs
Reviewed By: @nicklockwood

Differential Revision: D2526258

fb-gh-sync-id: 01ccbddcfe8dc98ae5eeac1a066fbc1e69d6f087
2015-10-09 07:55:26 -07:00
Nick Lockwood 91e6c98ecd Implemented inline image support for <Text>
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
2015-10-08 11:56:25 -07:00
Nick Lockwood 63a37be1dd Removed RCTCache
Reviewed By: @tadeuzagallo

Differential Revision: D2410542

fb-gh-sync-id: 98af1b51802e69e7ede9a31feda0df5a526a6db5
2015-10-08 05:37:29 -07:00
Pieter De Baets 83f14da0a3 Fix OSS UIExplorer tests
Reviewed By: @jspahrsummers

Differential Revision: D2517136

fb-gh-sync-id: d00ddcd8baa0f06c4f41f57b8336d67e354eca5b
2015-10-08 04:20:23 -07:00
Martin Konicek 0a419650ce Open source ViewPagerAndroid
Reviewed By: @foghina

Differential Revision: D2513014

fb-gh-sync-id: d9bb668d76939ad85b657233c8b7beac9b244fab
2015-10-06 20:01:21 -07:00
Pieter De Baets 81278d1a39 Fix UIExplorer integration tests
Reviewed By: @vjeux

Differential Revision: D2510761

fb-gh-sync-id: 21ec8988305ba9f3526277a8b445676ac4fcf3aa
2015-10-06 10:28:57 -07:00
Mike Grabowski 2f76c8a4a9 Fixes #3060
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
2015-10-02 14:32:23 -07:00
Dave Miller b8c42f7f6f Introduce SnapshotView which wraps Renderable content and will verify the snapshot
Reviewed By: @javache

Differential Revision: D2493722
2015-10-02 12:15:24 -07:00
Pieter De Baets 91d6cb73ea Fix UIExplorer tabbar test
Reviewed By: @jspahrsummers

Differential Revision: D2498139
2015-10-01 06:02:23 -07:00
Aaron Chiu 47224bd93e enabled border width and border color (sync diff)
Differential Revision: D2497518
2015-09-30 21:02:56 -07:00
Quentin Valmori 4bb58e59f7 Fix one warning
Summary: translucent is a boolean not a stringCloses https://github.com/facebook/react-native/pull/3134

Reviewed By: @​svcscm

Differential Revision: D2495517

Pulled By: @frantic
2015-09-30 21:02:25 -07:00
Stephan Diederich e65cc9d679 update some asset catalogs
Reviewed By: @nscoding

Differential Revision: D2480708
2015-09-30 09:21:38 -07:00
Felix Oghină 5ca5ec7688 add remote image support to toolbar
Differential Revision: D2493627
2015-09-30 09:21:27 -07:00
Pieter De Baets 9076b71ac3 Use bundleForClass instead of mainBundle to find resources
Reviewed By: @jspahrsummers

Differential Revision: D2485109
2015-09-29 10:36:23 -07:00
Andrei Coman 3b6d029a55 Fix background color issue
Differential Revision: D2489578

committer: Service User <svcscm@fb.com>
2015-09-29 09:22:19 -07:00
Alex Kotliarskyi f07dd70051 Managed assets support for RCTConvert
Reviewed By: @nicklockwood

Differential Revision: D2443130
2015-09-29 09:21:39 -07:00
James Ide e15035f30b Delete SampleApp
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
2015-09-29 09:21:33 -07:00
Christopher Chedeau a02785cdc4 Revert _file deletions to fix the sync 2015-09-29 09:16:34 -07:00
Aaron Chiu c604b6e866 [ReactNative] remove unless files in SampleApp 2015-09-23 22:01:14 +01:00
Christopher Chedeau 393b6791a8 Delete ResponderExample.js
See https://github.com/facebook/react-native/pull/1743
2015-09-23 10:18:05 -07:00
Jeff Morrison 18a7e363b5 Deploy to fbobjc
Reviewed By: @gabelevi

Differential Revision: D2457704
2015-09-18 14:25:27 -07:00
Jeff Morrison 2bbdbc704d React native fixups
Reviewed By: @gabelevi

Differential Revision: D2456130
2015-09-18 10:36:24 -07:00
Alexsander Akers 9a2d05d9b2 Move color processing to JS
Reviewed By: @vjeux

Differential Revision: D2346353
2015-09-17 17:20:45 -07:00
Martin Konicek 27ab039b6a Export latest Android changes 2015-09-17 14:33:28 +01:00
facebook-github-bot-6 6277a88555 Restore unintended sync 2015-09-16 10:38:42 -07:00
facebook-github-bot-6 0d09f22dbf Get back 100% in sync with fb codebase 2015-09-16 10:30:53 -07:00
Nick Lockwood 0044b3c2c3 Added logic to detect text encoding for downloaded data
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
2015-09-16 10:25:06 -07:00
Mike Armstrong b434ae0f3d Better text descriptions for examples
Reviewed By: @mkonicek

Differential Revision: D2443908
2015-09-15 14:55:27 -07:00
Martin Konicek ffe20480e4 Merge pull request #2709 from negativetwelve/missing-platform
[iOS] Add missing platform param for the movies app

This has already been done internally but messed up with the Android export.
2015-09-15 22:23:03 +01:00
Pieter De Baets 322807b664 Disable code stripping in SampleApp debug builds
Reviewed By: @nicklockwood, @sahrens

Differential Revision: D2443697
2015-09-15 10:35:28 -07:00
Mark Miyashita 2892e5f4cf [iOS] Add missing platform to the sample Movies iOS app 2015-09-15 01:14:48 -07:00
Martin Konicek 42eb5464fd Release React Native for Android
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.
2015-09-14 18:13:39 +01:00
Martin Konicek df288564c6 Fix Flow annotations in ScrollViewSimpleExample
Reviewed By: @jingc

Differential Revision: D2437502
2015-09-12 15:35:27 -07:00
Gabe Levi c03dad19e7 Deploy 0.15.0
Reviewed By: @jeffmo

Differential Revision: D2421222
2015-09-11 17:01:38 -07:00
Martin Konicek 169da2a1b7 Add simple ScrollView example to UI Explorer
Reviewed By: @foghina

Differential Revision: D2434588
2015-09-11 14:10:30 -07:00
Andrei Coman 360d04e9c8 Add Timer example
Differential Revision: D2433417

committer: Service User <svcscm@fb.com>
2015-09-11 02:00:31 -07:00
Dorota Kapturkiewicz 2a34239c17 move AccessibilityExample to oss
Differential Revision: D2424931
2015-09-10 08:40:36 -07:00
Pieter De Baets 89b7bd4e5e Remove IntegrationTests.m reference
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
2015-09-09 11:25:30 -07:00
Christopher Chedeau c71c940803 Revert "unbreak tests"
This reverts commit f9b2709c8d.
2015-09-09 11:10:50 -07:00
Christopher Chedeau f9b2709c8d unbreak tests 2015-09-08 20:00:42 -07:00
Nick Lockwood 56d25bbbdd Moved CameraRoll-related classes into CameraRoll folder instead of Image
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.
2015-09-08 09:48:19 -08:00
Gabe Levi 874f39bf7f [Flow] Clean up react-native for Flow v0.15.0 2015-09-04 16:51:18 -08:00
Pieter De Baets 1d04a58821 Correct references to unexistent SnapshotTestManager to TestModule 2015-09-04 08:16:00 -08:00
Alexey Lang bbeaac5d3b Automatically adjust content inset after view controller did layout subviews 2015-09-04 07:00:21 -08:00
Nick Lockwood e4110456ab Changed RCTImageLoader to always return a UIImage
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.
2015-09-04 05:10:34 -08:00
Pieter De Baets 7a6f116ed4 Fix React Native test configuration 2015-09-04 03:30:36 -08:00
Pieter De Baets 44fec06891 Fix example apps to use new packager paths 2015-09-04 02:40:41 -08:00
Spencer Ahrens fdeb6a842a [RN] New AnimationExample 2015-09-03 12:52:56 -08:00
Alex Akers 8187d1f0ec Update image loader plugins 2015-09-03 06:06:19 -08:00
Nick Lockwood aa62a5e4e0 Send layout events on shadow queue
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.
2015-09-03 03:42:26 -08:00
Alex Akers 36444a65c7 Add pluggable image processing system 2015-09-02 08:31:34 -08:00
Andrei Coman bc64f26a7a [ReactNative][SyncDiff] Add border example 2015-09-01 10:05:35 -08:00
Tadeu Zagallo 0426f502bb [ReactNative] Increase timeout and re-enable allocation tests
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.
2015-09-01 08:53:47 -08:00
Andrei Coman 9cede03846 [ReactNative][SyncDiff] Add Image Example 2015-09-01 07:55:44 -08:00
Tadeu Zagallo c522e3b16e [ReactNative] Re-enable timers test
Summary:
Timers test was failing but I believe that D2399150 fixes it. Re-enable and
monitor.
2015-09-01 06:14:37 -08:00
Andrei Coman 5b2d8000ae [ReactNative][SyncDiff] Add option to make examples platform specific 2015-09-01 04:56:05 -08:00
Spencer Ahrens f1c9c5c2af [RN] Disable flaky testJavaScriptExecutorIsDeallocated 2015-08-31 13:50:05 -08:00
Spencer Ahrens d080c8dc2b [RN] fix TimerExample
Summary:
Pressing clear would crash if timer was unmounted.

Fixed by not rendering clear button when timer unmounted.
2015-08-31 10:06:59 -08:00
Spencer Ahrens 6f3849ea7b [RN] Disable TimersTest - sporadic failures on Travis
Summary:
Can't get any local failures to trigger.  Travis failure:

https://travis-ci.org/facebook/react-native/jobs/78064148
2015-08-31 09:52:23 -08:00
Felix Oghina 53fc5624e4 [reactnative] send platform arg with all packager requests 2015-08-29 06:36:18 -08:00
Andrei Coman 06c1b4dffd [ReactNative][SyncDiff] Add Movies app 2015-08-28 03:03:53 -08:00
Nick Lockwood fa6bc1c3cd Fixed WebView example 2015-08-27 14:08:17 -08:00
Alex Kotliarskyi 5b25f208c5 [ReactNative] Teach flow how to deal with images 2015-08-26 18:26:09 -08:00
Martin Konicek 9ffbfaeb35 [ReactNative] Disable flaky Obj-C test 2015-08-26 09:34:03 -08:00
Nick Lockwood 8497b5a66f Fixed tab bar snapshot test 2015-08-25 06:36:43 -08:00
Nick Lockwood 65a3c07cfe Fixed tab bar icon scale
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)
2015-08-25 05:26:14 -08:00
Pieter De Baets 371aeceb72 Small perf improvement to RCTPerfStats and RCTBridgeModuleNameForClass 2015-08-25 04:48:39 -08:00
Nick Lockwood 072390ec5c Fixed SampleAppTests 2015-08-25 04:41:12 -08:00
Nick Lockwood 88e0bbc469 Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
Martin Konicek bb708769d4 [ReactNative] Fix sample apps 2015-08-24 11:48:10 -08:00
Andrei Coman ed0ca71be0 [SyncDiff] [react_native] Revamp text input example for oss 2015-08-22 14:23:30 -08:00
Andrei Coman 127b3292c1 [SyncDiff] [react_native] Add more oss examples 2015-08-22 03:34:33 -08:00
Alexey Lang 3643c127a8 Fix fuzziness images in UIExplorer <Image> sample. 2015-08-21 10:58:47 -07:00
Martin Konicek 0b5952a454 [ReactNative][oss] Open source NetworkingModule 2015-08-20 07:19:34 -07:00
Christopher Chedeau 16ddb1962a [ReactNative] Remove warning for <Image source={require('./image.jpg')} />
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.
2015-08-19 22:53:25 -07:00
Christopher Chedeau cf617640f3 [OpenSource] Fix 2048
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
2015-08-19 20:23:20 -07:00
Christopher Chedeau dd7945ae37 [OpenSource] Fix TicTacToe
Summary:
Needed to link RCTWebSocketManager to the project as instructed by the following issue:
https://github.com/facebook/react-native/issues/2256
2015-08-19 20:05:13 -07:00
Martin Bigio d9bd445940 Unbreak Catalyst 2015-08-19 16:25:14 -07:00
Abhishek Sood 5fc2d67ee5 Revert "@build-break" 2015-08-19 15:21:16 -07:00
Abhishek Sood d64ac20119 Revert "[ReactNative] Open source NetworkingModule" 2015-08-19 15:20:09 -07:00
Abhishek Sood 1aa29ceaf2 @build-break 2015-08-19 14:12:22 -07:00
Martin Konicek ade571065e [ReactNative] Open source NetworkingModule 2015-08-19 11:47:10 -07:00
Nick Lockwood 76a9baaf2f Fixed bug where method calls containing struct arguments would fail silently
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.
2015-08-18 07:35:26 -07:00
Nick Lockwood 8d1e02b8bd Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
Dorota Kapturkiewicz 869ff92dbc [ReactNative] add importantForAccessibility to accessibility sample app 2015-08-17 07:17:44 -07:00
Pieter De Baets 261f9434e5 Avoid dispatch_async in RCTRootView when bridge has already started
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.
2015-08-17 05:34:25 -07:00
Alexsander Akers 96277ca3f5 Add HSL/HSLA support 2015-08-14 04:48:20 -08:00
Alexsander Akers 0f14933948 Enable transparent modal presentation with <Modal />
Summary:
Enable transparent modal backgrounds using `UIModalPresentationCustom` modal presentation style.
2015-08-14 04:47:12 -08:00
Alex Akers 5c0805b071 Fix failing UIExplorer test (after isValid removal) 2015-08-14 04:27:27 -08:00
Pieter De Baets fa07736ee1 Remove isValid from RCTInvalidating
Summary:
We only actually use it on RCTBridge and RCTJavaScriptExecutor, so add it to these interfaces explicitly
2015-08-14 01:57:18 -08:00
Alex Akers f552495e7f Fix NavigatorIOS freeze when pushing before initialization completes
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
2015-08-13 08:24:24 -08:00
Nick Lockwood 7232b1bbc7 Fixed image clipping / resizing logic 2015-08-13 08:13:55 -08:00
Tadeu Zagallo b9dc29bcb3 [ReactNative] Fix SampleApp xcodeproj configuration
Summary:
Make SampleApp scheme shared.
2015-08-13 05:29:28 -08:00
Alex Kotliarskyi 1e1efce69b Add .watchmanconfig
Summary:
This file tells watchman to watch this folder if "root_restrict_files"
is turned on.

Fixes #2042
Closes https://github.com/facebook/react-native/pull/2263
Github Author: Alex Kotliarskyi <alex.frantic@gmail.com>
2015-08-11 16:39:49 -08:00
Nick Lockwood a5e9f83a0a Implemented lazy parsing of method signatures to improve TTI 2015-08-11 08:49:13 -08:00
Nick Lockwood 48af214216 Simplified event registration
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.
2015-08-11 06:41:04 -08:00
Tadeu Zagallo 6cd0709bc0 [ReactNative] Parellelise bridge startup
Summary:
Parallelise the bridge startup so we don't keep waiting for the source to load.
2015-08-07 06:48:30 -08:00
Nick Lockwood deba13f698 Refactor RCTUIManager
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.
2015-08-06 15:49:35 -08:00
Nick Lockwood 274769fd8c Added Unicode URL test 2015-08-04 15:37:05 -08:00
James Ide 47e1d1aef8 [Async] Enable async/await and update UIExplorer and tests
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>
2015-08-04 05:35:13 -08:00
Nick Lockwood 6a4b83c16f Fixed retain cycle that caused RCTModuleMethods to leak
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.
2015-08-03 08:46:52 -08:00
Alex Akers e9f69bc2e4 Reorganize SampleApp
Summary:
2015-08-03 03:32:03 -08:00
Dorota Kapturkiewicz e3ed572c01 [ReactNative] accessibility test app 2015-08-03 01:42:35 -08:00
Nick Lockwood 95d1fd142e Fixed null argument errors for timers and layout animations 2015-08-01 06:40:27 -08:00
Vladislav Alexeev 53fb5b6cee Dynamic Text Sizes for Text component
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.
2015-07-31 07:42:41 -08:00
Nick Lockwood 407eb4ce85 NSNumber arguments must now be nonnull
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`.
2015-07-31 06:57:08 -08:00
Gabe Levi d8a13ec3d5 [Flow] Deploy v0.14.0 2015-07-29 20:29:44 -08:00
Philipp von Weitershausen 37636fc59a [React Native] open source ImageEditingManager native module 2015-07-29 15:57:48 -08:00
Nick Lockwood 95b9dd3a88 Added support for method argument nullability
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).
2015-07-29 05:50:27 -08:00
Ben Alpert e0ea046092 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -08:00
Tadeu Zagallo 127f7095dc [ReactNative] Add RCTBridgeDelegate
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.
2015-07-28 15:57:02 -08:00
Nick Lockwood b812b0ee2e Added unit tests for RCTModuleMethod parsing, and fixed some edge cases 2015-07-28 13:07:52 -08:00
Alex Akers 7d19ff3dcb Add <Modal /> component
Summary:
Create Modal component that can be used to present content modally.
2015-07-28 07:21:50 -08:00
Ben Alpert 3cff9be3d1 [ReactNative] Update project template .flowconfig 2015-07-27 13:41:55 -08:00
Nick Lockwood 7996c32211 Unregistered modules will now only error when called, not on bridge init
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.
2015-07-27 08:58:47 -08:00
Alex Akers d178e27939 Fix UIExplorer freezing / persistence 2015-07-27 08:35:34 -08:00
Nick Lockwood 5f0317291b Switched to OSS <Text> implementation for internal apps 2015-07-24 17:30:43 -08:00
Martin Konicek d10e4dbf0f [ReactNative] Use ASCII double quotes
Summary:
We mix ASCII double quotes with left and right quotes: https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListView.js#L13

Let's be consistent.
2015-07-24 13:16:25 -08:00
Nick Lockwood ef5cec4f08 Text highlighting on iOS
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.
2015-07-24 08:41:58 -08:00
lh_wang 1b06e41c83 fix examaple TabBarIOSExample bug; show click num when user click second & third tabbar
Summary:
Closes https://github.com/facebook/react-native/pull/1522
Github Author: lh_wang <lh_wang@Ctrip.com>
2015-07-23 19:12:42 -08:00
Ben Alpert e01f90784f [ReactNative] Update core RN modules to work with React 0.14-beta1 2015-07-23 18:07:59 -08:00
Mark Miyashita 10ffe170c2 [StatusBar] Add ability to toggle the network activity indicator in the status bar + example in UIExplorer
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>
2015-07-23 16:22:56 -08:00
Christopher 3fa3963465 [MovieApp] Add key to image components inside of MovieCell.
Summary:
Closes https://github.com/facebook/react-native/pull/2065
Github Author: Christopher <hello@blick-labs.com>
2015-07-23 15:09:42 -08:00
Andrei Coman aefb3d3628 [ReactNative] Use new animation library for 2048 game demo 2015-07-23 12:36:31 -08:00