@@ -10,8 +10,7 @@ const {
1010 TouchableOpacity,
1111 Text,
1212 StyleSheet,
13- ActivityIndicatorIOS,
14- ProgressBarAndroid,
13+ ActivityIndicator,
1514 TouchableNativeFeedback,
1615 Platform
1716} = require ( 'react-native' ) ;
@@ -42,29 +41,17 @@ const Button = React.createClass({
4241 isAndroid : ( Platform . OS === 'android' ) ,
4342 } ,
4443
45- _renderInnerTextAndroid : function ( ) {
46- if ( this . props . isLoading ) {
47- return (
48- < ProgressBarAndroid
49- style = { [ {
50- height : 20 ,
51- } , styles . spinner ] }
52- styleAttr = 'Inverse'
53- color = { this . props . activityIndicatorColor || 'black' }
54- />
55- ) ;
44+ shouldComponentUpdate : function ( nextProps , nextState ) {
45+ if ( ! isEqual ( nextProps , this . props ) ) {
46+ return true ;
5647 }
57- return (
58- < Text style = { [ styles . textButton , this . props . textStyle ] } >
59- { this . props . children }
60- </ Text >
61- ) ;
48+ return false ;
6249 } ,
6350
64- _renderInnerTextiOS : function ( ) {
51+ _renderInnerText : function ( ) {
6552 if ( this . props . isLoading ) {
6653 return (
67- < ActivityIndicatorIOS
54+ < ActivityIndicator
6855 animating = { true }
6956 size = 'small'
7057 style = { styles . spinner }
@@ -79,20 +66,6 @@ const Button = React.createClass({
7966 ) ;
8067 } ,
8168
82- shouldComponentUpdate : function ( nextProps , nextState ) {
83- if ( ! isEqual ( nextProps , this . props ) ) {
84- return true ;
85- }
86- return false ;
87- } ,
88-
89- _renderInnerText : function ( ) {
90- if ( Button . isAndroid ) {
91- return this . _renderInnerTextAndroid ( )
92- }
93- return this . _renderInnerTextiOS ( )
94- } ,
95-
9669 render : function ( ) {
9770 if ( this . props . isDisabled === true || this . props . isLoading === true ) {
9871 return (
@@ -119,15 +92,15 @@ const Button = React.createClass({
11992 return (
12093 < TouchableNativeFeedback { ...touchableProps } >
12194 < Text style = { [ styles . button , this . props . style ] } >
122- { this . _renderInnerTextAndroid ( ) }
95+ { this . _renderInnerText ( ) }
12396 </ Text >
12497 </ TouchableNativeFeedback >
12598 )
12699 } else {
127100 return (
128101 < TouchableOpacity { ...touchableProps }
129102 style = { [ styles . button , this . props . style ] } >
130- { this . _renderInnerTextiOS ( ) }
103+ { this . _renderInnerText ( ) }
131104 </ TouchableOpacity >
132105 ) ;
133106 }
0 commit comments