Commit Graph

1938 Commits

Author SHA1 Message Date
Philipp von Weitershausen 4bfeeaa90d [ReactNative] Improve Flow definitions and code comments in XHR FormData polyfill 2015-07-29 20:03:57 -08:00
Zack Gomez 60c8abcc70 Revert "[ReactNative] revert "prevent ScrollView content offset from changing during layout"" 2015-07-29 17:23:18 -08:00
Hedger Wang 4b16e4d550 [Navigator]: Add a method `keyOf` to NavigationRouteStack.
Summary:
# Summary

Add a method `keyOf` to NavigationRouteStack.

The method `keyOf` returns a key that is associated with the route.
The a route is added to a stack, the stack creats an unique key for it and
will keep the key for the route until the route is rmeoved from the stack.

The stack also passes the keys to its derived stack (the new stack created by the
mutation API such as `push`, `pop`...etc).

The key for the route persists until the initial stack and its derived stack no longer
contains this route.

# Why Do We Need This?

Navigator has needs to use an unique key to manage the scenes rendered.
The problem is that `route` itself isn't a very reliable thing to be used as the key.

Consider this example:

```
// `scene_1` animates into the viewport.
navigator.push('scene_1');

setTimeout(() => {
 // `scene_1` animates off the viewport.
 navigator.pop();
}, 100);

setTimeout(() => {
 // Should we bring in a new scene or bring back the one that was previously popped?
 navigator.push('scene_1');
}, 200);

```

Because we currently use `route` itself as a key for the scene, we'd have to block a route
until its scene is completely off the components tree even the route itself is no longer
in the stack otherwise we'd see strange animation of jumping scenes.

# What's Next

We're hoping that we can build pure reactive view for NavigationRouteStack easily.
The naive implementation of  NavigationRouteStackView may look like this:

