Commit Graph

1161 Commits

Author SHA1 Message Date
Ken Wheeler e6372719ea Fixes #3846
Summary: This fixes a  leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined.

cc brentvatne stephenelliot
Closes https://github.com/facebook/react-native/pull/3896

Reviewed By: svcscm

Differential Revision: D2626399

Pulled By: vjeux

fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69
2015-11-06 11:24: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
Alex Krolick 84d1c17dae document that CameraRoll is not implemented on Android
Summary: The CameraRoll API shows up "unsuffixed" in the API list in the docs, so it is confusing to find that it is unimplemented on Android.
Closes https://github.com/facebook/react-native/pull/3901

Reviewed By: svcscm

Differential Revision: D2625837

Pulled By: mkonicek

fb-gh-sync-id: 4e5c00d260a30840a12fd9be0409c354d2052642
2015-11-06 06:31:31 -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
Alex Kotliarskyi 10b599c343 Load assets from same folder as JS bundle
Summary: Fixes #3679, see https://github.com/facebook/react-native/issues/3679

The idea is to always load images from the same folder that we loaded JS bundle.

This doesn't change the current behavior, since `imageNamed:` inferred the
absolute path to the image from app's bundle, but now we make it explicit.

The benefit for OTA updates implementations is that they can simply ask RN
to load js from some `~/Documents/<build-id>/main.jsbundle` folder and RN will
look for images in `~/Documents/<build-id>/assets/`.

Note that for Android we will have to come out with a different plan, since
in prod we load images from built-in resources.

public

Reviewed By: vjeux

Differential Revision: D2616995

fb-gh-sync-id: 2906c62380280ecb987525edf9a0e3e727a1008b
2015-11-05 12:53:26 -08:00
Pieter De Baets 0c83407dd2 Simplify logging exceptions from JS to native
Reviewed By: vjeux

Differential Revision: D2615559

fb-gh-sync-id: ee931b3691251c8b6276699c6f927e47d8e8fd97
2015-11-05 12:51:47 -08:00
Nick Lockwood 8db1e1262e Attempt to fix RCTImageLoader crash
Reviewed By: jspahrsummers

Differential Revision: D2620944

fb-gh-sync-id: 39896c8aa6f162df5769afdd0f947acf4bb5cb76
2015-11-05 09:09:29 -08:00
Patrick O'Meara b3cfc598ce allowFontScaling false changing lineHeight
Summary: * allowFontScaling false was still changing lineHeight as if it were true

fixes #2783
Closes https://github.com/facebook/react-native/pull/3840

Reviewed By: svcscm

Differential Revision: D2615710

Pulled By: nicklockwood

fb-gh-sync-id: 7e4205c58967640762deb5837ecaa2dde236782c
2015-11-05 09:02:22 -08:00
Pawel Sienkowski 4e1f2f4e0f Fixed: Move out setupDevtools call from renderApplication function
Reviewed By: sahrens

Differential Revision: D2620876

fb-gh-sync-id: 8971a1c523c06966dd11280e19272429aa3f9c8d
2015-11-05 08:50:29 -08:00
Andrei Coman e3b6104810 Fix ViewPager warning
Differential Revision: D2620741

fb-gh-sync-id: 9f35e94efb25c689661bf2775a7d0624b3c586f4
2015-11-05 05:06:33 -08:00
Nick Lockwood 11df4cb08c Fixed display of alerts on top of modal window
Reviewed By: javache

Differential Revision: D2616170

fb-gh-sync-id: f72f728008099fff6fc966d7a2ce4c0d27a4fefd
2015-11-05 03:54:31 -08:00
Brent Vatne 0da2004e88 Expose additional private modules
Summary: - TextInputState as TextInput.State
- Touchable
- flattenStyle as StyleSheet.flatten
- ReactNativeART as ART

Original discussion in #1821
Closes https://github.com/facebook/react-native/pull/3308

Reviewed By: sebmarkbage

Differential Revision: D2527152

Pulled By: javache

