Skip to content

Commit bd05d1b

Browse files
authored
Merge pull request #42 from APSL/designblooz-remove-deprecation
remove ProgressBarAndroid since it is deprecated and use ActivityIndi…
2 parents 9cfebae + 615c65f commit bd05d1b

File tree

2 files changed

+10
-37
lines changed

2 files changed

+10
-37
lines changed

Button.js

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A React Native button component customizable via ``style`` props.
1010
Renders a ``TouchableOpacity`` under iOS and a ``TouchableNativeFeedback`` under Android.
1111

1212
## Install
13-
13+
`apsl-react-native-button>=2.6.0` needs React Native 0.28 or higher.
1414
`apsl-react-native-button>=2.5.0` needs React Native 0.25 or higher.
1515
`apsl-react-native-button<=2.4.2` needs React Native 0.16 or higher.
1616

0 commit comments

Comments
 (0)