Skip to content

Commit

Permalink
Merge pull request facebook#180 from vjeux/update10
Browse files Browse the repository at this point in the history
Updates from Mon 23 Mar
  • Loading branch information
vjeux committed Mar 23, 2015
2 parents a738b49 + 82461e0 commit 41e3de6
Show file tree
Hide file tree
Showing 33 changed files with 112 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Examples/Movies/MoviesApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
'use strict';

var React = require('react-native/addons');
var React = require('react-native');
var {
AppRegistry,
NavigatorIOS,
Expand Down
9 changes: 5 additions & 4 deletions Examples/UIExplorer/ActionSheetIOSExample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* * Copyright 2004-present Facebook. All Rights Reserved.
* */
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

var React = require('react-native');
Expand Down Expand Up @@ -103,10 +104,10 @@ exports.description = 'Interface to show iOS\' action sheets';
exports.examples = [
{
title: 'Show Action Sheet',
render() { return <ActionSheetExample />; }
render(): ReactElement { return <ActionSheetExample />; }
},
{
title: 'Show Share Action Sheet',
render() { return <ShareActionSheetExample />; }
render(): ReactElement { return <ShareActionSheetExample />; }
}
];
3 changes: 2 additions & 1 deletion Examples/UIExplorer/ActivityIndicatorExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down Expand Up @@ -128,7 +129,7 @@ exports.examples = [
},
{
title: 'Start/stop',
render: function() {
render: function(): ReactElement {
return <ToggleAnimatingActivityIndicator />;
}
},
Expand Down
3 changes: 2 additions & 1 deletion Examples/UIExplorer/AdSupportIOSExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand All @@ -19,7 +20,7 @@ exports.description = 'Example of using the ad support API.';
exports.examples = [
{
title: 'Ad Support IOS',
render: function() {
render: function(): ReactElement {
return <AdSupportIOSExample />;
},
}
Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/AlertIOSExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/AppStateExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down
5 changes: 3 additions & 2 deletions Examples/UIExplorer/AppStateIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule AppStateIOSExample
* @flow
*/
'use strict';

Expand Down Expand Up @@ -60,10 +61,10 @@ exports.examples = [
{
title: 'Subscribed AppStateIOS:',
description: 'This changes according to the current state, so you can only ever see it rendered as "active"',
render() { return <AppStateSubscription showCurrentOnly={true} />; }
render(): ReactElement { return <AppStateSubscription showCurrentOnly={true} />; }
},
{
title: 'Previous states:',
render() { return <AppStateSubscription showCurrentOnly={false} />; }
render(): ReactElement { return <AppStateSubscription showCurrentOnly={false} />; }
},
];
3 changes: 2 additions & 1 deletion Examples/UIExplorer/AsyncStorageExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down Expand Up @@ -98,6 +99,6 @@ exports.description = 'Asynchronous local disk storage.';
exports.examples = [
{
title: 'Basics - getItem, setItem, removeItem',
render() { return <BasicStorageExample />; }
render(): ReactElement { return <BasicStorageExample />; }
},
];
3 changes: 2 additions & 1 deletion Examples/UIExplorer/CameraRollExample.ios.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down Expand Up @@ -108,6 +109,6 @@ exports.description = 'Example component that uses CameraRoll to list user\'s ph
exports.examples = [
{
title: 'Photos',
render() { return <CameraRollExample />; }
render(): ReactElement { return <CameraRollExample />; }
}
];
25 changes: 13 additions & 12 deletions Examples/UIExplorer/CameraRollView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule CameraRollView
* @flow
*/
'use strict';

Expand Down Expand Up @@ -53,7 +54,7 @@ var propTypes = {
var CameraRollView = React.createClass({
propTypes: propTypes,

getDefaultProps: function() {
getDefaultProps: function(): Object {
return {
groupTypes: 'SavedPhotos',
batchSize: 5,
Expand All @@ -75,9 +76,9 @@ var CameraRollView = React.createClass({
var ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged});

return {
assets: [],
assets: ([]: Array<Image>),
groupTypes: this.props.groupTypes,
lastCursor: null,
lastCursor: (null : ?string),
noMore: false,
loadingMore: false,
dataSource: ds,
Expand All @@ -99,21 +100,21 @@ var CameraRollView = React.createClass({
this.fetch();
},

componentWillReceiveProps: function(nextProps) {
componentWillReceiveProps: function(nextProps: {groupTypes?: string}) {
if (this.props.groupTypes !== nextProps.groupTypes) {
this.fetch(true);
}
},

_fetch: function(clear) {
_fetch: function(clear?: boolean) {
if (clear) {
this.setState(this.getInitialState(), this.fetch);
return;
}

var fetchParams = {
var fetchParams: Object = {
first: this.props.batchSize,
groupTypes: this.props.groupTypes,
groupTypes: this.props.groupTypes
};
if (this.state.lastCursor) {
fetchParams.after = this.state.lastCursor;
Expand All @@ -126,7 +127,7 @@ var CameraRollView = React.createClass({
* Fetches more images from the camera roll. If clear is set to true, it will
* set the component to its initial state and re-fetch the images.
*/
fetch: function(clear) {
fetch: function(clear?: boolean) {
if (!this.state.loadingMore) {
this.setState({loadingMore: true}, () => { this._fetch(clear); });
}
Expand All @@ -144,7 +145,7 @@ var CameraRollView = React.createClass({
);
},

_rowHasChanged: function(r1, r2) {
_rowHasChanged: function(r1: Array<Image>, r2: Array<Image>): boolean {
if (r1.length !== r2.length) {
return true;
}
Expand All @@ -166,7 +167,7 @@ var CameraRollView = React.createClass({
},

// rowData is an array of images
_renderRow: function(rowData, sectionID, rowID) {
_renderRow: function(rowData: Array<Image>, sectionID: string, rowID: string) {
var images = rowData.map((image) => {
if (image === null) {
return null;
Expand All @@ -181,9 +182,9 @@ var CameraRollView = React.createClass({
);
},

_appendAssets: function(data) {
_appendAssets: function(data: Object) {
var assets = data.edges;
var newState = { loadingMore: false };
var newState: Object = { loadingMore: false };

if (!data.page_info.has_next_page) {
newState.noMore = true;
Expand Down
3 changes: 2 additions & 1 deletion Examples/UIExplorer/DatePickerExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down Expand Up @@ -118,7 +119,7 @@ exports.description = 'Select dates and times using the native UIDatePicker.';
exports.examples = [
{
title: '<DatePickerIOS>',
render: function() {
render: function(): ReactElement {
return <DatePickerExample />;
},
}];
Expand Down
5 changes: 4 additions & 1 deletion Examples/UIExplorer/GeolocationExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
/* eslint no-console: 0 */
'use strict';
Expand All @@ -19,13 +20,15 @@ exports.description = 'Examples of using the Geolocation API.';
exports.examples = [
{
title: 'navigator.geolocation',
render: function() {
render: function(): ReactElement {
return <GeolocationExample />;
},
}
];

var GeolocationExample = React.createClass({
watchID: (null: ?number),

getInitialState: function() {
return {
initialPosition: 'unknown',
Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/LayoutExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down
9 changes: 6 additions & 3 deletions Examples/UIExplorer/ListViewSimpleExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
* @flow
*/
'use strict';

Expand Down Expand Up @@ -28,6 +29,8 @@ var ListViewSimpleExample = React.createClass({
};
},

_pressData: ({}: {[key: number]: boolean}),

componentWillMount: function() {
this._pressData = {};
},
Expand All @@ -46,7 +49,7 @@ var ListViewSimpleExample = React.createClass({
);
},

_renderRow: function(rowData, sectionID, rowID) {
_renderRow: function(rowData: string, sectionID: number, rowID: number) {
var rowHash = Math.abs(hashCode(rowData));
var imgSource = {
uri: THUMB_URLS[rowHash % THUMB_URLS.length],
Expand All @@ -66,7 +69,7 @@ var ListViewSimpleExample = React.createClass({
);
},

_genRows: function(pressData) {
_genRows: function(pressData: {[key: number]: boolean}): Array<string> {
var dataBlob = [];
for (var ii = 0; ii < 100; ii++) {
var pressedText = pressData[ii] ? ' (pressed)' : '';
Expand All @@ -75,7 +78,7 @@ var ListViewSimpleExample = React.createClass({
return dataBlob;
},

_pressRow: function(rowID) {
_pressRow: function(rowID: number) {
this._pressData[rowID] = !this._pressData[rowID];
this.setState({dataSource: this.state.dataSource.cloneWithRows(
this._genRows(this._pressData)
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/NavigatorIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
'use strict';

var React = require('react-native/addons');
var React = require('react-native');
var ViewExample = require('./ViewExample');
var {
PixelRatio,
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorerApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

var React = require('react-native/addons');
var React = require('react-native');
var UIExplorerList = require('./UIExplorerList');

var {
Expand Down
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
'use strict';

var React = require('react-native/addons');
var React = require('react-native');
var {
ListView,
PixelRatio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -186,7 +186,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
4 changes: 2 additions & 2 deletions Libraries/AdSupport/RCTAdSupport.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -196,7 +196,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../ReactKit/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -186,7 +186,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
Loading

0 comments on commit 41e3de6

Please sign in to comment.