fb-gh-sync-id: 19d4ef9d4c0e6587b9f0793e1ca624aebb034f3b
2015-11-05 03:35:18 -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
Christoph Pojer 7041a22bd0 Update jest to 0.7.1
Reviewed By: frantic

Differential Revision: D2614935

fb-gh-sync-id: 64cc4fb439f0c53f0eb0588c22e0291813a7e334
2015-11-04 14:42:13 -08:00
Spencer Ahrens a4f7aa4853 make onEndReached a little more robust
Summary: public

Now if you scroll up out of the end threshold and then back down into it,
onEndReached will get triggered again.  This closes https://github.com/facebook/react-native/issues/1967

This also resets onEndReached when the data source changes.  This would fix
issues where the data source changes and onEndReached should fire again since
the new data may have more pages, whereas the old data had reached the end and
stopped.

Reviewed By: jingc

Differential Revision: D2610799

fb-gh-sync-id: f6cef513a42d4765514bf4bc55d9e31a760117f1
2015-11-04 11:32:28 -08:00
Josh Berdine c357943dfb Only make backgroundColor opaque if non-nil
Summary: public

Do not set a default backgroundColor of white when top-level RCTShadowText has
backgroundColor == nil.

Reviewed By: nicklockwood

Differential Revision: D2605636

fb-gh-sync-id: f2076d302e7ed574f7804080ccc80db1c9b9401c
2015-11-04 08:55:36 -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
Jean Regisser 1e52ef23e7 Fix retain cyles in RCTNetworkTask when used with RCTFileRequestHandler and RCTDataRequestHandler
Summary: Hi,

While implementing my own `RCTURLRequestHandler` I came across retain cycles in `RCTNetworkTask` when used with `RCTFileRequestHandler` and `RCTDataRequestHandler`.

The `NSBlockOperation` used in `RCTFileRequestHandler` and `RCTDataRequestHandler` could never be dealloc'ed because of a retain cycle.
And then the second issue was that those blocks were also strongly capturing the passed delegate which in this case is the `RCTNetworkTask` itself and then since the task was storing the block as a `requestToken`, the task could never be dealloc'ed as well.

Here are my proposed fixes. Let me know what you think.
Closes https://github.com/facebook/react-native/pull/3884

Reviewed By: svcscm

Differential Revision: D2615353

Pulled By: nicklockwood

fb-gh-sync-id: a73cbecffbebea75aaeb23d39f04a0d87602926f
2015-11-04 07:16:26 -08:00
Nick Lockwood d799558db5 Fix Groups text input
Reviewed By: javache

Differential Revision: D2590712

fb-gh-sync-id: 453e20970460c703230547d8fd649383ba7d4c4a
2015-11-04 04:09:27 -08:00
Hedger Wang 4763f89efa update NavigationContext API.
Summary: 1. Add a new api `top` which returns the root navigator of a nested navigator.
2. Remove the param `context` from the method `addListener` because it's not used and not necessary.

public

Reviewed By: fkgozali

Differential Revision: D2613852

fb-gh-sync-id: 0d5544422ff0be7875824989a4fbefbef9aac986
2015-11-03 19:08:31 -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
aleclarsoniv 5dd3b88a81 Use 'visibleLength' if 'contentLength' is less
Summary: This prevents the 'distanceFromEnd' from being negative when 'offset' is zero, for example.
Closes https://github.com/facebook/react-native/pull/3074

Reviewed By: svcscm

Differential Revision: D2610771

Pulled By: sahrens

fb-gh-sync-id: f878f1c1b865063294013c3bb96b90831877d372
2015-11-03 10:13:28 -08:00
Pawel Sienkowski 9bfadb7e1e Revert moving out setupDevtools call
Reviewed By: menglu

Differential Revision: D2609340

fb-gh-sync-id: 3b27b3e18805660bd19ae705916ce4e51120f7f3
2015-11-02 18:34:25 -08:00
Pawel Sienkowski 7021918fe5 Move out setupDevtools call from renderApplication function
Reviewed By: frantic

