Fix THUMBNAILS to follow the require Syntax

Summary:
The THUMB_URLS is following the older syntax.
Fixed THUMBNAILS to follows require Syntax. And now you see the thumbnails appearing in the Sample app.
Closes https://github.com/facebook/react-native/pull/4995

Reviewed By: svcscm

Differential Revision: D2796019

Pulled By: nicklockwood

fb-gh-sync-id: c7be50d4dea73fc383db1c6b5a6afa7444505889
This commit is contained in:
Satvik Jagannath 2015-12-30 14:49:13 -08:00 committed by facebook-github-bot-7
parent d7ad393f22
commit 596109fa0a
2 changed files with 29 additions and 31 deletions

View File

@ -26,18 +26,18 @@ var {
} = React;
var THUMB_URLS = [
'Thumbnails/like.png',
'Thumbnails/dislike.png',
'Thumbnails/call.png',
'Thumbnails/fist.png',
'Thumbnails/bandaged.png',
'Thumbnails/flowers.png',
'Thumbnails/heart.png',
'Thumbnails/liking.png',
'Thumbnails/party.png',
'Thumbnails/poke.png',
'Thumbnails/superlike.png',
'Thumbnails/victory.png',
require('./Thumbnails/like.png'),
require('./Thumbnails/dislike.png'),
require('./Thumbnails/call.png'),
require('./Thumbnails/fist.png'),
require('./Thumbnails/bandaged.png'),
require('./Thumbnails/flowers.png'),
require('./Thumbnails/heart.png'),
require('./Thumbnails/liking.png'),
require('./Thumbnails/party.png'),
require('./Thumbnails/poke.png'),
require('./Thumbnails/superlike.png'),
require('./Thumbnails/victory.png'),
];
var ListViewGridLayoutExample = React.createClass({
@ -74,9 +74,7 @@ var ListViewGridLayoutExample = React.createClass({
_renderRow: function(rowData: string, sectionID: number, rowID: number) {
var rowHash = Math.abs(hashCode(rowData));
var imgSource = {
uri: THUMB_URLS[rowHash % THUMB_URLS.length],
};
var imgSource = THUMB_URLS[rowHash % THUMB_URLS.length];
return (
<TouchableHighlight onPress={() => this._pressRow(rowID)} underlayColor="transparent">
<View>

View File

@ -34,19 +34,19 @@ var {
var PAGE_SIZE = 4;
var THUMB_URLS = [
'Thumbnails/like.png',
'Thumbnails/dislike.png',
'Thumbnails/call.png',
'Thumbnails/fist.png',
'Thumbnails/bandaged.png',
'Thumbnails/flowers.png',
'Thumbnails/heart.png',
'Thumbnails/liking.png',
'Thumbnails/party.png',
'Thumbnails/poke.png',
'Thumbnails/superlike.png',
'Thumbnails/victory.png',
];
require('./Thumbnails/like.png'),
require('./Thumbnails/dislike.png'),
require('./Thumbnails/call.png'),
require('./Thumbnails/fist.png'),
require('./Thumbnails/bandaged.png'),
require('./Thumbnails/flowers.png'),
require('./Thumbnails/heart.png'),
require('./Thumbnails/liking.png'),
require('./Thumbnails/party.png'),
require('./Thumbnails/poke.png'),
require('./Thumbnails/superlike.png'),
require('./Thumbnails/victory.png'),
];
var NUM_SECTIONS = 100;
var NUM_ROWS_PER_SECTION = 10;
@ -74,9 +74,9 @@ var Thumb = React.createClass({
<TouchableOpacity
onPress={this._onPressThumb}
style={[styles.buttonContents, {flexDirection: this.state.dir}]}>
<Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} />
<Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} />
<Image style={styles.img} source={{uri: THUMB_URLS[this.state.thumbIndex]}} />
<Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} />
<Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} />
<Image style={styles.img} source={THUMB_URLS[this.state.thumbIndex]} />
{this.state.dir === 'column' ?
<Text>
Oooo, look at this new text! So awesome it may just be crazy.