Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 757d6d2

Browse files
committed
Merge pull request facebook#2136 from frantic/updates-2015-07-27
Updates 2015 07 27
2 parents a803e32 + 62b7920 commit 757d6d2

File tree

98 files changed

+1036
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1036
-1395
lines changed

.flowconfig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
# Ignore react-tools where there are overlaps, but don't ignore anything that
1111
# react-native relies on
12-
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
13-
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
14-
.*/node_modules/react-tools/src/browser/ui/React.js
15-
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
16-
.*/node_modules/react-tools/src/event/EventPropagators.js
12+
.*/node_modules/react-tools/src/React.js
13+
.*/node_modules/react-tools/src/renderers/shared/reconciler/ReactInstanceHandles.js
14+
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
15+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
16+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js
17+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js
18+
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
1719

1820
# Ignore commoner tests
1921
.*/node_modules/commoner/test/.*

Examples/2048/Game2048.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var {
2424
View,
2525
} = React;
2626

27-
var AnimationExperimental = require('AnimationExperimental');
27+
var Animated = require('Animated');
2828
var GameBoard = require('GameBoard');
2929
var TouchableBounce = require('TouchableBounce');
3030

@@ -53,58 +53,58 @@ class Board extends React.Component {
5353
}
5454

5555
class Tile extends React.Component {
56-
calculateOffset(): {top: number; left: number; opacity: number} {
56+
static _getPosition(index): number {
57+
return BOARD_PADDING + (index * (CELL_SIZE + CELL_MARGIN * 2) + CELL_MARGIN);
58+
}
59+
60+
constructor(props: {}) {
61+
super(props);
62+
5763
var tile = this.props.tile;
5864

59-
var pos = (i) => {
60-
return BOARD_PADDING + (i * (CELL_SIZE + CELL_MARGIN * 2) + CELL_MARGIN);
65+
this.state = {
66+
opacity: new Animated.Value(0),
67+
top: new Animated.Value(Tile._getPosition(tile.toRow())),
68+
left: new Animated.Value(Tile._getPosition(tile.toColumn())),
6169
};
70+
}
6271

63-
var animationPosition = (i) => {
64-
return pos(i) + (CELL_SIZE / 2);
65-
};
72+
calculateOffset(): {top: number; left: number; opacity: number} {
73+
var tile = this.props.tile;
6674

6775
var offset = {
68-
top: pos(tile.toRow()),
69-
left: pos(tile.toColumn()),
70-
opacity: 1,
76+
top: this.state.top,
77+
left: this.state.left,
78+
opacity: this.state.opacity,
7179
};
7280

7381
if (tile.isNew()) {
74-
offset.opacity = 0;
75-
} else {
76-
var point = {
77-
x: animationPosition(tile.toColumn()),
78-
y: animationPosition(tile.toRow()),
79-
};
80-
AnimationExperimental.startAnimation({
81-
node: this.refs['this'],
82+
Animated.timing(this.state.opacity, {
8283
duration: 100,
83-
easing: 'easeInOutQuad',
84-
property: 'position',
85-
toValue: point,
86-
});
84+
toValue: 1,
85+
}).start();
86+
} else {
87+
Animated.parallel([
88+
Animated.timing(offset.top, {
89+
duration: 100,
90+
toValue: Tile._getPosition(tile.toRow()),
91+
}),
92+
Animated.timing(offset.left, {
93+
duration: 100,
94+
toValue: Tile._getPosition(tile.toColumn()),
95+
}),
96+
]).start();
8797
}
8898
return offset;
8999
}
90100

91-
componentDidMount() {
92-
AnimationExperimental.startAnimation({
93-
node: this.refs['this'],
94-
duration: 100,
95-
easing: 'easeInOutQuad',
96-
property: 'opacity',
97-
toValue: 1,
98-
});
99-
}
100-
101101
render() {
102102
var tile = this.props.tile;
103103

104104
var tileStyles = [
105105
styles.tile,
106106
styles['tile' + tile.value],
107-
this.calculateOffset()
107+
this.calculateOffset(),
108108
];
109109

110110
var textStyles = [
@@ -115,9 +115,9 @@ class Tile extends React.Component {
115115
];
116116

117117
return (
118-
<View ref="this" style={tileStyles}>
118+
<Animated.View style={tileStyles}>
119119
<Text style={textStyles}>{tile.value}</Text>
120-
</View>
120+
</Animated.View>
121121
);
122122
}
123123
}

Examples/Movies/SearchScreen.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ var SearchScreen = React.createClass({
262262
) {
263263
return (
264264
<MovieCell
265+
key={movie.id}
265266
onSelect={() => this.selectMovie(movie)}
266267
onHighlight={() => highlightRowFunc(sectionID, rowID)}
267268
onUnhighlight={() => highlightRowFunc(null, null)}
@@ -307,7 +308,7 @@ var NoMovies = React.createClass({
307308
render: function() {
308309
var text = '';
309310
if (this.props.filter) {
310-
text = `No results for ${this.props.filter}`;
311+
text = `No results for "${this.props.filter}"`;
311312
} else if (!this.props.isLoading) {
312313
// If we're looking at the latest movies, aren't currently loading, and
313314
// still have no results, show a message

Examples/SampleApp/_flowconfig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99

1010
# Ignore react-tools where there are overlaps, but don't ignore anything that
1111
# react-native relies on
12-
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
13-
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
14-
.*/node_modules/react-tools/src/browser/ui/React.js
15-
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
16-
.*/node_modules/react-tools/src/event/EventPropagators.js
12+
.*/node_modules/react-tools/src/React.js
13+
.*/node_modules/react-tools/src/renderers/shared/reconciler/ReactInstanceHandles.js
14+
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
15+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
16+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js
17+
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js
18+
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
19+
1720

1821
# Ignore commoner tests
1922
.*/node_modules/commoner/test/.*

Examples/UIExplorer/StatusBarIOSExample.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ exports.examples = [{
8383
</View>
8484
);
8585
},
86+
}, {
87+
title: 'Status Bar Network Activity Indicator',
88+
render() {
89+
return (
90+
<View>
91+
<TouchableHighlight style={styles.wrapper}
92+
onPress={() => StatusBarIOS.setNetworkActivityIndicatorVisible(true)}>
93+
<View style={styles.button}>
94+
<Text>setNetworkActivityIndicatorVisible(true)</Text>
95+
</View>
96+
</TouchableHighlight>
97+
<TouchableHighlight style={styles.wrapper}
98+
onPress={() => StatusBarIOS.setNetworkActivityIndicatorVisible(false)}>
99+
<View style={styles.button}>
100+
<Text>setNetworkActivityIndicatorVisible(false)</Text>
101+
</View>
102+
</TouchableHighlight>
103+
</View>
104+
);
105+
},
86106
}];
87107

88108
var styles = StyleSheet.create({

Examples/UIExplorer/TabBarIOSExample.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ var TabBarExample = React.createClass({
3939
};
4040
},
4141

42-
_renderContent: function(color: string, pageText: string) {
42+
_renderContent: function(color: string, pageText: string, num?: number) {
4343
return (
4444
<View style={[styles.tabContent, {backgroundColor: color}]}>
4545
<Text style={styles.tabText}>{pageText}</Text>
46-
<Text style={styles.tabText}>{this.state.presses} re-renders of the More tab</Text>
46+
<Text style={styles.tabText}>{num} re-renders of the {pageText}</Text>
4747
</View>
4848
);
4949
},
5050

5151
render: function() {
5252
return (
5353
<TabBarIOS
54-
tintColor="black"
55-
barTintColor="#3abeff">
54+
tintColor="white"
55+
barTintColor="darkslateblue">
5656
<TabBarIOS.Item
5757
title="Blue Tab"
5858
selected={this.state.selectedTab === 'blueTab'}
@@ -73,7 +73,7 @@ var TabBarExample = React.createClass({
7373
notifCount: this.state.notifCount + 1,
7474
});
7575
}}>
76-
{this._renderContent('#783E33', 'Red Tab')}
76+
{this._renderContent('#783E33', 'Red Tab', this.state.notifCount)}
7777
</TabBarIOS.Item>
7878
<TabBarIOS.Item
7979
systemIcon="more"
@@ -84,7 +84,7 @@ var TabBarExample = React.createClass({
8484
presses: this.state.presses + 1
8585
});
8686
}}>
87-
{this._renderContent('#21551C', 'Green Tab')}
87+
{this._renderContent('#21551C', 'Green Tab', this.state.presses)}
8888
</TabBarIOS.Item>
8989
</TabBarIOS>
9090
);

Examples/UIExplorer/TextExample.ios.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ exports.examples = [
269269
right right right right right right right right right right right right right
270270
</Text>
271271
<Text style={{textAlign: 'justify'}}>
272-
justify: this text component's contents are laid out with "textAlign: justify"
272+
justify: this text component{"'"}s contents are laid out with "textAlign: justify"
273273
and as you can see all of the lines except the last one span the
274274
available width of the parent container.
275275
</Text>
@@ -369,6 +369,15 @@ exports.examples = [
369369
</View>
370370
);
371371
},
372+
}, {
373+
title: 'Text highlighting (tap the link to see highlight)',
374+
render: function() {
375+
return (
376+
<View>
377+
<Text>Lorem ipsum dolor sit amet, <Text suppressHighlighting={false} style={{backgroundColor: 'white', textDecorationLine: 'underline', color: 'blue'}} onPress={() => null}>consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud</Text> exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</Text>
378+
</View>
379+
);
380+
},
372381
}];
373382

374383
var styles = StyleSheet.create({

Examples/UIExplorer/TextInputExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ exports.examples = [
411411
style={styles.multiline}
412412
/>
413413
<TextInput
414-
placeholder="mutliline text input with font styles and placeholder"
414+
placeholder="multiline text input with font styles and placeholder"
415415
multiline={true}
416416
clearTextOnFocus={true}
417417
autoCorrect={true}
@@ -421,7 +421,7 @@ exports.examples = [
421421
style={[styles.multiline, styles.multilineWithFontStyles]}
422422
/>
423423
<TextInput
424-
placeholder="uneditable mutliline text input"
424+
placeholder="uneditable multiline text input"
425425
editable={false}
426426
multiline={true}
427427
style={styles.multiline}

Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,11 @@
10341034
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
10351035
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
10361036
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
1037+
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
10371038
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
10381039
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
10391040
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
1041+
GCC_WARN_SHADOW = YES;
10401042
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
10411043
GCC_WARN_UNDECLARED_SELECTOR = YES;
10421044
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
@@ -1089,9 +1091,11 @@
10891091
GCC_C_LANGUAGE_STANDARD = gnu99;
10901092
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
10911093
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
1094+
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
10921095
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
10931096
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
10941097
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
1098+
GCC_WARN_SHADOW = YES;
10951099
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
10961100
GCC_WARN_UNDECLARED_SELECTOR = YES;
10971101
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;

Examples/UIExplorer/UIExplorerList.ios.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,30 @@ class UIExplorerList extends React.Component {
121121
);
122122
}
123123

124-
componentWillMount() {
125-
this.props.navigator.navigationContext.addListener('didfocus', function(event) {
126-
if (event.data.route.title === 'UIExplorer') {
127-
Settings.set({visibleExample: null});
128-
}
129-
});
130-
}
131-
132124
componentDidMount() {
133-
var visibleExampleTitle = Settings.get('visibleExample');
134-
if (visibleExampleTitle) {
135-
var predicate = (example) => example.title === visibleExampleTitle;
136-
var foundExample = APIS.find(predicate) || COMPONENTS.find(predicate);
137-
if (foundExample) {
138-
setTimeout(() => this._openExample(foundExample), 100);
125+
var wasUIExplorer = false;
126+
var didOpenExample = false;
127+
128+
this.props.navigator.navigationContext.addListener('didfocus', (event) => {
129+
var isUIExplorer = event.data.route.title === 'UIExplorer';
130+
131+
if (!didOpenExample && isUIExplorer) {
132+
didOpenExample = true;
133+
134+
var visibleExampleTitle = Settings.get('visibleExample');
135+
if (visibleExampleTitle) {
136+
var predicate = (example) => example.title === visibleExampleTitle;
137+
var foundExample = APIS.find(predicate) || COMPONENTS.find(predicate);
138+
if (foundExample) {
139+
setTimeout(() => this._openExample(foundExample), 100);
140+
}
141+
} else if (!wasUIExplorer && isUIExplorer) {
142+
Settings.set({visibleExample: null});
143+
}
139144
}
140-
}
145+
146+
wasUIExplorer = isUIExplorer;
147+
});
141148
}
142149

143150
renderAdditionalView(renderRow: Function, renderTextInput: Function): React.Component {

Examples/UIExplorer/UIExplorerList.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,6 @@ class UIExplorerList extends React.Component {
166166

167167
componentDidMount() {
168168
this._search(this.state.searchText);
169-
170-
var visibleExampleTitle = Settings.get('visibleExample');
171-
if (visibleExampleTitle) {
172-
var predicate = (example) => example.title === visibleExampleTitle;
173-
var foundExample = APIS.find(predicate) || COMPONENTS.find(predicate);
174-
if (foundExample) {
175-
setTimeout(() => this._openExample(foundExample), 100);
176-
}
177-
}
178169
}
179170

180171
render() {

Examples/UIExplorer/createExamplePage.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
5454
};
5555
var result = example.render(null);
5656
if (result) {
57-
renderedComponent = result;
58-
result.props.navigator = this.props.navigator;
57+
renderedComponent = React.cloneElement(result, {
58+
navigator: this.props.navigator,
59+
});
5960
}
6061
(React: Object).render = originalRender;
6162
(React: Object).renderComponent = originalRenderComponent;

Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
152152
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
153153
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
154+
GCC_WARN_SHADOW = YES;
154155
GCC_WARN_UNDECLARED_SELECTOR = YES;
155156
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
156157
GCC_WARN_UNUSED_FUNCTION = YES;
@@ -190,6 +191,7 @@
190191
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
191192
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
192193
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
194+
GCC_WARN_SHADOW = YES;
193195
GCC_WARN_UNDECLARED_SELECTOR = YES;
194196
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
195197
GCC_WARN_UNUSED_FUNCTION = YES;

0 commit comments

Comments
 (0)