Skip to content

Commit 41e3de6

Browse files
committed
Merge pull request facebook#180 from vjeux/update10
Updates from Mon 23 Mar
2 parents a738b49 + 82461e0 commit 41e3de6

File tree

33 files changed

+112
-96
lines changed

33 files changed

+112
-96
lines changed

Examples/Movies/MoviesApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
'use strict';
88

9-
var React = require('react-native/addons');
9+
var React = require('react-native');
1010
var {
1111
AppRegistry,
1212
NavigatorIOS,

Examples/UIExplorer/ActionSheetIOSExample.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
2-
* * Copyright 2004-present Facebook. All Rights Reserved.
3-
* */
2+
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
4+
*/
45
'use strict';
56

67
var React = require('react-native');
@@ -103,10 +104,10 @@ exports.description = 'Interface to show iOS\' action sheets';
103104
exports.examples = [
104105
{
105106
title: 'Show Action Sheet',
106-
render() { return <ActionSheetExample />; }
107+
render(): ReactElement { return <ActionSheetExample />; }
107108
},
108109
{
109110
title: 'Show Share Action Sheet',
110-
render() { return <ShareActionSheetExample />; }
111+
render(): ReactElement { return <ShareActionSheetExample />; }
111112
}
112113
];

Examples/UIExplorer/ActivityIndicatorExample.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

@@ -128,7 +129,7 @@ exports.examples = [
128129
},
129130
{
130131
title: 'Start/stop',
131-
render: function() {
132+
render: function(): ReactElement {
132133
return <ToggleAnimatingActivityIndicator />;
133134
}
134135
},

Examples/UIExplorer/AdSupportIOSExample.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

@@ -19,7 +20,7 @@ exports.description = 'Example of using the ad support API.';
1920
exports.examples = [
2021
{
2122
title: 'Ad Support IOS',
22-
render: function() {
23+
render: function(): ReactElement {
2324
return <AdSupportIOSExample />;
2425
},
2526
}

Examples/UIExplorer/AlertIOSExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

Examples/UIExplorer/AppStateExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

Examples/UIExplorer/AppStateIOSExample.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright 2004-present Facebook. All Rights Reserved.
33
*
44
* @providesModule AppStateIOSExample
5+
* @flow
56
*/
67
'use strict';
78

@@ -60,10 +61,10 @@ exports.examples = [
6061
{
6162
title: 'Subscribed AppStateIOS:',
6263
description: 'This changes according to the current state, so you can only ever see it rendered as "active"',
63-
render() { return <AppStateSubscription showCurrentOnly={true} />; }
64+
render(): ReactElement { return <AppStateSubscription showCurrentOnly={true} />; }
6465
},
6566
{
6667
title: 'Previous states:',
67-
render() { return <AppStateSubscription showCurrentOnly={false} />; }
68+
render(): ReactElement { return <AppStateSubscription showCurrentOnly={false} />; }
6869
},
6970
];

Examples/UIExplorer/AsyncStorageExample.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

@@ -98,6 +99,6 @@ exports.description = 'Asynchronous local disk storage.';
9899
exports.examples = [
99100
{
100101
title: 'Basics - getItem, setItem, removeItem',
101-
render() { return <BasicStorageExample />; }
102+
render(): ReactElement { return <BasicStorageExample />; }
102103
},
103104
];

Examples/UIExplorer/CameraRollExample.ios.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3+
* @flow
34
*/
45
'use strict';
56

@@ -108,6 +109,6 @@ exports.description = 'Example component that uses CameraRoll to list user\'s ph
108109
exports.examples = [
109110
{
110111
title: 'Photos',
111-
render() { return <CameraRollExample />; }
112+
render(): ReactElement { return <CameraRollExample />; }
112113
}
113114
];

Examples/UIExplorer/CameraRollView.ios.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright 2004-present Facebook. All Rights Reserved.
33
*
44
* @providesModule CameraRollView
5+
* @flow
56
*/
67
'use strict';
78

@@ -53,7 +54,7 @@ var propTypes = {
5354
var CameraRollView = React.createClass({
5455
propTypes: propTypes,
5556

56-
getDefaultProps: function() {
57+
getDefaultProps: function(): Object {
5758
return {
5859
groupTypes: 'SavedPhotos',
5960
batchSize: 5,
@@ -75,9 +76,9 @@ var CameraRollView = React.createClass({
7576
var ds = new ListView.DataSource({rowHasChanged: this._rowHasChanged});
7677

7778
return {
78-
assets: [],
79+
assets: ([]: Array<Image>),
7980
groupTypes: this.props.groupTypes,
80-
lastCursor: null,
81+
lastCursor: (null : ?string),
8182
noMore: false,
8283
loadingMore: false,
8384
dataSource: ds,
@@ -99,21 +100,21 @@ var CameraRollView = React.createClass({
99100
this.fetch();
100101
},
101102

102-
componentWillReceiveProps: function(nextProps) {
103+
componentWillReceiveProps: function(nextProps: {groupTypes?: string}) {
103104
if (this.props.groupTypes !== nextProps.groupTypes) {
104105
this.fetch(true);
105106
}
106107
},
107108

108-
_fetch: function(clear) {
109+
_fetch: function(clear?: boolean) {
109110
if (clear) {
110111
this.setState(this.getInitialState(), this.fetch);
111112
return;
112113
}
113114

114-
var fetchParams = {
115+
var fetchParams: Object = {
115116
first: this.props.batchSize,
116-
groupTypes: this.props.groupTypes,
117+
groupTypes: this.props.groupTypes
117118
};
118119
if (this.state.lastCursor) {
119120
fetchParams.after = this.state.lastCursor;
@@ -126,7 +127,7 @@ var CameraRollView = React.createClass({
126127
* Fetches more images from the camera roll. If clear is set to true, it will
127128
* set the component to its initial state and re-fetch the images.
128129
*/
129-
fetch: function(clear) {
130+
fetch: function(clear?: boolean) {
130131
if (!this.state.loadingMore) {
131132
this.setState({loadingMore: true}, () => { this._fetch(clear); });
132133
}
@@ -144,7 +145,7 @@ var CameraRollView = React.createClass({
144145
);
145146
},
146147

147-
_rowHasChanged: function(r1, r2) {
148+
_rowHasChanged: function(r1: Array<Image>, r2: Array<Image>): boolean {
148149
if (r1.length !== r2.length) {
149150
return true;
150151
}
@@ -166,7 +167,7 @@ var CameraRollView = React.createClass({
166167
},
167168

168169
// rowData is an array of images
169-
_renderRow: function(rowData, sectionID, rowID) {
170+
_renderRow: function(rowData: Array<Image>, sectionID: string, rowID: string) {
170171
var images = rowData.map((image) => {
171172
if (image === null) {
172173
return null;
@@ -181,9 +182,9 @@ var CameraRollView = React.createClass({
181182
);
182183
},
183184

184-
_appendAssets: function(data) {
185+
_appendAssets: function(data: Object) {
185186
var assets = data.edges;
186-
var newState = { loadingMore: false };
187+
var newState: Object = { loadingMore: false };
187188

188189
if (!data.page_info.has_next_page) {
189190
newState.noMore = true;

0 commit comments

Comments
 (0)