99 PropTypes,
1010 ActivityIndicatorIOS,
1111 ProgressBarAndroid,
12+ TouchableNativeFeedback,
1213 Platform
1314} = React ;
1415var StyleSheetPropType = require ( 'react-native/Libraries/StyleSheet/StyleSheetPropType' ) ;
1516var TextStylePropTypes = require ( 'react-native/Libraries/Text/TextStylePropTypes' ) ;
1617
1718var Button = React . createClass ( {
1819 propTypes : Object . assign ( { } ,
19- TouchableOpacity . propTypes ,
2020 { textStyle : StyleSheetPropType ( TextStylePropTypes ) ,
2121 children : PropTypes . string . isRequired ,
2222 isLoading : PropTypes . bool ,
2323 isDisabled : PropTypes . bool ,
24- activityIndicatorColor : PropTypes . string } ,
24+ activityIndicatorColor : PropTypes . string ,
25+ onPress : PropTypes . func ,
26+ onLongPress : PropTypes . func ,
27+ onPressIn : PropTypes . func ,
28+ onPressOut : PropTypes . func } ,
2529 ) ,
2630
2731 _renderInnerText : function ( ) {
@@ -42,6 +46,7 @@ var Button = React.createClass({
4246 height : 20 ,
4347 } , styles . spinner ] }
4448 styleAttr = 'Inverse'
49+ color = { this . props . activityIndicatorColor || 'black' }
4550 />
4651 ) ;
4752 }
@@ -54,27 +59,37 @@ var Button = React.createClass({
5459 } ,
5560
5661 render : function ( ) {
57- // Extract TouchableOpacity props
62+ // Extract Touchable props
5863 var touchableProps = {
5964 onPress : this . props . onPress ,
6065 onPressIn : this . props . onPressIn ,
6166 onPressOut : this . props . onPressOut ,
6267 onLongPress : this . props . onLongPress
6368 } ;
64-
6569 if ( this . props . isDisabled === true || this . props . isLoading === true ) {
6670 return (
6771 < View style = { [ styles . button , this . props . style , styles . opacity ] } >
6872 { this . _renderInnerText ( ) }
6973 </ View >
7074 ) ;
7175 } else {
72- return (
73- < TouchableOpacity { ...touchableProps }
74- style = { [ styles . button , this . props . style ] } >
75- { this . _renderInnerText ( ) }
76- </ TouchableOpacity >
77- ) ;
76+ if ( Platform . OS !== 'android' ) {
77+ return (
78+ < TouchableOpacity { ...touchableProps }
79+ style = { [ styles . button , this . props . style ] } >
80+ { this . _renderInnerText ( ) }
81+ </ TouchableOpacity >
82+ ) ;
83+ } else {
84+ return (
85+ < TouchableNativeFeedback { ...touchableProps }
86+ background = { TouchableNativeFeedback . Ripple ( ) } >
87+ < Text style = { [ styles . button , this . props . style ] } >
88+ { this . _renderInnerText ( ) }
89+ </ Text >
90+ </ TouchableNativeFeedback >
91+ ) ;
92+ }
7893 }
7994 }
8095} ) ;
0 commit comments