Skip to content

Commit 26c11c4

Browse files
committed
Initial Android Support
1 parent bf9fdff commit 26c11c4

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

docs/awesomeButton.gif

1.08 MB
Loading

src/AwesomeButton.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@ const React = require('react-native')
33

44
const {
55
Animated,
6-
ActivityIndicatorIOS,
76
Component,
87
View,
98
Text,
109
StyleSheet,
1110
TouchableOpacity
1211
} = React
1312

13+
var ProgressBar = require('./ProgressBar');
1414

1515
class InnerButtonView extends Component {
1616

1717
render() {
1818
return(
1919
<View style={styles.insideView}>
20-
{ this.props.currentStateObject.spinner ? <ActivityIndicatorIOS color={ this.props.spinnerColor } style={styles.activityIndicator}/> : null }
20+
{ this.props.currentStateObject.spinner ? <ProgressBar color={ this.props.spinnerColor } style={styles.activityIndicator}/> : null }
2121
<Text style={ this.props.labelStyle }>{ this.props.currentStateObject.text }</Text>
2222
</View>
2323
)
2424
}
25-
2625
}
2726

2827

@@ -134,4 +133,4 @@ const styles = StyleSheet.create({
134133
})
135134

136135

137-
module.exports = AwesomeButton
136+
module.exports = AwesomeButton

src/ProgressBar.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var React = require('react-native');
4+
var {
5+
Platform,
6+
ActivityIndicatorIOS,
7+
ProgressBarAndroid,
8+
} = React;
9+
10+
var ProgressBar = React.createClass({
11+
render() {
12+
if (Platform.OS === 'ios') {
13+
return (
14+
<ActivityIndicatorIOS color={this.props.color} style={this.props.style}/>
15+
);
16+
} else {
17+
return (
18+
<ProgressBarAndroid color={this.props.color} style={this.props.style} styleAttr={"Small"}/>
19+
);
20+
}
21+
}
22+
});
23+
24+
module.exports = ProgressBar;

0 commit comments

Comments
 (0)