File tree Expand file tree Collapse file tree 5 files changed +52
-15
lines changed
Expand file tree Collapse file tree 5 files changed +52
-15
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react-native'
2+ import styles from './ButtonStyles'
3+
4+ // TODO :: Extend styles via receiving prop
5+
6+ class Button extends React . Component {
7+ _onPress ( ) {
8+ this . props . onPress ( )
9+ }
10+ render ( ) {
11+ return (
12+ < React . TouchableHighlight
13+ style = { styles . container }
14+ onPress = { this . _onPress . bind ( this ) } >
15+ < React . Text style = { styles . text } > { this . props . text } </ React . Text >
16+ </ React . TouchableHighlight >
17+ )
18+ }
19+ }
20+ Button . propTypes = {
21+ text : React . PropTypes . string . isRequired ,
22+ onPress : React . PropTypes . func . isRequired ,
23+ }
24+
25+ export default Button
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ import { StyleSheet } from 'react-native'
4+
5+
6+ export default StyleSheet . create ( {
7+ container : {
8+ marginTop : 20 ,
9+ backgroundColor : "#CCC" ,
10+ paddingTop : 10 ,
11+ paddingBottom : 10 ,
12+ borderRadius : 40 ,
13+ padding : 40 ,
14+ alignSelf : 'center' ,
15+ } ,
16+ text : {
17+
18+ } ,
19+ } )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " Button" ,
3+ "private" : true ,
4+ "main" : " ./Button.js"
5+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import styles from './HomeStyles'
99import SpotifyStore from '../../stores/SpotifyStore'
1010import SpotifyActions from '../../actions/SpotifyActions'
1111import ArtistList from '../../components/ArtistList'
12+ import Button from '../../components/Button'
1213
1314
1415export default class Home extends ViewBase {
@@ -81,12 +82,8 @@ export default class Home extends ViewBase {
8182 < ArtistList
8283 artists = { this . state . relatedArtists }
8384 onTapCreatePlaylist = { this . _createPlaylist . bind ( this ) }
84- />
85- < React . TouchableHighlight
86- style = { styles . createPlaylistButton }
87- onPress = { this . _discoverArtists . bind ( this ) } >
88- < React . Text style = { styles . loginButtonText } > Create Playlist</ React . Text >
89- </ React . TouchableHighlight >
85+ />
86+ < Button text = "Create Playlist" onPress = { this . _createPlaylist } > </ Button >
9087 </ React . View >
9188 )
9289 }
Original file line number Diff line number Diff line change @@ -18,13 +18,4 @@ export default StyleSheet.create({
1818 alignSelf : 'center' ,
1919 fontSize : 20 ,
2020 } ,
21- createPlaylistButton : {
22- marginTop : 20 ,
23- backgroundColor : "#CCC" ,
24- paddingTop : 10 ,
25- paddingBottom : 10 ,
26- borderRadius : 40 ,
27- padding : 40 ,
28- alignSelf : 'center' ,
29- } ,
3021} )
You can’t perform that action at this time.
0 commit comments