Commit Graph

1972 Commits

Author SHA1 Message Date
Olivier Notteghem e1f53c043c Restore SPY mode to sniff traffic across bridge 2015-07-09 09:23:27 -08:00
Tadeu Zagallo 1419941f8e [ReactNative] Log with `RCTPerformanceLogger` only once per bridge instance
Summary:
Fixes #1809

Even if a bridge has more than one root view, it's not supported by the js side
right now, and it will keep warning that those timespans had already been
recorded.
2015-07-09 07:35:16 -08:00
Spencer Ahrens fd2cb763df [ReactNative] add immutable dependency for NavigationRouteStack 2015-07-09 02:53:02 -08:00
Spencer Ahrens 04fe80b7a0 [ReactNative] Export Easing module so folks can use it 2015-07-09 02:44:13 -08:00
Spencer Ahrens 7d4b1877ae [RN] add Animated test for spring tracking 2015-07-09 01:59:49 -08:00
Krzysztof Magiera 9b162d7659 [ReactNative] Add support for onLayout View property. 2015-07-09 00:56:09 -08:00
Hedger Wang 21b98b23c9 [Navigator] Introducing NavigationRouteStack.
Summary:
Introducing the data structure NavigationRouteStack that focused on managing
navigation routes stack.

The goal is to make <Navigatior /> thinner by moving stack management logic into
its own class and make sure it's well-tested.

Teh next step will be cleaning up <Navigatior /> and add `NavigationRouteStack` to
`NavigationContext`.
2015-07-08 16:58:11 -08:00
Jarrod Mosen bb07817023 Update SegmentedControlIOSExample.js
Summary:
`event.nativeEvent` now uses `selectedSegmentIndex`, not `selectedIndex`.
Closes https://github.com/facebook/react-native/pull/1872
Github Author: Jarrod Mosen <jarrod.mosen@me.com>
2015-07-08 12:52:04 -08:00
Jani Evakallio b5c1cd7918 [Navigator] Guard `navigator.state.routeStack` from accidental mutation
Summary:
A minor improvement suggestion: `Navigator.getCurrentRoutes()` probably shouldn't return its `routeStack` backing array as-is, because the caller may mutate it, causing the internal state of the navigator to go out of sync. Instead a shallow copy of the routes should be returned.

I stumbled on this problem in my app by attempting to read the navigator state as follows:
```
let routes = Navigator.getCurrentRoutes();
let current = routes.pop();
let previous = routes.pop();
```

Which led to an exception at next navigation event.

CLA signed.

Closes https://github.com/facebook/react-native/pull/1888
Github Author: Jani Evakallio <jani.evakallio@gmail.com>
2015-07-08 12:49:52 -08:00
philipp.krone 4b5b952c32 Changing Error to Warning
Summary:
As discussed with @nicklockwood in the issue https://github.com/facebook/react-native/issues/1780, the error should be changed to a warning to not break fetch() to send a POST to a remote API without wanting to parse the reply. E.g. google sends back an empty 1x1px gif when POSTing something to google analytics.
Closes https://github.com/facebook/react-native/pull/1860
Github Author: "philipp.krone" <kronep@googlemail.com>
2015-07-08 09:36:13 -08:00
Alex Akers bfbc280fb4 [React Native] Fix scroll view sticky headers
Summary:
The `ScrollView` component tells the native side the subview indices of the views to make sticky. The problem is that, once layout-only views are collapsed, the indices are no longer reflective of the original views to make stick to the top.
2015-07-08 09:35:16 -08:00
Spencer Ahrens c66b1c64b5 [RN] quick fix to unblock OSS tests
Summary:
For some reason jest on github isn't checking invariants.
2015-07-08 07:46:41 -08:00
Nick Lockwood a886e4c66b Migrated RCTText into FBReactKit 2015-07-08 07:13:00 -08:00
Spencer Ahrens 0d0b4c947b [RN: Animated] Fix delay anims
Summary:
They weren't calling onEnd because of duration: 0 optimiziation.
2015-07-08 03:18:13 -08:00
James Ide b3e0a702a7 [ListView] Allow different types of ScrollView to be composed
Summary:
This enables code like:
```js
<ListView renderScrollView={() => <CustomScrollView />} />
```