```
class NavigationRouteStackView {
  constructor() {
    this.state = {
      staleScenes: {},
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.stack !== this.props.stack) {
      var stale;
      var staleScenes = {...this.state.staleScenes};
      this.props.stack.forEach((route, index, key) => {
        if (nextProps.stack.keyOf(route) !== key) {
          stale = true;
          staleScenes[key] = {route, index, key, stale};
        }
      });
      if (stale) {
        this.setState({
          staleScenes,
        });
      }
    }
  }

  render() {
    var scenes = [];

    this.props.stack.forEach((route, index, key) => {
      scenes.push({route, index, key});
    });

    Object.keys(this.state.staleScenes).forEach(key => {
      scenes.push(this.state.staleScenes[key]);
    });

    scenes.sort(stableSortByIndex);

    return <View>{scenes.map(renderScene)}</View>;
  }
}

```
2015-07-29 16:55:21 -08:00
Philipp von Weitershausen 37636fc59a [React Native] open source ImageEditingManager native module 2015-07-29 15:57:48 -08:00
Hedger Wang 809a2dc1d6 [Navigator: Prevent user from over-popping the routes.
Summary:
If user taps the back button quickly, the app crashes becuase "pop"
internally only checks `this.state.presentedIndex` which does not
always update when transtion happens.

This diff addresses this issue.
2015-07-29 11:42:34 -08:00
Jing Chen 8416691719 [events] Move start point of EventsDashboard to work with early boot 2015-07-29 10:47:13 -08:00
Pieter De Baets d6de865236 Cleanup AppRegistry types
Summary:
Found some missing/wrong types when playing around with the AppRegistry for routing work in the main app.
2015-07-29 09:55:24 -08:00
Dorota Kapturkiewicz e073fdc4c7 [ReactNative] add accessibilityComponentType 2015-07-29 09:20:23 -08:00
Felix Oghina dfa43f0ce5 [react_native] JS files from D2282690: make back button work in launcher app 2015-07-29 06:35:46 -08:00
Nick Lockwood 95b9dd3a88 Added support for method argument nullability
Summary:
This diff adds support for enforcing nullability in the arguments for exported methods.

We previously supported use of the nullable/nonnull attributes on method arguments, but didn't do anything to ensure that they were respected.

Now, if an argument is marked as nonnull, and a null value is sent for that argument, it will display a redbox.

In future, nonnull will be assumed by default, but for now we assume that un-annotated arguments can be null (to avoid breaking existing code).
2015-07-29 05:50:27 -08:00
Ben Alpert e0ea046092 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -08:00
Kevin Gozali 87ce2d635b [ReactNative] revert "prevent ScrollView content offset from changing during layout" 2015-07-28 19:39:56 -08:00
Kevin Gozali f1b22e87f1 [madman] version mobile configs disk caching 2015-07-28 18:11:34 -08:00
Tadeu Zagallo 127f7095dc [ReactNative] Add RCTBridgeDelegate
Summary:
Add a new bridge delegate protocol to allow a more flexible bridge configuration.

For now it just support the pre-existent configurations + providing the JavaScript
source to the bridge, that should allow pre-loading sources.
2015-07-28 15:57:02 -08:00
Zack Gomez 068f396c9b [ReactNative] prevent ScrollView content offset from changing during layout
Summary:
-[UIScrollView setFrame:] changes the content offset, which we want to do manually.  Preserve the old offset during layout.
2015-07-28 14:36:27 -08:00
Nick Lockwood b812b0ee2e Added unit tests for RCTModuleMethod parsing, and fixed some edge cases 2015-07-28 13:07:52 -08:00
Alex Kotliarskyi e964e741ef [RN] Add loading view for development mode
Summary:
It's very useful to know where the app is being loaded from and
can help debug various issues.
2015-07-28 11:17:06 -08:00
Alex Akers 7d19ff3dcb Add <Modal /> component
Summary:
Create Modal component that can be used to present content modally.
2015-07-28 07:21:50 -08:00
Tadeu Zagallo f53c95c743 [ReactNative] Proxy bundleURL on RCTBatchedBridge
Summary:
Fixes #2126

`RCTBatchedBridge` didn't implement `bundleURL`, that was available on the public
bridge interface, so it'd always be `nil`, and setting it would just be ignored.
2015-07-28 05:59:45 -08:00
Nick Lockwood 1d852624fd Refactored RCTImageDownloader to use RCTNetworking instead of a separate download system 2015-07-27 13:47:52 -08:00
Ben Alpert 3cff9be3d1 [ReactNative] Update project template .flowconfig 2015-07-27 13:41:55 -08:00
Bill Fisher 3b83853713 [ReactNative] fix onMoveShouldSetPanResponderCapture
Summary:
Typo in implementation prevented onMoveShouldSetPanResponderCapture from working.
2015-07-27 12:06:40 -08:00
Rui Chen 842ce51099 [Treehouse RN] Make smoothScrollTo works by not calling it twice 2015-07-27 11:25:28 -08:00
Alex Kotliarskyi 58a403d3c8 [ReactNative] Pin babel version
Summary:
Currently minor version babel updates add and remove transforms, but internal
version is checked in and pinned to 5.6.4. Until we figure out how to update
internal deps systematically, we need to make sure OSS edition of RN matches
internal, otherwise we get test failures due to package version mismatches.
2015-07-27 11:20:22 -08:00
Christopher Chedeau 18e6094cab [ReactNative] Add overflow to the whitelisted Image props
Summary:
For some reason we're now spamming the logs everytime we render an Image because overflow is not defined in the whitelist. overflow: 'hidden' is needed for network images with cover mode.

The way we currently define those is not optimal where we try to factor as many things as possible into distinct propTypes. However for Text we're not even using this but we are getting all the ones from View (which many do not apply) and remove some that aren't needed.

It may be useful to cleanup this in the future but in the short term, it's better to remove this warning that doesn't have much value anyway.
2015-07-27 11:06:27 -08:00
Martin Konicek 33e62f71f4 [ReactNative] CameraRoll docs
Summary:
In preparation for open sourcing React Native for Android, document which parts of the `CameraRoll` API are platform-specific.

Renders like this: http://imgur.com/rbpXHKf

We should improve docs generation for `@param`s.
2015-07-27 09:46:35 -08:00
Martin Konicek b7253dc604 [ReactNative] PixelRatio docs
Summary:
Update docs for `PixelRatio` in preparation for open sourcing React Native for Android.

See http://stackoverflow.com/questions/11581649/about-android-image-and-asset-sizes
2015-07-27 09:40:08 -08:00
Nick Lockwood 09bb761b25 Fixed RCTDownloadTaskWrapper crash on iOS7
Summary:
This is a quick fix for the RCTDownloadTaskWrapper crashing on iOS 7. The issue was that the object returned by -[NSURLSession downloadTaskWithURL:] on iOS was not actually a subclass of NSURLSessionTask, so the category that adds associated blocks was not working. I've fixed that by making it a category on NSObject instead.
2015-07-27 09:02:38 -08:00
Nick Lockwood 7996c32211 Unregistered modules will now only error when called, not on bridge init
Summary:
Occasionally people create RCTBridgeModule subclasses or base classes that are not intended to be accessed from JS, and so they don't export them. This was previously flagged as an error by the system. I've now downgraded this error to a warning at startup, and deferred the redbox error until the module is directly accessed by native or JS code.
2015-07-27 08:58:47 -08:00
Nick Lockwood 2c5290946b Converted RCTImageLoader to be a bridge module 2015-07-27 08:52:20 -08:00
Alex Akers d178e27939 Fix UIExplorer freezing / persistence 2015-07-27 08:35:34 -08:00
Nick Lockwood f9abb5aae2 Fixed missing redbox at startup
Summary:
Fixed bug where redbox errors thrown during startup would be dismissed as soon as JS loaded, so they would never be seen.
2015-07-27 07:23:08 -08:00
Nick Lockwood 0e5422f36c Fixed text highlight alignment when text has nonzero padding.
Summary:
Previously the text highlight overlay did not take padding into account in its positioning, so it would be misaligned for padded text. This fixes that.
2015-07-27 07:11:29 -08:00
Martin Konicek c3d194d1f8 [ReactNative] TextInput docs 2015-07-27 06:45:13 -08:00
Martin Konicek f69e33e6a8 [ReactNative] Text docs
Summary:
In preparation for open sourcing React Native for Android, document which Text props are platform-specific.
2015-07-27 06:38:27 -08:00
Nick Lockwood aca76c75dd Fix gzip on iOS 9 2015-07-27 01:18:40 -08:00
Spencer Ahrens f1bd1cbc94 [ReactNative] cleanup native components 2015-07-24 18:54:35 -08:00
James Ide 53222f0dda [Packager] Include Content-Type headers with bundle and source maps
Summary:
The packager did not send back the Content-Type headers. Adding these.

Closes https://github.com/facebook/react-native/pull/2029
Github Author: James Ide <ide@jameside.com>
2015-07-24 18:46:17 -08:00
Nick Lockwood 5f0317291b Switched to OSS <Text> implementation for internal apps 2015-07-24 17:30:43 -08:00
Hedger Wang ea5276ed24 [Navigator] Port navigation APIs from Navigator to NavigationContext 2015-07-24 17:10:41 -08:00
James Ide c8373d2ad6 [Chrome Debugger] Update ws dependency to 0.7.2
Summary:
ws 0.7.2 officially supports io.js

Closes https://github.com/facebook/react-native/pull/2013
Github Author: James Ide <ide@jameside.com>
2015-07-24 15:52:49 -08:00
James Ide bf7e2a85d0 [Navigator] Vertically hide disabled scenes and use pointerEvents="none"
Summary:
Hides disabled scenes using `top` instead of `left`, which fixes a bug with the native UITabBar. When the UITabBar's width is zeroed because the scene has `left: SCREEN_WIDTH, right: 0` applied, this triggers a bug with the kerning of the tab titles. Instead, zeroing the height by setting `top: SCREEN_HEIGHT` avoids the bug.

Also applies `pointerEvents="none"` to disabled scenes so that views in the off-screen scenes definitely don't receive touches, which was occurring before.

Fixes #1401, fixes #2011

Closes https://github.com/facebook/react-native/pull/2104
Github Author: James Ide <ide@jameside.com>
2015-07-24 14:45:19 -08:00
Martin Konicek d10e4dbf0f [ReactNative] Use ASCII double quotes
Summary:
We mix ASCII double quotes with left and right quotes: https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListView.js#L13

Let's be consistent.
2015-07-24 13:16:25 -08:00
Michael Mitchell a1612a7dd2 [ReactNative] Delete AnimationExperimental and AnimationUtils
Summary:
AnimationExperimental is deprecated and being removed in favor of the Animated library.
Refer to https://facebook.github.io/react-native/docs/animations.html for information on how to use Animated
and https://facebook.github.io/react-native/docs/animations.html#animationexperimental-deprecated for the reasoning behind this.
2015-07-24 10:29:44 -08:00
Matej Hamas 000ab1139f [ReactNative] Adding clear function to the react native TextInput component. 2015-07-24 09:46:01 -08:00
Nick Lockwood 81dd9c27ea Optimized property setting and conversion 2015-07-24 09:37:28 -08:00
Tadeu Zagallo 4499f28c1d [ReactNative] Remove wrong lock from RCTProfile
Summary:
Remove sad lock from RCTProfileForwardInvocation that was locking concurrent
calls and messing with the profiler.
2015-07-24 09:14:46 -08:00
Nick Lockwood ef5cec4f08 Text highlighting on iOS
Summary:
This diff implements highlighting of tapped text subranges for the iOS `<Text>` component, styled to match how iOS webkit views highlight links (translucent grey overlay with rounded corners).

Highlighting is enabled by default for any `<Text>` component which has an onPress handler. To disable the highlight, add `suppressHighlighting={true}` to the component props.
2015-07-24 08:41:58 -08:00
Martin Konicek 7c87952e43 [ReactNative] Image docs
Summary:
In preparation for open sourcing React Native for Android, document which Image props are platform-specific.
2015-07-24 06:21:49 -08:00
lh_wang 1b06e41c83 fix examaple TabBarIOSExample bug; show click num when user click second & third tabbar
Summary:
Closes https://github.com/facebook/react-native/pull/1522
Github Author: lh_wang <lh_wang@Ctrip.com>
2015-07-23 19:12:42 -08:00