Commit Graph

671 Commits

Author SHA1 Message Date
chaceliang 7159a4e947 Revert "[React Native] Remove layout-only nodes" 2015-06-25 13:30:06 -08:00
Eric Vicenti 7963add0d5 [ReactNative] Revamp Navigator scene cache strategy
Summary:
Updating range is too complicated. We can keep cached versions of the previously rendered scenes in a map.

@public

Test Plan: Verify that the active scene is the only thing that get re-rendered, and that rendering doesn't happen during transitions or gestures. Test navigation thouroughly in AdsManager
2015-06-25 10:36:49 -08:00
Tadeu Zagallo 5e71d352a6 [ReactNative] Guard agains errors during reconciliation
Summary:
@public

After refactoring the MessageQueue a guard was missing on around `batchedUpdates`
call.

Test Plan: Introduce an error on `getInitialState` of `AdsManagerTabsModalView.ios.js`
2015-06-25 09:40:48 -08:00
Stanislav Vishnevskiy f383bf2b83 [LayoutAnimation] RCTAnimationTypeKeyboard
Summary:
This adds the Keyboard animation type for when you want to animate UI based on the keyboard appearing/disappearing.
Closes https://github.com/facebook/react-native/pull/1366
Github Author: Stanislav Vishnevskiy <vishnevskiy@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 09:17:01 -08:00
David Mohl 99bc08cf61 [MapView] Support for annotation callouts, annotation press, callout presses and pin animation
Summary:
Started from here - https://github.com/facebook/react-native/issues/1120. Most functionality for annotations were missing so I started implementing and somehow got caught up until the entire thing was done.