where CustomScrollView might be inverted or support pull-to-refresh, etc.
Closes https://github.com/facebook/react-native/pull/785
Github Author: James Ide <ide@jameside.com>
2015-07-08 02:35:29 -08:00
Natansh Verma 98521eb16e Revert "[ReactNative] Fix RCTJavaScriptContext deallocation" 2015-07-07 23:37:07 -08:00
Natansh Verma f21e79d5e1 Revert "[ReactNative] Fix crash when reload during profile" 2015-07-07 23:37:07 -08:00
Tadeu Zagallo 0ffb2d36eb [ReactNative] Fix crash when reload during profile
Summary:
Fixes #1642

When reloading during profiling, the profile wouldn't unhook from the instance
being deallocated.
2015-07-07 18:31:17 -08:00
Tadeu Zagallo a251316a5f [ReactNative] Fix RCTJavaScriptContext deallocation
Summary:
The context wasn't being explicitly released before, since it'd be immediately
released. Now that the executors are bridge modules, it was only being deallocated
when the modules were released, what caused the threads to not be released at all.
2015-07-07 18:31:17 -08:00
Hedger Wang bb141e3a3c Rename prop "injectedJavascriptIOS" to "injectedJavaScript
Summary:
Android WebView now supports the prop "injectedJavaScript", too.
It's time to rename "injectedJavascriptIOS" to "injectedJavaScript" for API
consistency between IOS and Android.
2015-07-07 17:17:22 -08:00
Nick Lockwood 1b7699f671 Migrate unit tests from FBReactKitModules to FBReactKit 2015-07-07 16:39:35 -08:00
Jean Regisser 5c01b1e1a0 Fix incorrect lowercase response headers set for XHR responses
Summary:
Trivial change to fix the lowercase response headers set for XHR responses.

What would happen is the first iterated header wouldn't be part of `_lowerCaseResponseHeaders`.
Also it would mutate the original `responseHeaders` object, mixing lowercase headers with the original values.
Closes https://github.com/facebook/react-native/pull/1876
Github Author: Jean Regisser <jean.regisser@gmail.com>
2015-07-07 15:05:45 -08:00
Spencer Ahrens 566ca9e58d [ReactNative] fix duplicate LayoutAnimation warning 2015-07-07 14:15:04 -08:00
Spencer Ahrens b770310555 [ReactNative] Move Animated to Open Source
Summary:
Moves the files over and Exports Animated from 'react-native'.
2015-07-07 13:44:09 -08:00
Spencer Ahrens d56ff42596 [ReactNative] Animated infra - ValueXY, addListener, fixes, etc
Summary:
This is most of the infra necessary for the gratuitous animation demo app.

I originally had things more split up, but it was just confusing because everything is so interlinked and dependent, so lower diffs would have code that wasn't even going to survive (and thus not useful to review), so I merged it all here.

