Update from Friday March 27

- [React Native] Sync from github | Amjad Masad
- [react-packager] Watch asset roots for changes to update dependency graph | Amjad Masad
- Fix sourceTree of RCTActionSheet.xcodeproj | Alex Kotliarskyi
- Cancel contents animation before setting new contents in RCTNetworkImageView | Alex Akers
- [react-packager] move dependencies to root package.json | Amjad Masad
- Fix font crash on iOS < 8.2 | Nick Lockwood
- [react-packager] Fix node v0.11.14 query parse bug | Amjad Masad
- [ReactNative][Docs] Remove references to ReactNavigator from docs | Tadeu Zagallo
- [CLI] react-native start won't run from dir with spaces | Amjad Masad
- Revert .buckversion bumps. | Jakub Zika
- [react_native] Update default bundle name to org.reactjs.native.* | Krzysztof Magiera
- [react-packager] better error when main file not found | Amjad Masad
- [React Kit] Remove embarrassing TODOs | Alex Akers
- [ReactNative][MAdMan] Clean up after D1942269 | Philipp von Weitershausen
- flowify a few more Libraries | Basil Hosmer
- [ReactNative] PushNotificationIOS documentation | Eric Vicenti
- [ReactNative][CustomComponents] Update old headers | Tadeu Zagallo
- [ReactNative] UIViewControllerBasedStatusBarAppearance = NO in SampleApp | Alex Kotliarskyi
- [React Native] Fix CocoaPods spec | Alex Akers
- [ReactNative] Navigator Example Overhaul | Eric Vicenti
- [React Native] Fix incorrect if-statement in RCTGeolocation | Alex Akers
- [ReactNative] s/ReactKit/React/g | Tadeu Zagallo
- [React Native] [FRC - Don't accept] View border support | Nick Lockwood
- [Assets] Allow scripts to override assetRoots | Amjad Masad
- [ReactNative] Navigator docs | Eric Vicenti
- [ReactNative] License headers and renaming | Eric Vicenti
- [React Native] Add CocoaPods spec | Tadeu Zagallo
- Added explicit types for all view properties | Nick Lockwood
- [ReactNative] s/ReactNavigator/Navigator/ | Tadeu Zagallo
- [ReactNative] Add copyright header for code copied from the jQuery UI project | Martin Konicek
- [ReactNative] PanResponder documentation | Eric Vicenti
- [ReactNative] Add deep linking api | Tadeu Zagallo
- [ReactNative] Add gitignore example for SampleApp | Alex Kotliarskyi
- [ReactNative] Add react-native-start bin to react-native packge | Alex Kotliarskyi
- [ReactNative] Update package.json to be npm-ready | Christopher Chedeau
- [RFC][ReactNative] Integrate dev menu directly into RootView | Alex Kotliarskyi
- flowify Libraries/ReactIOS | Marshall Roch
- [WIP] Added support for italics and additional font weights | Nick Lockwood
- [ReactNative] Improve View documentation | Christopher Chedeau
- [react-packager] Readme | Amjad Masad
- Fix for incorrect contentSize reported by RCTScrollView | Nick Lockwood
- [ReactNative] Flow and doc formatting for NetInfo | Eric Vicenti
- [ReactNative] Document AppStateIOS | Eric Vicenti
- [MAdMan][Android] Make things look more Androidy | Philipp von Weitershausen
- flowified Libraries from Avik | Basil Hosmer
- flowify some Libraries | Basil Hosmer
- [ReactKit] Add shake development menu | Alex Kotliarskyi
- [ReactNative] Add debugger and change SampleApp files structure | Alex Kotliarskyi
- Flowify ReactIOSEventEmitter | Marshall Roch
- [react_native] JS files from D1941151: Allow fontWeight to be 100,200,...,900 | Krzysztof Magiera
- [ReactNative] Add snapshot tests for examples | Spencer Ahrens
- [ReactNative] bring back some native modules | Spencer Ahrens
- [ReactNative] Rename JSNavigationStack to ReactNavigator, rename scene config | Eric Vicenti
- [ReactNative] cleanup view example | Spencer Ahrens
- Flowify a bunch of Libraries | Marshall Roch
- [ReactNative] JSNavigationStack - Use key to blow away old scenes | Eric Vicenti
- [ReactNative] Add more logging to RCTJSONParse | Sumeet Vaidya
- Unfork UIManager | Nick Lockwood
- [react-packager] kill non-standard RAW_SOURCE_MAP | Amjad Masad
- Flowify Libraries/StyleSheet and Libraries/Text | Marshall Roch
- [ReactNative] Fix OSS Dependency Issues | Eric Vicenti
- [react-packager] Fix more issues with node modules | Amjad Masad
- [ReactNative] rename navigationOperations to navigator | Eric Vicenti
- JS files from D1936817: Add to XMLHttpRequest android and share code with ios | Olivia Bishop
- flowify some Libraries | Basil Hosmer
- last batch of UIExplorer flowification | Basil Hosmer
- [ReactNative] JSNavigationStack rename routeMapper to renderSceneForRoute | Eric Vicenti
- Flowify renderApplication | Marshall Roch
- [ReactNative] OSS Responder example | Eric Vicenti
- [ReactNative] Use oss TimerMixin | Tadeu Zagallo
- [ReactNative] Remove auto permission request from setAppIconBadgeNumber | Tadeu Zagallo
- [ReactNative] OSS snapshot tests | Spencer Ahrens
- [ReactNative] OSS JSNavigationStack w/ Examples | Eric Vicenti
- Fix build - remove relative import path | Jakub Zika
- Bump .buckversion to a5b8b8ef45d714018ba3542cf98d48ef6aab7088. | Jakub Zika
- [ReactNative] Open Source PushNotifications and move Badge Number methods and permission into it | Tadeu Zagallo
- [react-packager] Fix regression with transform errors | Amjad Masad
- Flowify TextStylePropTypes and fix a bug with unsupported props | Marshall Roch
- [ReactNative] Remove `arc build` instructions from require | Alex Kotliarskyi
- Flowify Library/Utilities/ | Marshall Roch
- [react-packager] Default to index.js from main if it's a dir | Amjad Masad
- [ReactNative] Use deprecated ix in TabBarExample | Amjad Masad
- [ReactNative] Expanded license on obj-c files | Christopher Chedeau
- [ReactNative] Expanded license on js files | Christopher Chedeau
- [ReactNative] Fix React Devtools integration | Alex Kotliarskyi
- [Text] Account for font leading so descenders are not clipped | Alex Kotliarskyi
- [ReactNative] Expanded license on js packager files | Christopher Chedeau
- more UIExplorer flow | Basil Hosmer
- [react-packager] Pick up package changes while running | Amjad Masad
- Added a graph view and a ReactNative metric that displays current queue and execution time for the JS thread. | Bryce Redd
- [ReactNative] Add NativeModules and DeviceEventEmitter to react-native exports | Alex Kotliarskyi
- [React Native] Fix iOS 7 crashes b/c missing Photos.fmwk | Alex Akers
- UIExplorer flowification | Basil Hosmer
- Add clearImmediate module | Marshall Roch
- [ReactNative] Print directories packager is serving files from | Alex Kotliarskyi
- Work around flow bug with exports | Marshall Roch
- [ReactNative] Move packager/init.sh to GitHub | Alex Kotliarskyi
- [ReactNative] Remove react-native/package.json | Christopher Chedeau
- [ReactNative] Returning actual contentSize for RCTScrollViewManager | Henry Lung
- declare timeoutID | Basil Hosmer
- [ReactNative] Add root package.json name back | Tadeu Zagallo
- [react-packager] Allow entry point extensions like .ios.js | Amjad Masad
- [react-native] Use SpreadProperty to make react-docgen happy | Felix Kling
- clean Examples/2048 | Basil Hosmer
- [ReactNative] Adjust packager default root when running from within node_modules | Alex Kotliarskyi
- [ReactNative] Add missing websocket dependency | Alex Kotliarskyi
- [react-packager] change all but one `ix` to `require` | Amjad Masad
- [react-packager] Make sure projectRoots is converted to an array | Amjad Masad
- [ReactNative] Init script that bootstraps new Xcode project | Alex Kotliarskyi
- [ReactNative] New SampleApp | Alex Kotliarskyi
- [ReactNative] Touchable invoke press on longPress when longPress handler missing | Eric Vicenti
- [ReactNative] Commit missing RCTWebSocketDebugger.xcodeproj | Alex Kotliarskyi
This commit is contained in:
Amjad Masad
2015-03-27 11:46:17 -07:00
parent 3b7bd7401e
commit 31c4ff0dd6
37 changed files with 749 additions and 671 deletions

View File

@@ -11,14 +11,18 @@
*/
'use strict';
var POPAnimation = require('POPAnimation');
var POPAnimationOrNull = require('POPAnimation');
if (!POPAnimation) {
if (!POPAnimationOrNull) {
// POP animation isn't available in the OSS fork - this is a temporary
// workaround to enable its availability to be determined at runtime.
module.exports = (null : ?{});
} else {
// At this point, POPAnimationOrNull is guaranteed to be
// non-null. Bring it local to preserve type refinement.
var POPAnimation = POPAnimationOrNull;
var invariant = require('invariant');
var warning = require('warning');

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule POPAnimation
* @flow
*/
'use strict';
@@ -14,7 +15,7 @@ var RCTPOPAnimationManager = require('NativeModules').POPAnimationManager;
if (!RCTPOPAnimationManager) {
// POP animation isn't available in the OSS fork - this is a temporary
// workaround to enable its availability to be determined at runtime.
module.exports = null;
module.exports = (null: ?Object);
} else {
var ReactPropTypes = require('ReactPropTypes');
@@ -64,6 +65,20 @@ var Types = {
spring: RCTTypes.spring,
};
type Attrs = {
type?: $Enum<typeof Types>;
property?: $Enum<typeof Properties>;
fromValue?: any;
toValue?: any;
duration?: any;
velocity?: any;
deceleration?: any;
springBounciness?: any;
dynamicsFriction?: any;
dynamicsMass?: any;
dynamicsTension?: any;
}
var POPAnimation = {
Types: Types,
Properties: Properties,
@@ -83,11 +98,11 @@ var POPAnimation = {
}),
lastUsedTag: 0,
allocateTagForAnimation: function() {
allocateTagForAnimation: function(): number {
return ++this.lastUsedTag;
},
createAnimation: function(typeName, attrs) {
createAnimation: function(typeName: number, attrs: Attrs): number {
var tag = this.allocateTagForAnimation();
if (__DEV__) {
@@ -107,35 +122,35 @@ var POPAnimation = {
return tag;
},
createSpringAnimation: function(attrs) {
createSpringAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.spring, attrs);
},
createDecayAnimation: function(attrs) {
createDecayAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.decay, attrs);
},
createLinearAnimation: function(attrs) {
createLinearAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.linear, attrs);
},
createEaseInAnimation: function(attrs) {
createEaseInAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.easeIn, attrs);
},
createEaseOutAnimation: function(attrs) {
createEaseOutAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.easeOut, attrs);
},
createEaseInEaseOutAnimation: function(attrs) {
createEaseInEaseOutAnimation: function(attrs: Attrs): number {
return this.createAnimation(this.Types.easeInEaseOut, attrs);
},
addAnimation: function(nodeHandle, anim, callback) {
addAnimation: function(nodeHandle: any, anim: number, callback: Function) {
RCTPOPAnimationManager.addAnimation(nodeHandle, anim, callback);
},
removeAnimation: function(nodeHandle, anim) {
removeAnimation: function(nodeHandle: any, anim: number) {
RCTPOPAnimationManager.removeAnimation(nodeHandle, anim);
},
};

View File

@@ -95,20 +95,20 @@ var styles = StyleSheet.create({
});
/**
* Use `ReactNavigator` to transition between different scenes in your app. To
* Use `Navigator` to transition between different scenes in your app. To
* accomplish this, provide route objects to the navigator to identify each
* scene, and also a `renderScene` function that the navigator can use to
* render the scene for a given route.
*
* To change the animation or gesture properties of the scene, provide a
* `configureScene` prop to get the config object for a given route. See
* `ReactNavigator.SceneConfigs` for default animations and more info on
* `Navigator.SceneConfigs` for default animations and more info on
* scene config options.
*
* ### Basic Usage
*
* ```
* <ReactNavigator
* <Navigator
* initialRoute={{name: 'My First Scene', index: 0}}
* renderScene={(route, navigator) =>
* <MySceneComponent
@@ -132,7 +132,7 @@ var styles = StyleSheet.create({
*
* ### Navigation Methods
*
* `ReactNavigator` can be told to navigate in two ways. If you have a ref to
* `Navigator` can be told to navigate in two ways. If you have a ref to
* the element, you can invoke several methods on it to trigger navigation:
*
* - `jumpBack()` - Jump backward without unmounting the current scene
@@ -174,7 +174,7 @@ var Navigator = React.createClass({
* configuration object
*
* ```
* (route) => ReactNavigator.SceneConfigs.FloatFromRight
* (route) => Navigator.SceneConfigs.FloatFromRight
* ```
*/
configureScene: PropTypes.func,
@@ -230,7 +230,7 @@ var Navigator = React.createClass({
navigationBar: PropTypes.node,
/**
* Optionally provide the navigator object from a parent ReactNavigator
* Optionally provide the navigator object from a parent Navigator
*/
navigator: PropTypes.object,
@@ -316,7 +316,7 @@ var Navigator = React.createClass({
parentNavigator: this.props.navigator,
// We want to bubble focused routes to the top navigation stack. If we
// are a child navigator, this allows us to call props.navigator.on*Focus
// of the topmost ReactNavigator
// of the topmost Navigator
onWillFocus: this.props.onWillFocus,
onDidFocus: this.props.onDidFocus,
};

View File

@@ -37,7 +37,8 @@ var Geolocation = {
getCurrentPosition: function(
geo_success: Function,
geo_error?: Function,
geo_options?: Object) {
geo_options?: Object
) {
invariant(
typeof geo_success === 'function',
'Must provide a valid geo_success callback.'

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Image
* @flow
*/
'use strict';
@@ -106,7 +107,9 @@ var Image = React.createClass({
render: function() {
var style = flattenStyle([styles.base, this.props.style]);
invariant(style, "style must be initialized");
var source = this.props.source;
invariant(source, "source must be initialized");
var isNetwork = source.uri && source.uri.match(/^https?:/);
invariant(
!(isNetwork && source.isStatic),

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ImageResizeMode
* @flow
*/
'use strict';

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ImageStylePropTypes
* @flow
*/
'use strict';
@@ -39,8 +40,8 @@ var unsupportedProps = Object.keys({
paddingHorizontal: null,
});
for (var key in unsupportedProps) {
delete ImageStylePropTypes[key];
for (var i = 0; i < unsupportedProps.length; i++) {
delete ImageStylePropTypes[unsupportedProps[i]];
}
module.exports = ImageStylePropTypes;

View File

@@ -75,6 +75,7 @@
} else {
_downloadToken = [_imageDownloader downloadImageForURL:imageURL size:self.bounds.size scale:RCTScreenScale() block:^(UIImage *image, NSError *error) {
if (image) {
[self.layer removeAnimationForKey:@"contents"];
self.layer.contentsScale = image.scale;
self.layer.contents = (__bridge id)image.CGImage;
}

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule InteractionManager
* @flow
*/
'use strict';
@@ -70,7 +71,7 @@ var InteractionManager = {
/**
* Schedule a function to run after all interactions have completed.
*/
runAfterInteractions(callback) {
runAfterInteractions(callback: Function) {
invariant(
typeof callback === 'function',
'Must specify a function to schedule.'
@@ -82,7 +83,7 @@ var InteractionManager = {
/**
* Notify manager that an interaction has started.
*/
createInteractionHandle() {
createInteractionHandle(): number {
scheduleUpdate();
var handle = ++_inc;
_addInteractionSet.add(handle);
@@ -92,7 +93,7 @@ var InteractionManager = {
/**
* Notify manager that an interaction has completed.
*/
clearInteractionHandle(handle) {
clearInteractionHandle(handle: number) {
invariant(
!!handle,
'Must provide a handle to clear.'

View File

@@ -2,6 +2,7 @@
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule InteractionMixin
* @flow
*/
'use strict';
@@ -21,7 +22,7 @@ var InteractionMixin = {
}
},
_interactionMixinHandles: [],
_interactionMixinHandles: ([]: Array<number>),
createInteractionHandle: function() {
var handle = InteractionManager.createInteractionHandle();
@@ -29,7 +30,7 @@ var InteractionMixin = {
return handle;
},
clearInteractionHandle: function(clearHandle) {
clearInteractionHandle: function(clearHandle: number) {
InteractionManager.clearInteractionHandle(clearHandle);
this._interactionMixinHandles = this._interactionMixinHandles.filter(
handle => handle !== clearHandle
@@ -41,7 +42,7 @@ var InteractionMixin = {
*
* @param {function} callback
*/
runAfterInteractions: function(callback) {
runAfterInteractions: function(callback: Function) {
InteractionManager.runAfterInteractions(callback);
},
};

View File

@@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ExceptionsManager
* @flow
*/
'use strict';
@@ -18,7 +19,13 @@ var parseErrorStack = require('parseErrorStack');
var sourceMapPromise;
function handleException(e) {
type Exception = {
sourceURL: string;
line: number;
message: string;
}
function handleException(e: Exception) {
var stack = parseErrorStack(e);
console.error(
'Error: ' +

View File

@@ -21,74 +21,8 @@ var _initialURL = RCTLinkingManager &&
var DEVICE_NOTIF_EVENT = 'openURL';
/**
* `LinkingIOS` gives you an interface to interact with both incoming and
* outgoing app links.
*
* ### Basic Usage
*
* #### Handling deep links
*
* If your app was launched from an external URL registered with your app, you can
* access and handle it from any component you want with the following:
*
* ```
* componentDidMount() {
* var url = LinkingIOS.popInitialURL();
* if (url) { ... }
* }
* ```
*
* If you also want to listen to incoming app links during your app's
* execution you'll need to add the following lines to you `*AppDelegate.m`:
*
* ```
* - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
* return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
* }
* ```
*
* And in your React component, you'll then be able to listen to the events from
* `LinkingIOS` as follows
*
* ```
* componentDidMount() {
* LinkingIOS.addEventListener('url', this._handleOpenURL);
* },
* componentWillUnmount() {
* LinkingIOS.removeEventListener('url', this._handleOpenURL);
* },
* _handleOpenURL(event) {
* console.log(event.url);
* }
* ```
*
* #### Triggering App links
*
* To trigger an app link (browser, email, or custom schemes) you can call:
*
* ```
* LinkingIOS.openURL(url)
* ```
*
* If you want to check if a URL can be opened by an installed app on the system you can call
*
* ```
* LinkingIOS.canOpenURL(url, (supported) => {
* if (!supported) {
* AlertIOS.alert('Can\'t handle url: ' + url);
* } else {
* LinkingIOS.openURL(url);
* }
* });
* ```
*/
class LinkingIOS {
/**
* Add a handler to LinkingIOS changes by listening to the `url` event type
* and providing the handler
*/
static addEventListener(type: string, handler: Function) {
static addEventListener(type, handler) {
invariant(
type === 'url',
'LinkingIOS only supports `url` events'
@@ -101,10 +35,7 @@ class LinkingIOS {
);
}
/**
* Remove a handler by passing the `url` event type and the handler
*/
static removeEventListener(type: string, handler: Function ) {
static removeEventListener(type, handler) {
invariant(
type === 'url',
'LinkingIOS only supports `url` events'
@@ -116,12 +47,7 @@ class LinkingIOS {
_notifHandlers[handler] = null;
}
/**
* Try to open the given `url` with any of the installed apps.
* If multiple applications can open `url`, the one that opens
* is undefined.
*/
static openURL(url: string) {
static openURL(url) {
invariant(
typeof url === 'string',
'Invalid url: should be a string'
@@ -129,11 +55,7 @@ class LinkingIOS {
RCTLinkingManager.openURL(url);
}
/**
* Determine whether an installed app can handle a given `url`.
* The callback function will be called with `bool supported` as the only argument
*/
static canOpenURL(url: string, callback: Function) {
static canOpenURL(url, callback) {
invariant(
typeof url === 'string',
'Invalid url: should be a string'
@@ -145,11 +67,7 @@ class LinkingIOS {
RCTLinkingManager.canOpenURL(url, callback);
}
/**
* If the app launch was triggered by an app link, it will pop the link URL,
* otherwise it will return `null`
*/
static popInitialURL(): ?string {
static popInitialURL() {
var initialURL = _initialURL;
_initialURL = null;
return initialURL;

View File

@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
#import "../../React/Base/RCTBridgeModule.h"
@interface RCTLinkingManager : NSObject <RCTBridgeModule>

View File

@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
#import "../../React/Base/RCTBridgeModule.h"
@interface RCTPushNotificationManager : NSObject <RCTBridgeModule>