![screen shot 2015-05-12 at 10 07 43 pm](https://cloud.githubusercontent.com/assets/688326/7588677/8479a7a4-f8f9-11e4-99a4-1dc3c7691810.png)

2 new events:
- callout presses (left / right)
- annotation presses

6 new properties for annotations:
- hasLeftCallout
- hasRightCallout
- onLeftCalloutPress
- onRightCalloutPress
- animateDrop
- id

1 new property for MapView
- onAnnotationPress

---
Now the important thing is, that I implemented all of this the way "I would do it". I am not sure this is the 'reacty' way so please let me know my mistakes 😄

The problem is that there is no real way to identify annotations which makes it difficult to distinguish which one got clicked. The idea is to pass a `id` and whether it has callouts the entire way with the annotation. I had to
Closes https://github.com/facebook/react-native/pull/1247
Github Author: David Mohl <me@dave.cx>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 09:15:21 -08:00
Alex Akers 3c5b4b0a9f [React Native] Remove layout-only nodes
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.

This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.

The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.

@public

Test Plan: There are tests in `RCTUIManagerTests.m` that test the tag- and index-manipulation logic works. There are various scenarios including add-only, remove-only, and move. In addition, two scenario tests verify that the optimization works by checking the number of views and shadow views after various situations happen.
2015-06-25 09:12:00 -08:00
Alex Kotliarskyi 64d7933e66 [ReactNative] Ignore _UILayoutGuide in tests 2015-06-25 08:09:13 -08:00
Andy Street f23c022f1b [ReactNative] Send debug component ownership info in createView 2015-06-25 05:47:24 -08:00
Olivia Bishop 1373dab826 [react native] JS change to support placeholderTextColor on android 2015-06-25 05:15:21 -08:00
=?UTF-8?q?=E9=9A=90=E9=A3=8E?= b09f3eaf26 Fix animation bug in 32bit when fromValue is double.
Summary:
Now `RCTAnimationExperimentalManager` is not working on 32bit devices.

```
NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath];
CGFloat fromFields[count];
[fromValue getValue:fromFields];
```

If the fromValue is kind of double value which needs two bytes in 32bit device and the count is 1, the fromFileds array will go wrong.
Closes https://github.com/facebook/react-native/pull/1725
Github Author: =?UTF-8?q?=E9=9A=90=E9=A3=8E?= <yinfeng.fcx@alibaba-inc.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-25 05:08:45 -08:00
Nick Lockwood 648c2b48c2 Restructuring FBReactKit project: Part 1 2015-06-25 02:14:33 -08:00
Alex Kotliarskyi 01d2df8c86 [ReactNative] NavigationContext-test mock fix for OSS 2015-06-24 13:37:46 -08:00
Pieter De Baets effa43926b Provide root reactTag to RootComponent and use it to resolve view controllers 2015-06-24 10:20:55 -08:00
Artem Yarulin 3c72250a1a Fixed inline function to process last symbol (iOS9)
Summary:
### TL/DR:
```
a="function() {return [22]}"
a.substring(a.indexOf("{")+1,a.indexOf("}")-1) // "return [22"
a.substring(a.indexOf("{")+1,a.indexOf("}")) // "return [22]"
```

### In long: why it is broken now and why it worked before:

I've installed latest iOS 9 and started to see really strange issues when code is minified:
```
Invariant Violation: Application app has not been registered."
2015-06-18 16:29:05.898 [error][tid:com.facebook.React.JavaScript] "Error: Unexpected identifier 'transformMatrix'. Expected ']' to end a subscript expression
```

After some investigation it turns out that new Safari returned a bit different string representation for a MatrixOps.unroll. On old safari:
`function(e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],p=e[10],d=e[11],h=e[12],f=e[13],m=e[14],g=e[15];}`
while using latest iOS:
`function (e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9]
Closes https://github.com/facebook/react-native/pull/1672
Github Author: Artem Yarulin <artem.yarulin@fessguid.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-24 09:42:51 -08:00
Jing Chen b58578e935 [rn] Add PerformanceOverlay to the inspector 2015-06-23 15:41:41 -08:00
Eric Vicenti 47508566a0 [ReactNative] resizeMode is not a nativeOnly prop
Summary:
resizeMode is a native prop, but it is also in the propTypes, so this causes an incorrect warning:

```
Prop resizeMode = `contain` should not be set directly on Image.
```

@public

Test Plan: No warnings on image example in UIExplorer
2015-06-23 08:57:47 -08:00
Eric Vicenti 0c38229e8e [Navigator] Fix overswipe to -1, move guard 2015-06-22 17:00:52 -08:00
Eric Vicenti d105ae7e51 [AdsManager] Fix Navigation focus events for logging 2015-06-22 16:44:32 -08:00
Spencer Ahrens 5b476d0e41 [ReactNative] Fix manual ListView loading
Summary:
@public

If something changes in the list view that should trigger more loads, it
wouldn't.  Example case is tap to load more - only the first new row would load,
but it wouldn't trigger a re-measure and subsequent layout of additional new
rows.

Test Plan: View More in Events works.
2015-06-22 13:37:30 -08:00
Hedger Wang 7f54506f96 <Navigator />: Fix the getter for `navigationContext`.
Summary:
@public
The current getter for `navigationContext` always return a static
context, and it should return an instance-based one, instead.

Test Plan:
Use console.log() in inspect that two different navigators do
have their own `navigationContext` created.
2015-06-22 12:02:55 -08:00
Alex Kotliarskyi 1429b78af5 [ReactNative] Ignore bad inputs to parseErrorStack 2015-06-22 10:09:08 -08:00
Gabe Levi 972b546fc6 [Flow] Fix or suppress errors in react-native for Flow v0.13.0 2015-06-22 09:48:15 -08:00
Felix Oghină 22ea66923f [react_native] JS files from D2172754: support setting the cursor position in TextInput 2015-06-22 06:10:46 -08:00
David Mohl 90aad9a610 Add support for selecting media from library
Summary:
This PR adds support for UIImagePickerController to allow selecting a photo / video from the users camera roll.

![ios simulator screen shot jun 14 2015 4 50 03 pm](https://cloud.githubusercontent.com/assets/688326/8147758/ae6dc8d4-12b6-11e5-80f0-2bcaa964a5d8.png)

Example:

Selecting something from camera roll
```
ImagePickerIOS.openSelectDialog(<config>, <successCallback>, <cancelCallback>);

ImagePickerIOS.openSelectDialog({
   showImages: true, // defaults to true
   showVideos: false // defaults to false
}, function (data) {
  console.info("Got a callback!");
  console.info(data); // file URL as in assets-library://asset/asset.JPG?id=E2741A73-D185-44B6-A2E6-2D55F69CD088&ext=JPG
}, function() {
  console.info("Cancelled");
});
```

Using camera
```
ImagePickerIOS.openCameraDialog(<config>, <successCallback>, <cancelCallback>);

ImagePickerIOS.openSelectDialog({
   videoMode: false, // defaults to true, whether to record videos instead
}, function (data) {
  console.info("Got
Closes https://github.com/facebook/react-native/pull/1620
Github Author: David Mohl <me@dave.cx>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-22 03:09:16 -08:00
Amjad Masad 2d4055e513 [react-packager] Rewrite dependency graph (support node_modules, speed, fix bugs etc)
Summary:
@public
Fixes #773, #1055
The resolver was getting a bit unwieldy because a lot has changed since the initial writing (porting node-haste).
This also splits up a large complex file into the following:

* Makes use of classes: Module, AssetModule, Package, and AssetModule_DEPRECATED (`image!` modules)
* DependencyGraph is lazy for everything that isn't haste modules and packages (need to read ahead of time)
* Lazy makes it fast, easier to reason about, and easier to add new loaders
* Has a centralized filesystem wrapper: fast-fs (ffs)
* ffs is async and lazy for any read operation and sync for directory/file lookup which makes it fast
* we can easily drop in different adapters for ffs to be able to build up the tree: watchman, git ls-files, etc
* use es6 for classes and easier to read promise-based code

Follow up diffs will include:
* Using new types (Module, AssetModule etc) in the rest of the codebase (currently we convert to plain object which is a bit of a hack)
* using watchman to build up the fs
* some caching at the object creation level (we are recreating Modules and Packages many times, we can cache them)
* A plugin system for loaders (e.g. @tadeuzagallo wants to add a native module loader)

Test Plan:
* ./runJestTests.sh react-packager
* ./runJestTests.sh PackagerIntegration
* Export open source and run the e2e test
* reset cache
* ./fbrnios.sh run and click around
2015-06-19 18:05:18 -08:00
Andrei Coman 5c1ac2a753 [ReactNative] Block native from becoming js responder 2015-06-19 16:30:15 -08:00
Hedger Wang 93e98da908 [Navigator]: Add a getter to get the current route that is focused from the navigation context. 2015-06-19 16:12:51 -08:00
Tadeu Zagallo 080d3b9f62 [ReactNative] Add PerformanceLogger to measure TTI
Summary:
@public

Add PerformanceLogger to keep track of JS download, initial script execution and
full TTI.

Test Plan:
The Native side currently calls `addTimespans` when it's finish initializing
with the six values (start and end for the three events), so I just checked it
with a `PerformanceLogger.logTimespans()` at the end of the function.

```
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "ScriptDownload: 48ms"
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "ScriptExecution: 106ms"
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "TTI: 293ms"
```
2015-06-19 15:01:35 -08:00
Alex Akers caffd60a3f [React Native] Update description on RCTText 2015-06-19 07:59:41 -08:00
Andy Street 0116abed4f [react_native] JS files from D2164109: [react_native] Fix JS error stacktraces on Android 2015-06-19 04:32:40 -08:00
Nick Lockwood c8c254ce13 Changed methodQueue to a property 2015-06-19 04:20:39 -08:00
Tadeu Zagallo cf0e40ad3d [ReactNative] Fix MessageQueue-test on open source
Summary:
@public

Fix mocking on MessageQueue-test

Test Plan: Run the test
2015-06-18 08:56:33 -08:00
Nick Lockwood 5263b23321 Renamed RCTDataManager to RCTNetworking 2015-06-18 09:44:30 -08:00
Olivier Notteghem 58d01c7981 [RN Inspector] : fix CSS not to use view overflow which is not supported on iOS 2015-06-18 05:46:33 -08:00
Andy Street 3029511ce4 [react_native] JS files from D2163804: [react_native] Add native root tag to createView calls 2015-06-18 05:26:41 -08:00
Andrei Coman 3fa8ec0271 [ReactNative] Change text input underline color 2015-06-17 15:25:52 -08:00
Hedger Wang e78b8c40fe [oss][react-native] unbreak NavigationEventEmitter-test 2015-06-17 14:13:05 -08:00
alvaromb a48e9b4690 [WebView] Exposed scalesPageToFit UIWebView property
Summary:
Added the ``scalesPageToFit`` prop to ``WebView``. This allows ``UIWebView`` to handle user zoom and scale.
Closes https://github.com/facebook/react-native/pull/1631
Github Author: alvaromb <amedina@apsl.net>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-17 13:56:38 -08:00
Felix Oghina 6e3472d13e [react_native] JS files from D2164068: support filtering by mimeType in CameraRollManager#getPhotos 2015-06-17 12:20:27 -08:00
James Ide 51e5794cb8 [ActivityIndicator] Specify a width
Summary:
The activity indicator was treated as a zero-width element without an explicit width. Fill it in so the style dimensions match what is displayed on the screen.

Closes https://github.com/facebook/react-native/pull/1156
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Render an ActivityIndicator with a background, and see that the background shows up as a square behind the spinner instead of not showing up at all (since it was 0px wide previously).
2015-06-17 07:49:59 -08:00
Tadeu Zagallo 92d98533f1 [ReactNative] Refactor BatchedBridge and MessageQueue
Summary:
@public

The current implementation of `MessageQueue` is huge, over-complicated and spread
across `MethodQueue`, `MethodQueueMixin`, `BatchedBridge` and `BatchedBridgeFactory`

Refactored in a simpler way, were it's just a `MessageQueue` class and `BatchedBridge`
is only an instance of it.

Test Plan:
I had to make some updates to the tests, but no real update to the native side.
There's also tests covering the `remoteAsync` methods, and more integration tests for UIExplorer.
Verified whats being used by Android, and it should be safe, also tests Android tests have been pretty reliable.

Manually testing: Create a big hierarchy, like `<ListView>` example. Use the `TimerMixin` example to generate multiple calls.
Test the failure callback on the `Geolocation` example.

All the calls go through this entry point, so it's hard to miss if it's broken.
2015-06-17 07:49:33 -08:00
Nick Lockwood 6573d256ba Improve test architecture so failures don't crash the simulator 2015-06-17 07:09:23 -08:00
Nick Lockwood d83ee3bd5a Better text background behavior 2015-06-17 05:35:57 -08:00
Peter Cottle a331bb7526 [RFC] Add ScrollView bounded height explanation
Summary:
As discussed in our internal group, think this is a fairly easy error to run into so I added some explanation.

@frantic / @vjeux open to better wording here, but I tried to explain how setting the height directly is discouraged and it's probably better to pipe `flex: 1` all the way down.

I didn't regenerate the website since the script assumes some permissions (push permission to master repo) and has some missing npm dependencies (and after fixing that, still had some obscure error :P )
Closes https://github.com/facebook/react-native/pull/1633
Github Author: Peter Cottle <pcottle@fb.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-16 15:48:30 -08:00
Prathamesh Sonpatki 7dd2dd7962 [Docs] Fixed word auto-correction in TextInput.js
Summary:
Closes https://github.com/facebook/react-native/pull/1593
Github Author: Prathamesh Sonpatki <csonpatki@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-16 10:13:04 -08:00
Hedger Wang 0a875790f5 [Navigator]: Allow developer to observe the focus change events from the owner or the children
of the navigator component.

Summary:
Per offline discussion with @evv, we'd like to deprecate the `onDidFocus` and `onWillFocus`
API that makes it really hard for the descendent children of a navigator to observe its focus
change events.
@public

Since for now the descendent children do have access to the navigator via `this.props.navigator`,
this diff makes it easy to observe the focus change event by doing:

```
this.props.navigator.addListener('willfocus', this._onFocus);
```

The goal is to make the event system in navigator more useful and maintainable.

Test Plan:
Test Video: https://www.facebook.com/pxlcld/mrzS
1. jest:  ./Libraries/FBReactKit/js/runTests.js NavigationEventEmitter
2. Load UI Explorer: <Navigator />, see console logs that shows the focus change events fires.
2015-06-16 09:09:08 -08:00
Shuangzuan 5793f5c4c4 [AnimationExperimental] Fixed CATransaction completion block invoke immediately
Summary:
[CATransaction Class Reference](https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CATransaction_class/index.html)

In Tasks > Getting and Setting Completion Block Objects > Discussion:

The completion block object that is guaranteed to be called (on the main thread) as soon as all animations subsequently added by this transaction group have completed (or have been removed.) If no animations are added before the current transaction group is committed (or the completion block is set to a different value,) the block will be invoked immediately.
Closes https://github.com/facebook/react-native/pull/1400
Github Author: Shuangzuan <shuangzuan.he@icloud.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-16 06:15:23 -08:00
James Ide 1d030ae64e [Docs] Clarify in the AsyncStorage docs that it is global to the app, not OS
Summary:
There was some confusion over whether AsyncStorage is shared across the entire OS (definitely not); clearing that up.
Closes https://github.com/facebook/react-native/pull/1596
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 14:18:09 -08:00
James Ide 3393b86534 [ListView] Update curRenderedRowsCount when data source changes
Summary:
When a new data source is provided, update `curRenderedRowsCount` in addition to `prevRenderedRowsCount`. What was happening is that I had an empty data source, so `curRenderedRowsCount` and `prevRenderedRowsCount` both settled at zero after the first few frames and `curRenderedRowsCount` wasn't getting increased when the data source was updated.

I also changed the `setState` calls to use the transactional API since several of the new state values are computed from the old ones.

Maybe fixes #1547
Closes https://github.com/facebook/react-native/pull/1612
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 13:30:17 -08:00
Jan Monschke e2fc7d2362 Sort StyleProps alphabetically
Summary:
Sorting the StyleProps alphabetically makes it easier to scan through the list of available props e.g. in case of typos.

Filled out the FB CLA form just now.

Related to #1605
Closes https://github.com/facebook/react-native/pull/1607
Github Author: Jan Monschke <jan.monschke@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 13:29:46 -08:00
Tadeu Zagallo d3065fc2e7 [ReactNative] Remove RCT_IMPORT_METHOD macro and generate lookup table dynamically
Summary:
@public

This removes the last piece of data that was still stored on the DATA section,
`RCT_IMPORT_METHOD`. JS calls now dynamically populate a lookup table simultaneously
on JS and Native, instead of creating  a mapping at load time.

Test Plan: Everything still runs, tests are green.
2015-06-15 13:05:52 -08:00
Tadeu Zagallo 86dc92d5ab [ReactNative] Add ReactPerf info to profiler timeline
Summary:
@public

Hook into ReactPerf to add markers to `RCTProfile` timeline.

Test Plan: {F22569628}
2015-06-15 13:04:25 -08:00
Prathamesh Sonpatki 03f49c8b0f [Docs] Added documentation for onChangeText prop of TextInput
Summary:
Closes https://github.com/facebook/react-native/pull/1602
Github Author: Prathamesh Sonpatki <csonpatki@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 12:15:24 -08:00
Shuangzuan df8287d8ee [PushNotification] Unregister for remote notifications support.
Summary:
See iOS Developer Library: [- unregisterForRemoteNotifications](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/instm/UIApplication/unregisterForRemoteNotifications).

Unregister for all remote notifications received via Apple Push Notification service.

**Discussion**
You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.
Closes https://github.com/facebook/react-native/pull/1520
Github Author: Shuangzuan <shuangzuan.he@icloud.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 12:13:46 -08:00
Alex Akers 3ce8b1a1c8 [React Native] Implement -(recursiveD|d)escription for RCT(Shadow)View 2015-06-15 12:08:45 -08:00
James Ide 5d6a89bc61 [Text] Support "textAlign: justify" in Text components
Summary:
Finished adding support for justified text on iOS... just had to expose a prop value.
Fixes #529

Closes https://github.com/facebook/react-native/pull/1486
Github Author: James Ide <ide@jameside.com>

Test Plan:
 View the Text example in the UIExplorer and see that all but the last lines of text in the justified text example are justified and extend to the far right of the available space. Tested on iOS 8, iPhone 6 simulator.

![text](https://cloud.githubusercontent.com/assets/379606/7926252/a90d2e98-0884-11e5-9f12-5cbb27505a0b.png)
2015-06-15 12:00:12 -08:00
Tadeu Zagallo 58c58d9bed [ReactNative] Fix racing condition on RKHTTPRequestHandler 2015-06-15 11:24:42 -08:00
Tadeu Zagallo c30365acba [ReactNative] Remove RCTJSTimers
Summary:
@public

Remove `RCTJSTimers.js`, the file was just an alias to `JSTimersExecution`.

Test Plan: Still builds.
2015-06-15 10:50:28 -08:00
Nick Lockwood 650fc9de4c Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues
Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
2015-06-15 07:52:50 -08:00
Tadeu Zagallo efd386eba2 [ReactNative] Fix timers for debugger executors
Summary:
@public

`-[RCTJavaScriptExecutor executeBlockOnJavaScriptQueue:]` would always `dispatch_async`
for the WebView and WebSocket executors, what caused for any frame aligned dispatch.

Test Plan:
Test the `Timers, TimerMixin` example on UIExplorer, `requestAnimationFrame` was
taking ~33.3ms when debugging, now takes ~16.6ms as expected.
2015-06-12 16:59:19 -08:00
Eric Vicenti 32f895a315 [ReactNative] NetInfo listener Map 2015-06-12 14:56:21 -08:00
Nick Lockwood 5efc1b48a5 Fixed text layout on screen rotation
Summary:
@public

setFrame:forRootView: wasn't triggering a batch update, which is required to trigger text update. This meant text wasn't re-displayed after a rotate, only after a touch.

I also found a bug that meant we weren't caching textStorage as much as we could be. Fixed that too.

Test Plan:
* Test <Text> example in UIExplorer and ensure it lays out on rotate.
* Test <Timers> example and verify text is still updating
* Products shouldn't be affected as they have separate text implementation
2015-06-12 11:54:21 -08:00
James Ide 1c5053b24d [ReactNative] Export EdgeInsetsPropType and PointPropType
Summary:
Added some more exports to React that are either necessary or often useful for component authors.

Closes https://github.com/facebook/react-native/pull/262
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-12 11:16:14 -08:00
James Ide 6b621a5677 [Idea: ScrollView] Add `getScrollResponder` to ScrollView for composition
Summary:
This is a proposal to add `getScrollResponder` to all ScrollView-like components, including ListView. This allows multiple higher-order scroll views to be composed while allowing the owner of the top-level scroll view to call `scrollableView.getScrollResponder().scrollTo(...)` regardless of whether `scrollableView` is a ScrollView, ListView, InvertedScrollView, etc.
Closes https://github.com/facebook/react-native/pull/766
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-12 11:15:51 -08:00
Tadeu Zagallo 2a7adfb815 [ReactNative] Use RCTNullIfNill and (id)kCFNull
Summary:
@public

Use consistent `null` handling:

`value || null`                ->  `RCTNullIfNil(value)`
`value == null ? nil : value`  ->  `RCTNilIfNull(value)`
`[NSNull null]`                ->  `(id)kCFNull`

Test Plan: The tests should be enough.
2015-06-12 11:03:10 -08:00
Andrei Coman 3ff6abb6d1 [react_native] JS files from D2139723: [react_native] Set WebView user-agent from JS 2015-06-12 02:37:57 -08:00
Stanislav Vishnevskiy 86d4f4e20a [WebSocket] Reason can be null which causes an exception with NSDictionary in websocketClosed
Summary:
I am not 100% sure what causes reason to be null but it does happen.
Closes https://github.com/facebook/react-native/pull/1483
Github Author: Stanislav Vishnevskiy <vishnevskiy@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-11 18:06:29 -08:00
Gabe Levi 66c7511f73 [Flow] Fix or suppress last minute errors for 0.12.0 2015-06-11 17:43:06 -08:00
Jared Forsyth 15907419f3 [ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:

- Inspector
- InspectorOverlay
- InspectorPanel

and added @flow types.

The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).

All features of the inspector should remain functional, with the addition of
one feature:

- you can toggle "touch to inspect" by tapping the "Inspect" button at the
  bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
  the app normally without touches being intercepted

@public

Test Plan:
Open the inspector:

- touch to inspect things, verify that margin, padding, size and position are
  reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
  normally.

{F22548949}

[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 13:49:54 -08:00
Eric Vicenti 1b9067a3e3 [ReactNative] PushNotificationIOS listener Map 2015-06-11 13:43:36 -08:00
Jiajie Zhu f0bba0c111 [RN|madman] init AppStateIOS.currentState with 'active' 2015-06-11 13:22:16 -08:00
Adam Krell 04b3b52726 Add map type property (standard, satellite, hybrid) to MapView.
Summary:
Here is an example project demonstrating this pull request: [AKMapView](https://github.com/adamkrell/AKMapView)
Closes https://github.com/facebook/react-native/pull/1503
Github Author: Adam Krell <akrell@bethanyassociates.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-11 10:53:41 -08:00
Tadeu Zagallo dcf15f84dc [ReactNative] Fix racing condition on RCTDataManager 2015-06-11 10:44:05 -08:00
Nick Lockwood 2ee8410a71 Removed nullability attributes until Infer supports them 2015-06-11 10:39:29 -08:00
Eric Vicenti f8482411f9 [AdsManager] Improve animation configurations 2015-06-10 23:35:52 -08:00
Gabe Levi b05e99a531 [Flow] Fix or suppress react-native github errors for Flow v0.12.0 2015-06-10 13:34:19 -08:00
Nick Lockwood 5d154f1af4 Fixed deployment targets for React iOS submodules 2015-06-10 06:16:15 -08:00
Eric Vicenti 4690983c10 [AdsManager|ReactNative] Remove contextual navigation from Navigator 2015-06-10 01:13:43 -08:00
Spencer Ahrens 3102fc5df9 [ReactNative] Fix secure text entry
Summary:
@public

`validAttributes` strikes again.

Test Plan: secure box in example is actually secure
2015-06-09 16:02:38 -08:00
Tadeu Zagallo 847dff8d75 [ReactNative] Make JavaScript executors bridge modules
Summary:
@public

This is the first of a few diffs that change the way the executors are handled
by the bridge.

For they are just promoted to modules, so they are automatically loaded by the bridge.

Test Plan:
Tested on UIExplorer, Catalyst and MAdMan.
Tested all the 3 executors, everything looks fine.
2015-06-09 15:40:55 -08:00
Tadeu Zagallo 6358e163a5 [ReactNative] Revert `async exports` changes to MessageQueue + test
Summary:
@public

`[Bridge] Add support for JS async functions to RCT_EXPORT_METHOD` was imported but broke some internal code, reverting the `MessageQueue` that caused the issues and add a test, since the method is not used yet.

Test Plan: Run the test o/
2015-06-09 14:25:32 -08:00
James Ide 90439cec26 [Bridge] Add support for JS async functions to RCT_EXPORT_METHOD
Summary:
Adds support for JS async methods and helps guide people writing native modules w.r.t. the callbacks. With this diff, on the native side you write:

```objc
RCT_EXPORT_METHOD(getValueAsync:(NSString *)key
                       resolver:(RCTPromiseResolver)resolve
                       rejecter:(RCTPromiseRejecter)reject)
{
  NSError *error = nil;
  id value = [_nativeDataStore valueForKey:key error:&error];

  // "resolve" and "reject" are automatically defined blocks that take
  // any object (nil is OK) and an NSError, respectively
  if (!error) {
    resolve(value);
  } else {
    reject(error);
  }
}
```

On the JS side, you can write:

```js
var {DemoDataStore} = require('react-native').NativeModules;
DemoDataStore.getValueAsync('sample-key').then((value) => {
  console.log('Got:', value);
}, (error) => {
  console.error(error);
  // "error" is an Error object whose message is the NSError's description.
  // The NSError's code and domain are also set, and the native trace i
Closes https://github.com/facebook/react-native/pull/1232
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-09 14:25:31 -08:00
Nick Lockwood f88bc3eb73 [ReactNative] Refactor RCTDataManager to support pluggable data source modules (RCTURLRequestHandlers)
Summary:
@public

This is a refactor of @philikon's original diff that decouples the dependencies between the Network and Image modules, and replaces RCTDataQueryExecutor with a more useful abstraction.

I've introduced the RCTURLRequestHandler protocol, which is a new type of bridge module used for loading data using an NSURLRequest. RCTURLRequestHandlers can be registered using RCT_EXPORT_MODULE() and are then available at runtime for use by the RCTDataManager, which will automatically select the appropriate handler for a given request based on the handler's self-reported capabilities.

The currently implemented handlers are:

- RCTHTTPRequestHandler - the standard open source HTTP request handler that uses NSURLSession
- RKHTTPRequestHandler - the internal FB HTTP request handler that uses FBNetworking
- RCTImageRequestHandler - a handler for loading local images from the iOS asset-library

Depends on D2108193

Test Plan:
- Internal apps still work
- OSS port still compiles, Movies app and a sample Parse app still work
- uploading image to Parse using the above code snippet works
- tested `FormData` with string and image parameters using http://www.posttestserver.com/
2015-06-09 12:27:06 -08:00
Nick Lockwood f4bf80f3ea [ReactNative] Allow uploading native files (e.g. photos) and FormData via XMLHttpRequest 2015-06-09 12:27:05 -08:00
Andy Street 0a3fca9520 [react_native] JS files from D2130816: [react_native] Don't render crumb container to texture 2015-06-09 03:09:17 -08:00
Philipp von Weitershausen 8e2727ad52 Back out D2128859: interop with react devtools 2015-06-08 20:54:21 -08:00
Philipp von Weitershausen 0a95edf6ea [ReactNative] use Map, not Object when functions are keys 2015-06-08 17:43:17 -08:00
Christopher Chedeau 1a12b95f7a [ReactNative] Revert D2134877 2015-06-08 13:49:28 -08:00
Christopher Chedeau c9e555f4b3 [ReactNative] Better error message when forgetting to wrap Animated 2015-06-08 12:44:32 -08:00
Eric Vicenti f6528171d0 [ReactNative] Fix navigator touch-blocking logic
Summary:
The logic for this is incorrect when the `state.transitionToIndex === 0`, and will return false and not capture the touch.

@public

Test Plan: Try to repro bugs on device and simulator
2015-06-08 11:20:12 -08:00
Jared Forsyth d68776d5de interop with react devtools 2015-06-08 09:04:09 -08:00
Andrei Coman fc48f175c3 [react_native] JS files from D2126599: Android MentionInput Rendering (part 1/2) 2015-06-08 03:47:32 -08:00
Andrei Coman 8e3c02e4f0 [react_native] JS files from D2127018: [react_native] Add uiexplorer app 2015-06-08 03:28:35 -08:00
Christopher Chedeau 8ee9bfe944 [ReactNative] Fix XHR 2015-06-06 16:44:55 -08:00
Nick Lockwood 96c070de11 Fixed typo in XMLHttpRequest.ios.js 2015-06-05 18:47:18 -08:00
Nick Lockwood e00b9ac8f3 Added incremental XMLHttpRequest updates
Summary:
@public

Previously, our XMLHttpRequest implementation would only update the readyState when the download was fully completed. This diff adds support for receiving incremental data updates as the download happens, which can be monitored by adding the onreadystatechange event handler.

As a performance optimization, incremental data updates are only sent if the onreadystatechanged handler has been set in the JS, otherwise it just sends the whole data block once download is complete, as before.

Test Plan:
* Run the UIExplorer XMLHttpRequest example (in both OSS and Catalyst) to see incremental downloads working.
* Run the Movies app to see regular (non-incremental) downloads in action
* Run any network-based app in Catalyst shell to verify RKDataManager still works
2015-06-05 15:21:25 -08:00
Eric Vicenti bb95400f24 [ReactNative] Fix POPAnimation export issue from bad transform
Summary:
Some transform is going wrong here and produces broken code

@public

Test Plan: Test on OSS repo, e2e tests pass
2015-06-05 10:03:57 -08:00
Nick Lockwood 45d8fb0ef6 Removed deprecated RCT_EXPORT + code paths 2015-06-05 09:58:25 -08:00
Tadeu Zagallo 1a564eed77 [ReactNative] Run UIExplorer tests on sandcastle 2015-06-05 05:36:06 -08:00
Jared Forsyth 53b2c39cc0 select up and down the inspector hierarchy
Summary:
This allows you to select the displayed owner hierarchy, and see the styles,
props, and position.

@public

Test Plan:
Open the inspector, select something in the middle of the page. Click the
breadcrumb train in the inspector, and verify that:
- styles are reflected
- margin/padding/box is correct
- the highlight updates to show the selected item

See video as well.

[Video](https://www.latest.facebook.com/pxlcld/mqnl)

Screenshot
{F22518618}
2015-06-04 10:18:56 -08:00