- `Animated.event` now supports mapping to multiple arguments (needed for `onPanResponderMove` events which provide the `gestureState` as the second arg.
- Vectors: new `Animated.ValueXY` class which composes two `Animated.Value`s for convenience/brevity
- Listeners: values and events can be listened to in order to trigger state updates based on their values.  Intended to work as async updates from native that might lag behind truth.
- Offsets: a common pattern with pan and other gestures is to track where you left off.  This is easily encoded in the Value directly with `setOffset(offset)`, typically used on grant, and can be flattened back into the base value and reset with `flattenOffset()`, typically called on release.
- Tracking: supports `Animated.Value/ValueXY` for `toValue` with all animations, enabling linking multiple values together with some curve or physics.  `Animated.timing` can be used with `duration: 0` to rigidly link the values with no lag, or `Animated.spring` can be used to link them like chat heads.
- `Animated.Image` as a default export.
- Various cleanup, bug, flow and lint fixes.
2015-07-07 13:44:07 -08:00
Alex Akers c928d9495b [React Native] Fix whitespace 2015-07-07 12:12:01 -08:00
Alex Akers 3c541ca540 [React Native] Update native error callback handling
Summary:
This introduces a new `RCTResponseErrorBlock` block type that allows a bridge module writer to call it with an `NSError` instance rather than a dictionary.
2015-07-07 08:54:05 -08:00
Martín Bigio 66d3f3c616 [rn] Keep native ListView child frames in sync on JS wrapper
Summary: At the moment the `ListView.js` `_childFrames` variable is only updated on scroll. As a consequence, `onChangeVisibleRows` won't get triggered for the initial render, nor any future render not trigered by scroll events. To fix this we need to make sure native and JS have the child frames in sync.
2015-07-07 07:40:56 -08:00
KJlmfe b57a14d07c <Text> module add textDecoration style attributes
Summary:
This is simply a rebased and squashed version of @KJlmfe's PR over at https://github.com/facebook/react-native/pull/845

It was actually already squashed into one commit, but for some reason that was hard to see from the original PR.
Closes https://github.com/facebook/react-native/pull/1869
Github Author: KJlmfe <kjlmfe@gmail.com>
2015-07-07 06:15:20 -08:00
Alexsander Akers 02db374e50 [React Native] Remove layout-only nodes (Take 2!)
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.
2015-07-07 05:06:50 -08:00
Param Aggarwal 0f2d8e662e [ScrollView] Pick data from older event on coalescing.
Summary:
The `ScrollView` sends important `updatedChildFrames` data to the `ListView` to be able to implement `onChangeVisibleRows` method. Coalescing operates very strongly on older devices like the iPhone 4s where this data is then lost.

Fixes #1782.

`ListView` has a method called `onChangeVisibleRows` that is called whenever the rows visible on screen change. This method is critical to be able to implement deletion/creation of views and hence be conservative in memory usage. I have an infinite scrolling view which uses this method to only render the full rows for what is visible on screen and put placeholders for everything else.

In the `RCTEventDispatcher`, we [coalesce events](522fd33d6f/React/Base/RCTEventDispatcher.m (L135-L152)) that are meant to be sent across the bridge. They are [dequeued](522fd33d6f/React/Base/RCTEventDispatcher.m (L180-L188)) on each
Closes https://github.com/facebook/react-native/pull/1783
Github Author: Param Aggarwal <paramaggarwal@gmail.com>
2015-07-06 17:27:40 -08:00
Eric Vicenti 65027e8e29 [ReactNative] Fix timeout edge-case in POPAnimation hack 2015-07-06 15:15:56 -08:00
Pieter De Baets 3955236b0f Update StaticContainer from static_upstream 2015-07-06 15:06:59 -08:00
Nick Lockwood 652ffa28b2 Added regenerator to node_modules 2015-07-06 14:08:06 -08:00
Alex Akers c065d98112 [React Native] Change `nil` to `Nil` because it's more correct
Summary: #OCD
2015-07-06 11:15:45 -08:00
Brent Vatne c045c566e9 Remove unnecessary imports for RCTHTTPRequestHandler to fix Cocoapods build
Summary:
@tadeuzagallo - We discussed this ~a week ago when I was putting together the 0.7.0-rc release, only got around to creating the PR for it now so it's properly sync'd.
Closes https://github.com/facebook/react-native/pull/1865
Github Author: Brent Vatne <brentvatne@gmail.com>
2015-07-06 10:12:43 -08:00
Alex Akers ca791dfe6f [React Native] Update RCTAdSupport
Summary:
No longer check for the `ASIdentifierManager` class. Since we only target iOS 7.0 and up, this is unnecessary. Instead, we should check for whether the `advertisingIdentifier` is non-nil. If it is, we send it; otherwise we send an error.
2015-07-06 09:44:51 -08:00
Pieter De Baets 7e70ee2e03 Check for RCTSettingsManager in Settings.ios 2015-07-06 04:47:04 -08:00
Alex Akers b4cd019f39 [React Native] Remove animated GIFs from TicTacToe example 2015-07-06 04:11:03 -08:00
James Ide f5ad9c2103 [Crashfix] Replace dispatch_get_current_queue with DISPATCH_CURRENT_QUEUE_LABEL
Summary:
I encountered a crash when `RCTCurrentThreadName` called `dispatch_get_current_queue`. There are reports of it crashing e.g. https://github.com/CocoaLumberjack/CocoaLumberjack/issues/108 so better not to call it at all, plus it is deprecated.

Since we still want helpful debugging information, use `DISPATCH_CURRENT_QUEUE_LABEL` instead. It's kind of strange that this constant is defined to be NULL and the docs for `dispatch_get_queue_label` say not to pass in NULL, but in practice `DISPATCH_CURRENT_QUEUE_LABEL` is provided by the iOS SDK and works correctly.

Closes https://github.com/facebook/react-native/pull/1868
Github Author: James Ide <ide@jameside.com>
2015-07-06 03:17:03 -08:00
Alex Akers aba148061f [React Native] Re-alphabetize file names in Xcode projects
Summary:
Fixes my OCD problems.
2015-07-06 01:57:06 -08:00
Alex Akers 93d3cc135d [React Native] Fix failing UIExplorer integration tests 2015-07-03 04:15:54 -08:00
Alex Akers 16cb41a24e [React Native] Fix padding in UIExplorer 2015-07-03 02:24:56 -08:00
Alex Akers 4fdeed0214 [React Native] Fix crash if current queue has no label
Summary:
If the current queue has no label, `dispatch_queue_get_label()` returns `NULL` and `@((char *)0)` will crash the app.

Closes facebook#1833
2015-07-03 02:24:30 -08:00
Alex Akers 88cfc1aaa6 [React Native] Fix navigation bar translucency 2015-07-03 02:12:28 -08:00
James Ide 3441847aa1 [Crashfix] Ensure that the image response is non-nil before caching it
Summary:
If you try to create a cached response from a nil response the app will crash. Looking at the code that uses NSURLSession and NSURLCache, this fix looks correct to me.

Fixes #1850

Closes https://github.com/facebook/react-native/pull/1852
Github Author: James Ide <ide@jameside.com>
2015-07-03 02:01:20 -08:00
Rui Chen 66e32dc406 [Treehouse RN] Sync for D2161376 2015-07-02 19:50:47 -08:00
Eric Vicenti 4e650f05d1 [ReactNative] setTimeout hack avoids POPAnimation race condition
Summary:
Having bugs in Groups because POPAnimation experiences a race condition. This hack avoids that for now while we transition away from POPAnimation altogether.
2015-07-02 10:51:48 -08:00
Alex Akers 00e85cbc85 [React Native] Persist open UIExplorer example between refreshes 2015-07-02 09:36:26 -08:00
Hedger Wang 54825b304a [WebView]: Kill `shouldInjectAJAXHandler`, and add `injectedJavascriptIOS`
Summary:
@public

The API and implementation of `shouldInjectAJAXHandler` is very opinionated, and it does not solve many of the use cases that we'd like to address.

Since  `shouldInjectAJAXHandler` is basically juts injecting JS to the web page, we should let developer inject whatever JS that address different issues that they want to fix.

Test Plan:
Test this snippet at <Playground />

```
<WebView
  url="http://www.facebook.com"
  injectedJavascriptIOS="document.body.style.border='solid 10px red'"
/>
```
2015-07-01 18:56:14 -08:00