From ca667ff183bcd48d3e9db3931ba53d16bca7a8a0 Mon Sep 17 00:00:00 2001
From: Travis CI
Date: Wed, 1 Apr 2015 16:00:11 +0000
Subject: [PATCH] update website
---
docs/geolocation.html | 3 +-
docs/listview.html | 90 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/docs/geolocation.html b/docs/geolocation.html
index fed69fe25d1..12d0edf2fff 100644
--- a/docs/geolocation.html
+++ b/docs/geolocation.html
@@ -3,7 +3,8 @@ You need to add NSLocationWhenInUseUsageDescription key
in Info.plist to enable geolocation, otherwise it's going
to fail silently!
!/ !/
+'use strict';
var React = require('react-native');
diff --git a/docs/listview.html b/docs/listview.html
index f7247c8ef98..8a55bcf10ad 100644
--- a/docs/listview.html
+++ b/docs/listview.html
@@ -50,7 +50,95 @@ behavior means that it will scroll with the content at the top of the
section until it reaches the top of the screen, at which point it will
stick to the top until it is pushed off the screen by the next section
header.
'use strict';
+
+var React = require('react-native');
+var {
+ Image,
+ ListView,
+ TouchableHighlight,
+ StyleSheet,
+ Text,
+ View,
+} = React;
+
+var UIExplorerPage = require('./UIExplorerPage');
+
+var ListViewSimpleExample = React.createClass({
+ statics: {
+ title: '<ListView> - Simple',
+ description: 'Performant, scrollable list of data.'
+ },
+
+ getInitialState: function() {
+ var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
+ return {
+ dataSource: ds.cloneWithRows(this._genRows({})),
+ };
+ },
+
+ _pressData: ({}: {[key: number]: boolean}),
+
+ componentWillMount: function() {
+ this._pressData = {};
+ },
+
+ render: function() {
+ return (
+ <UIExplorerPage
+ title={this.props.navigator ? null : '<ListView> - Simple'}
+ noSpacer={true}
+ noScroll={true}>
+ <ListView
+ dataSource={this.state.dataSource}
+ renderRow={this._renderRow}
+ />
+ </UIExplorerPage>
+ );
+ },
+
+ _renderRow: function(rowData: string, sectionID: number, rowID: number) {
+ var rowHash = Math.abs(hashCode(rowData));
+ var imgSource = {
+ uri: THUMB_URLS[rowHash % THUMB_URLS.length],
+ };
+ return (
+ <TouchableHighlight onPress={() => this._pressRow(rowID)}>
+ <View>
+ <View style={styles.row}>
+ <Image style={styles.thumb} source={imgSource} />
+ <Text style={styles.text}>
+ {rowData + ' - ' + LOREM_IPSUM.substr(0, rowHash % 301 + 10)}
+ </Text>
+ </View>
+ <View style={styles.separator} />
+ </View>
+ </TouchableHighlight>
+ );
+ },
+
+ _genRows: function(pressData: {[key: number]: boolean}): Array<string> {
+ var dataBlob = [];
+ for (var ii = 0; ii < 100; ii++) {
+ var pressedText = pressData[ii] ? ' (pressed)' : '';
+ dataBlob.push('Row ' + ii + pressedText);
+ }
+ return dataBlob;
+ },
+
+ _pressRow: function(rowID: number) {
+ this._pressData[rowID] = !this._pressData[rowID];
+ this.setState({dataSource: this.state.dataSource.cloneWithRows(
+ this._genRows(this._pressData)
+ )});
+ },
+});
+
+var THUMB_URLS = ['https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851549_767334479959628_274486868_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851579_767334503292959_179092627_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851589_767334513292958_1747022277_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851563_767334559959620_1193692107_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851593_767334566626286_1953955109_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851591_767334523292957_797560749_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851567_767334529959623_843148472_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851548_767334489959627_794462220_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851575_767334539959622_441598241_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851573_767334549959621_534583464_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851583_767334573292952_1519550680_n.png'];
+var LOREM_IPSUM = 'Lorem ipsum dolor sit amet, ius ad pertinax oportere accommodare, an vix civibus corrumpit referrentur. Te nam case ludus inciderint, te mea facilisi adipiscing. Sea id integre luptatum. In tota sale consequuntur nec. Erat ocurreret mei ei. Eu paulo sapientem vulputate est, vel an accusam intellegam interesset. Nam eu stet pericula reprimique, ea vim illud modus, putant invidunt reprehendunt ne qui.';
+
+
+var hashCode = function(str) {
var hash = 15;
for (var ii = str.length - 1; ii >= 0; ii--) {
hash = ((hash << 5) - hash) + str.charCodeAt(ii);