Differential Revision: D2600393

fb-gh-sync-id: edac2fa3281314fb02a0951c342c2c1ae9b0441a
2015-11-02 15:37:38 -08:00
Pieter De Baets 15c53f7563 Fix ReferenceImages resolving for `buck test`
Reviewed By: nicklockwood

Differential Revision: D2605694

fb-gh-sync-id: 90e65974c73405d482476c9eb2ddf1377f9a1401
2015-11-02 11:02:29 -08:00
Spencer Ahrens 99158f0d5a Better error message for RawText outside <Text>
Summary: public

Native iOS has a good error message, but it's in native which makes
things a little harder to track down (can't use Chrome debugger as easily).

Android has no special handling, so a cryptic "Trying to add unknown view tag..."
redbox would come up.

This puts the error handling in JS so it's shared on all platforms and can be
debugged more easily in Chrome.

Reviewed By: vjeux

Differential Revision: D2606064

fb-gh-sync-id: 5295a44a028c7be79d60dbaf0b5d59fd0a56fdde
2015-11-02 10:51:44 -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
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
Tadeu Zagallo 23f7c3acd9 Reenable JS calls to systrace on reload
Summary: public

After reloading the JS side of the profiler wasn't being reenabled.

Reviewed By: javache

Differential Revision: D2602258

fb-gh-sync-id: 5de8afb829e9fa8225600e2b0ff9e00313ac1d4c
2015-11-02 05:35:35 -08:00
Tadeu Zagallo d33e84dde5 Use nativeTrace(Begin|End)Section directly from BridgeProfiling
Summary: public

Call the native bindings explicitly from BridgeProfiling instead of polyfill'ing `console.profile` with
a function that has a different signature.

Reviewed By: vjeux

Differential Revision: D2602313

fb-gh-sync-id: 9295eff9458f2caa35b7e982c0f7c06dbe65fd09
2015-10-31 16:43:28 -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
aleclarsoniv 97f9aa842c Add 'onMoveShouldSetResponderCapture' to 'propTypes'
Summary: Closes https://github.com/facebook/react-native/pull/3777

Reviewed By: svcscm

Differential Revision: D2602708

Pulled By: javache

fb-gh-sync-id: 8259ffd4cdd3d0c052e94ac50a9020d6da59ded7
2015-10-30 16:38:27 -07:00
Alexey Lang 9fe36beec9 Log JSBundleRequireTime and JSAppRequireTime.
Reviewed By: javache

Differential Revision: D2590707

fb-gh-sync-id: 4c306342b5725aaaac1d8fa0257ef860e446b0d4
2015-10-30 12:06:29 -07:00
Hedger Wang a33fe94dac build nested navigation context based on the hierarchy of navigators.
Reviewed By: zjj010104

Differential Revision: D2598388

fb-gh-sync-id: 9655bcc86021678984e2a29df20ad2496a1762d1
2015-10-30 11:09:28 -07:00
Naomi Jacobs 854689dcfa Add fetch's clone function to Request and Response prototypes
Summary: Fetch includes a cloning function that was not included in the React Native fetch.js. This adds it in so that cloning is available on responses from fetch calls in React Native. The code is taken directly from [fetch](https://github.com/github/fetch/blob/master/fetch.js) on Github.

<img width="601" alt="screen shot 2015-10-22 at 11 50 53 am" src="https://cloud.githubusercontent.com/assets/11564650/10675101/304ebe5a-78b3-11e5-9d6b-24ea6d9fb998.png">

<img width="596" alt="screen shot 2015-10-22 at 12 20 08 pm" src="https://cloud.githubusercontent.com/assets/11564650/10675834/4abaf4ee-78b7-11e5-9d34-436290b64b30.png">
Closes https://github.com/facebook/react-native/pull/3614

Reviewed By: svcscm

Differential Revision: D2600517

Pulled By: sahrens

fb-gh-sync-id: d70c5c58e923d997f93bb5aa2d1d90e95d5a75f2
2015-10-30 10:57:33 -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
Ivan Sorokin e409e20d2b Step support for SliderIOS
Summary: Add step support to SliderIOS
Closes https://github.com/facebook/react-native/pull/3746

Reviewed By: svcscm

Differential Revision: D2595360

Pulled By: nicklockwood

fb-gh-sync-id: 4adf8bcdf46c709776d779244ba3de2b40eb27d6
2015-10-30 07:18:28 -07:00
Oleg Lokhvitsky 26e3bf97d3 Revert D2590497
Reviewed By: pvulgaris

Differential Revision: D2597148

fb-gh-sync-id: a8b6e7c3a90a8a1eaefc996d6243c4a171df37c8
2015-10-29 14:35:32 -07:00
Alex Kotliarskyi 9a93a3cba4 Use pre-bundled elements inspector
Reviewed By: spicyj

Differential Revision: D2588448

fb-gh-sync-id: 278631c1de78cac2bfd9950809feddbe3f630ad0
2015-10-29 11:21:32 -07:00
Andr3wHur5t 22cc044a67 Added support for toggling POI visibility on iOS map view.
Summary: Adds support for toggling points of interests visibility on iOS map view; resolving #3244
Closes https://github.com/facebook/react-native/pull/3631

Reviewed By: svcscm

Differential Revision: D2575148

Pulled By: nicklockwood

fb-gh-sync-id: 0d0ee9d3b4726aa40bc439bc2f36d1db4cae1147
2015-10-29 11:02:25 -07:00
Martin Konicek 8167f40163 Document that WebView is iOS-only until we open source the Android implementation
Summary: The absence of docs can be confusing:
https://twitter.com/40_thieves/status/659500246632939520

public

Reviewed By: davidaurelio

Differential Revision: D2595809

fb-gh-sync-id: b741263782ad579bb40e94a383992dca3a6e8040
2015-10-29 10:09:34 -07:00
Bhuwan Khattar 47b124436f require InitializeJavaScriptAppEngine in bundle
Reviewed By: martinbigio

Differential Revision: D2582794

fb-gh-sync-id: d6cfdda81f556ef0cefb2e9dc58f5978b651bd5b
2015-10-28 21:09:24 -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
Hedger Wang 064de3b338 Replace Navigator with AdsManagerNavigator - step 1
Reviewed By: fkgozali

Differential Revision: D2585102

fb-gh-sync-id: 6f0d51d755e0926f7c6f4d411a026cebf49333a2
2015-10-28 18:27:26 -07:00
Krzysztof Magiera dea4c2ca8e Use onLayout in listview instead of calling measure for every scroll event.
Reviewed By: sahrens

Differential Revision: D2590497

fb-gh-sync-id: 42a8f97dcb43b3a59ba3f0a008fb363f8e8c7200
2015-10-28 12:43:29 -07:00
Spencer Ahrens a2d58203b8 Fix AsyncStorage error multiplexing
Reviewed By: nicklockwood

Differential Revision: D2590231

fb-gh-sync-id: 399a783a474367855d526e0b2604d0f862594102
2015-10-28 12:03: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
Manuel Nakamurakare 7d4f5a5c47 added property to sliderIOS to be able to disable it
Summary: added a new property named 'disable' to SliderIOS
this property prevents the user from being able to slide the slider
Closes https://github.com/facebook/react-native/pull/3730

Reviewed By: svcscm

Differential Revision: D2590154

Pulled By: javache

fb-gh-sync-id: b8a9c82c1b05eb813d9b81180cb1083b3f1852ac
2015-10-28 05:48:28 -07:00
Hedger Wang ae58fe221b Stop handling animation once Navigator is unmounted.
Summary: public
Navigator subscribes to its internal animation spring that may still
asks navigator to re-render after being unmounted.

This diff clears the listeners of its animation spring once navigator
is unmounted.

Reviewed By: zjj010104

Differential Revision: D2588434

fb-gh-sync-id: 2b3ee65d3a6c3d45e5c6904d1dc65ac5a3e4534a
2015-10-27 18:30:24 -07:00