This repository has been archived by the owner on Jun 28, 2019. It is now read-only.
forked from magicismight/react-native-lazyload
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds eslint and fixes some of the issues with --fix option. (#6)
* Add eslint and run eslint --fix. * 2.0.2
- Loading branch information
Showing
15 changed files
with
1,987 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": [ | ||
"@aller/eslint-config-aller" | ||
], | ||
"rules": { | ||
"react/jsx-filename-extension": 0, | ||
"no-underscore-dangle": 0, | ||
"no-use-before-define": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
import React, { | ||
Component | ||
Component, | ||
} from 'react'; | ||
|
||
import { | ||
StyleSheet, | ||
Text, | ||
View, | ||
TouchableHighlight | ||
StyleSheet, | ||
Text, | ||
View, | ||
TouchableHighlight, | ||
} from 'react-native'; | ||
|
||
import { | ||
LazyloadScrollView, | ||
LazyloadImage | ||
LazyloadScrollView, | ||
LazyloadImage, | ||
} from 'react-native-lazyload'; | ||
|
||
let image = require('./image.jpg'); | ||
const image = require('./image.jpg'); | ||
|
||
class LazyloadImageExample extends Component { | ||
render() { | ||
return ( | ||
<LazyloadScrollView | ||
style={styles.container} | ||
contentContainerStyle={styles.content} | ||
name="scrollImage" | ||
> | ||
{Array.apply(null, Array(100)).map((file, i) => <View | ||
key={i} | ||
> | ||
<LazyloadImage | ||
host="scrollImage" | ||
style={styles.image} | ||
source={image} | ||
animation={false} | ||
/> | ||
</View>)} | ||
</LazyloadScrollView> | ||
); | ||
} | ||
render() { | ||
return ( | ||
<LazyloadScrollView | ||
style={styles.container} | ||
contentContainerStyle={styles.content} | ||
name="scrollImage" | ||
> | ||
{Array(...Array(100)).map((file, i) => (<View | ||
key={i} | ||
> | ||
<LazyloadImage | ||
host="scrollImage" | ||
style={styles.image} | ||
source={image} | ||
animation={false} | ||
/> | ||
</View>))} | ||
</LazyloadScrollView> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#F5FCFF' | ||
}, | ||
content: { | ||
paddingTop: 20, | ||
justifyContent: 'center', | ||
alignItems: 'center' | ||
}, | ||
image: { | ||
width: 200, | ||
height: 80, | ||
borderWidth: StyleSheet.hairlineWidth, | ||
borderColor: '#ccc', | ||
marginHorizontal: 5, | ||
marginVertical: 10, | ||
borderRadius: 10, | ||
overflow: 'hidden', | ||
resizeMode: 'cover', | ||
backgroundColor: '#eee' | ||
} | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
content: { | ||
paddingTop: 20, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
image: { | ||
width: 200, | ||
height: 80, | ||
borderWidth: StyleSheet.hairlineWidth, | ||
borderColor: '#ccc', | ||
marginHorizontal: 5, | ||
marginVertical: 10, | ||
borderRadius: 10, | ||
overflow: 'hidden', | ||
resizeMode: 'cover', | ||
backgroundColor: '#eee', | ||
}, | ||
}); | ||
|
||
export default LazyloadImageExample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,137 +1,138 @@ | ||
import React, { | ||
Component | ||
Component, | ||
} from 'react'; | ||
|
||
import { | ||
AppRegistry, | ||
StyleSheet, | ||
Text, | ||
View, | ||
ListView | ||
AppRegistry, | ||
StyleSheet, | ||
Text, | ||
View, | ||
ListView, | ||
} from 'react-native'; | ||
|
||
import { | ||
LazyloadListView, | ||
LazyloadView | ||
LazyloadListView, | ||
LazyloadView, | ||
} from 'react-native-lazyload'; | ||
|
||
import data from './MOCK_DATA.json'; | ||
|
||
class LazyloadListExample extends Component { | ||
constructor() { | ||
super(...arguments); | ||
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | ||
this.state = { | ||
dataSource: ds.cloneWithRows(data) | ||
}; | ||
} | ||
constructor() { | ||
super(...arguments); | ||
const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); | ||
this.state = { | ||
dataSource: ds.cloneWithRows(data), | ||
}; | ||
} | ||
|
||
renderRow = (file) => { | ||
return <View | ||
style={styles.view} | ||
return (<View | ||
style={styles.view} | ||
> | ||
<LazyloadView | ||
host="listExample" | ||
style={styles.file} | ||
> | ||
<LazyloadView | ||
host="listExample" | ||
style={styles.file} | ||
> | ||
<View style={styles.id}> | ||
<Text style={styles.idText}>{file.id}</Text> | ||
</View> | ||
<View style={styles.detail}> | ||
<Text style={styles.name}>{file.first_name} {file.last_name}</Text> | ||
<Text><Text style={styles.title}>email: </Text><Text style={styles.email}>{file.email}</Text></Text> | ||
<Text style={styles.ip}><Text style={styles.title}>last visit ip: </Text>{file.ip_address}</Text> | ||
</View> | ||
<View style={styles.gender}> | ||
<Text style={[styles.genderText, file.gender === 'Male' ? styles.male : styles.female]}>{file.gender}</Text> | ||
</View> | ||
</LazyloadView> | ||
</View>; | ||
<View style={styles.id}> | ||
<Text style={styles.idText}>{file.id}</Text> | ||
</View> | ||
<View style={styles.detail}> | ||
<Text style={styles.name}>{file.first_name} {file.last_name}</Text> | ||
<Text><Text style={styles.title}>email: </Text><Text style={styles.email}>{file.email}</Text></Text> | ||
<Text style={styles.ip}><Text style={styles.title}>last visit ip: </Text>{file.ip_address}</Text> | ||
</View> | ||
<View style={styles.gender}> | ||
<Text style={[styles.genderText, file.gender === 'Male' ? styles.male : styles.female]}>{file.gender}</Text> | ||
</View> | ||
</LazyloadView> | ||
</View>); | ||
}; | ||
|
||
render() { | ||
return <LazyloadListView | ||
style={styles.container} | ||
contentContainerStyle={styles.content} | ||
name="listExample" | ||
dataSource={this.state.dataSource} | ||
renderRow={this.renderRow} | ||
scrollRenderAheadDistance={200} | ||
renderDistance={100} | ||
pageSize={1} | ||
initialListSize={10} | ||
/>; | ||
return (<LazyloadListView | ||
style={styles.container} | ||
contentContainerStyle={styles.content} | ||
name="listExample" | ||
dataSource={this.state.dataSource} | ||
renderRow={this.renderRow} | ||
scrollRenderAheadDistance={200} | ||
renderDistance={100} | ||
pageSize={1} | ||
initialListSize={10} | ||
/>); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#F5FCFF' | ||
}, | ||
content: { | ||
paddingTop: 20, | ||
justifyContent: 'center', | ||
alignItems: 'center' | ||
}, | ||
view: { | ||
height: 70, | ||
width: 320, | ||
paddingVertical: 5, | ||
borderBottomWidth: StyleSheet.hairlineWidth, | ||
borderBottomColor: '#666' | ||
}, | ||
file: { | ||
width: 320, | ||
flex: 1, | ||
flexDirection: 'row' | ||
}, | ||
id: { | ||
width: 50, | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}, | ||
idText: { | ||
fontSize: 10 | ||
}, | ||
detail: { | ||
justifyContent: 'space-around', | ||
flex: 1 | ||
}, | ||
name: { | ||
textAlign: 'center', | ||
lineHeight: 15, | ||
color: '#666', | ||
marginBottom: 5 | ||
}, | ||
email: { | ||
fontSize: 10, | ||
color: 'blue', | ||
textDecorationColor: 'blue', | ||
textDecorationLine: 'underline', | ||
textDecorationStyle: 'solid' | ||
}, | ||
ip: { | ||
fontSize: 12, | ||
color: 'grey' | ||
}, | ||
gender: { | ||
width: 50, | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}, | ||
genderText: { | ||
fontSize: 10 | ||
}, | ||
title: { | ||
color: '#333', | ||
fontSize: 12 | ||
}, | ||
male: { | ||
color: 'skyblue' | ||
}, | ||
female: { | ||
color: 'pink' | ||
} | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
content: { | ||
paddingTop: 20, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
view: { | ||
height: 70, | ||
width: 320, | ||
paddingVertical: 5, | ||
borderBottomWidth: StyleSheet.hairlineWidth, | ||
borderBottomColor: '#666', | ||
}, | ||
file: { | ||
width: 320, | ||
flex: 1, | ||
flexDirection: 'row', | ||
}, | ||
id: { | ||
width: 50, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
idText: { | ||
fontSize: 10, | ||
}, | ||
detail: { | ||
justifyContent: 'space-around', | ||
flex: 1, | ||
}, | ||
name: { | ||
textAlign: 'center', | ||
lineHeight: 15, | ||
color: '#666', | ||
marginBottom: 5, | ||
}, | ||
email: { | ||
fontSize: 10, | ||
color: 'blue', | ||
textDecorationColor: 'blue', | ||
textDecorationLine: 'underline', | ||
textDecorationStyle: 'solid', | ||
}, | ||
ip: { | ||
fontSize: 12, | ||
color: 'grey', | ||
}, | ||
gender: { | ||
width: 50, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
genderText: { | ||
fontSize: 10, | ||
}, | ||
title: { | ||
color: '#333', | ||
fontSize: 12, | ||
}, | ||
male: { | ||
color: 'skyblue', | ||
}, | ||
female: { | ||
color: 'pink', | ||
}, | ||
}); | ||
|
||
export default LazyloadListExample; |
Oops, something went wrong.