File tree Expand file tree Collapse file tree 3 files changed +58
-32
lines changed Expand file tree Collapse file tree 3 files changed +58
-32
lines changed Original file line number Diff line number Diff line change 1+ // @flow
2+
3+ import React from 'react'
4+ import { StyleSheet , Text } from 'react-native'
5+ import { Cell } from 'react-native-tableview-simple'
6+ import * as c from '../../components/colors'
7+
8+ const styles = StyleSheet . create ( {
9+ title : {
10+ textAlign : 'left' ,
11+ } ,
12+ active : {
13+ color : c . infoBlue ,
14+ } ,
15+ disabled : {
16+ color : c . iosDisabledText ,
17+ } ,
18+ } )
19+
20+ export function ButtonCell ( {
21+ indeterminate,
22+ disabled,
23+ onPress,
24+ title,
25+ } : {
26+ indeterminate ?: boolean ,
27+ disabled ?: boolean ,
28+ onPress : ( ) => any ,
29+ title : string ,
30+ } ) {
31+ return (
32+ < Cell
33+ titleTextStyle = { styles . title }
34+ isDisabled = { indeterminate || disabled }
35+ onPress = { onPress }
36+ title = {
37+ < Text
38+ style = { [
39+ styles . text ,
40+ indeterminate || disabled ? styles . disabled : styles . active ,
41+ ] }
42+ >
43+ { title }
44+ </ Text >
45+ }
46+ />
47+ )
48+ }
File renamed without changes.
Original file line number Diff line number Diff line change 11// @flow
2- import React from 'react'
3- import { StyleSheet , Text } from 'react-native'
4- import { Cell } from 'react-native-tableview-simple'
5- import * as c from '../../components/colors'
62
7- const styles = StyleSheet . create ( {
8- button : {
9- justifyContent : 'flex-start' ,
10- } ,
11- text : {
12- fontSize : 16 ,
13- } ,
14- active : {
15- color : c . infoBlue ,
16- } ,
17- disabled : {
18- color : c . iosDisabledText ,
19- } ,
20- } )
3+ import React from 'react'
4+ import { ButtonCell } from '../../components/cells/button'
215
226export function LoginButton ( {
237 loading,
@@ -32,22 +16,16 @@ export function LoginButton({
3216 onPress : ( ) => any ,
3317 label : string ,
3418} ) {
35- let loginTextStyle = loading || disabled ? styles . disabled : styles . active
36-
37- const contents = (
38- < Text style = { [ styles . text , loginTextStyle ] } >
39- { loading
40- ? `Logging in to ${ label } …`
41- : loggedIn ? `Sign Out of ${ label } ` : `Sign In to ${ label } ` }
42- </ Text >
43- )
44-
4519 return (
46- < Cell
47- contentContainerStyle = { styles . button }
48- isDisabled = { loading || disabled }
20+ < ButtonCell
21+ disabled = { loading || disabled }
22+ indeterminate = { loading }
4923 onPress = { onPress }
50- title = { contents }
24+ title = {
25+ loading
26+ ? `Logging in to ${ label } …`
27+ : loggedIn ? `Sign Out of ${ label } ` : `Sign In to ${ label } `
28+ }
5129 />
5230 )
5331}
You can’t perform that action at this time.
0 commit comments