Commit Graph

519 Commits

Author SHA1 Message Date
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