Skip to content

Commit 8236e8f

Browse files
Sankhadeep RoySankhadeep Roy
authored andcommitted
spinner and progressbar added
1 parent 0d95dad commit 8236e8f

File tree

6 files changed

+139
-3
lines changed

6 files changed

+139
-3
lines changed

Components/Widgets/Header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
import React from 'react';
5-
import {View} from 'react-native';
5+
import {View, Platform} from 'react-native';
66
import NativeBaseComponent from '../Base/NativeBaseComponent';
77
import computeProps from '../../Utils/computeProps';
88

@@ -16,7 +16,7 @@ export default class Header extends NativeBaseComponent {
1616
flexDirection: 'row',
1717
alignItems: 'center',
1818
padding: 15,
19-
paddingTop: 25,
19+
paddingTop: (Platform.OS === 'ios' ) ? 25 : 12,
2020
shadowColor: '#000',
2121
shadowOffset: {width: 0, height: 2},
2222
shadowOpacity: 0.1,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* @flow */
2+
'use strict';
3+
4+
import React from 'react';
5+
import { ActivityIndicatorIOS, Platform } from 'react-native';
6+
import ProgressBar from 'ProgressBarAndroid';
7+
import NativeBaseComponent from '../Base/NativeBaseComponent';
8+
import computeProps from '../../Utils/computeProps';
9+
10+
11+
export default class SpinnerNB extends NativeBaseComponent {
12+
13+
prepareRootProps() {
14+
15+
var type = {
16+
height: 40
17+
}
18+
19+
var defaultProps = {
20+
style: type
21+
}
22+
23+
return computeProps(this.props, defaultProps);
24+
25+
}
26+
27+
28+
render() {
29+
return(
30+
<ProgressBar {...this.prepareRootProps()} styleAttr = "Horizontal"
31+
indeterminate = {false} progress={this.props.progress ? this.props.progress/100 : 0.5}
32+
color={this.props.color ? this.props.color : '#41B367'} />
33+
);
34+
}
35+
36+
}
37+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* @flow */
2+
'use strict';
3+
4+
import React from 'react';
5+
import { ProgressViewIOS} from 'react-native';
6+
import ProgressBar from 'ProgressBarAndroid';
7+
import NativeBaseComponent from '../Base/NativeBaseComponent';
8+
import computeProps from '../../Utils/computeProps';
9+
10+
11+
export default class ProgressBarNB extends NativeBaseComponent {
12+
13+
14+
15+
render() {
16+
return(
17+
<ProgressViewIOS progress={this.props.progress ? this.props.progress/100 : 0.5}
18+
progressTintColor={this.props.color ? this.props.color : '#FD2E1F'} />
19+
);
20+
}
21+
22+
}
23+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* @flow */
2+
'use strict';
3+
4+
import React from 'react';
5+
import { ActivityIndicatorIOS, Platform } from 'react-native';
6+
import ProgressBar from 'ProgressBarAndroid';
7+
import NativeBaseComponent from '../Base/NativeBaseComponent';
8+
import computeProps from '../../Utils/computeProps';
9+
10+
11+
export default class SpinnerNB extends NativeBaseComponent {
12+
13+
prepareRootProps() {
14+
15+
var type = {
16+
height: 40
17+
}
18+
19+
var defaultProps = {
20+
style: type
21+
}
22+
23+
return computeProps(this.props, defaultProps);
24+
25+
}
26+
27+
28+
render() {
29+
return(
30+
<ProgressBar {...this.prepareRootProps()} styleAttr = {this.props.size ? this.props.size : "Large" }
31+
color={this.props.color ? this.props.color : '#41B367'} />
32+
);
33+
}
34+
35+
}
36+

Components/Widgets/Spinner.ios.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* @flow */
2+
'use strict';
3+
4+
import React from 'react';
5+
import { ActivityIndicatorIOS, Platform } from 'react-native';
6+
import ProgressBar from 'ProgressBarAndroid';
7+
import NativeBaseComponent from '../Base/NativeBaseComponent';
8+
import computeProps from '../../Utils/computeProps';
9+
10+
11+
export default class SpinnerNB extends NativeBaseComponent {
12+
13+
prepareRootProps() {
14+
15+
var type = {
16+
height: 80
17+
}
18+
19+
var defaultProps = {
20+
style: type
21+
}
22+
23+
return computeProps(this.props, defaultProps);
24+
25+
}
26+
27+
28+
render() {
29+
return(
30+
<ActivityIndicatorIOS {...this.prepareRootProps()} color={this.props.color ? this.props.color : '#A6A4A2'}
31+
size={this.props.size ? this.props.size : "large" } />
32+
);
33+
}
34+
35+
}
36+

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import Thumbnail from './Components/Widgets/Thumbnail';
2525
import Card from './Components/Widgets/Card';
2626
import Badge from './Components/Widgets/Badge';
2727
import Form from './Components/Widgets/Form';
28+
import Spinner from './Components/Widgets/Spinner';
29+
import ProgressBar from './Components/Widgets/ProgressBar';
2830
import { Col, Row, Grid } from "react-native-easy-grid";
2931

3032
module.exports = {
@@ -53,5 +55,7 @@ module.exports = {
5355
Thumbnail: Thumbnail,
5456
Card: Card,
5557
Badge: Badge,
56-
Form: Form
58+
Form: Form,
59+
Spinner: Spinner,
60+
ProgressBar: ProgressBar
5761
};

0 commit comments

Comments
 (0)