-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
150 additions
and
33 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
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,89 @@ | ||
import React, { PropTypes } from 'react'; | ||
import { | ||
Text, | ||
Image, | ||
StyleSheet, | ||
} from 'react-native'; | ||
import Swiper from 'react-native-swiper' | ||
|
||
const defaultProps = { | ||
data: [{ | ||
img: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/6T4KJZ8W9M.jpg' }, | ||
text: 'Hello Swiper', | ||
textPosition: 'bottomLeft', | ||
textColor: '#fff', | ||
}, { | ||
img: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/OERP9XI9YB.jpg' }, | ||
text: 'Hello Swiper', | ||
}, { | ||
img: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/1U68PK9DJ0.jpg' }, | ||
text: 'Hello Swiper', | ||
textPosition: 'topRight', | ||
textColor: '#fff', | ||
}], | ||
}; | ||
|
||
const propTypes = { | ||
data: PropTypes.array | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
height: 200, | ||
}, | ||
slide: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
text: { | ||
color: '#fff', | ||
fontSize: 25, | ||
fontWeight: 'bold' | ||
}, | ||
topLeft: { | ||
padding: 30, | ||
justifyContent: 'flex-start', | ||
alignItems: 'flex-start', | ||
}, | ||
topRight: { | ||
padding: 30, | ||
justifyContent: 'flex-start', | ||
alignItems: 'flex-end', | ||
}, | ||
bottomLeft: { | ||
padding: 30, | ||
justifyContent: 'flex-end', | ||
alignItems: 'flex-start', | ||
}, | ||
bottomRight: { | ||
padding: 30, | ||
justifyContent: 'flex-end', | ||
alignItems: 'flex-end', | ||
}, | ||
}); | ||
|
||
const Banner = (props) => { | ||
return ( | ||
<Swiper style={styles.wrapper} height={250} horizontal autoplay> | ||
<Image style={[styles.slide, styles.bottomLeft]} source={{ uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/6T4KJZ8W9M.jpg' }}> | ||
<Text style={[styles.text]}>Hello Swiper</Text> | ||
</Image> | ||
<Image style={styles.slide} source={{ uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/OERP9XI9YB.jpg' }}> | ||
<Text style={styles.text}>And simple</Text> | ||
</Image> | ||
<Image style={[styles.slide, styles.topRight]} source={{ uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/1U68PK9DJ0.jpg' }}> | ||
<Text style={styles.text}>Beautiful</Text> | ||
</Image> | ||
</Swiper> | ||
); | ||
}; | ||
|
||
|
||
Banner.propTypes = propTypes; | ||
Banner.defaultProps = defaultProps; | ||
|
||
export default Banner; |
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,53 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
import { | ||
StyleSheet, | ||
Text, | ||
View, | ||
TouchableOpacity | ||
} from 'react-native'; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
welcome: { | ||
fontSize: 20, | ||
textAlign: 'center', | ||
margin: 10, | ||
}, | ||
instructions: { | ||
textAlign: 'center', | ||
color: '#333333', | ||
marginBottom: 5, | ||
}, | ||
}); | ||
|
||
export default class Home extends Component { | ||
static propTypes = { | ||
navigate: PropTypes.func.isRequired | ||
}; | ||
|
||
toCounter = () => { | ||
const { navigate } = this.props; | ||
navigate({ | ||
type: 'push', | ||
key: 'counter' | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.welcome}> | ||
Welcome to React Native Boilerplate! | ||
</Text> | ||
<TouchableOpacity onPress={this.toCounter}> | ||
<Text style={styles.instructions}>Navigate to Counter</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
} | ||
} |
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
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