Skip to content

Commit 04117da

Browse files
Merge branch 'master' of github.com:GeekyAnts/NativeBase into development
2 parents d8b7137 + de8f468 commit 04117da

40 files changed

+794
-276
lines changed

Components/Themes/light.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ export default {
112112
tabBarActiveTextColor: (Platform.OS === 'ios' ) ? '#007aff' : '#fff',
113113
tabActiveBgColor: (Platform.OS=='ios') ? '#cde1f9' : undefined,
114114

115+
//Tab
116+
tabDefaultBg: (Platform.OS === 'ios' ) ? '#F8F8F8' : '#4179F7',
117+
topTabBarTextColor: (Platform.OS === 'ios' ) ? '#6b6b6b' : '#b3c7f9',
118+
topTabBarActiveTextColor: (Platform.OS === 'ios' ) ? '#007aff' : '#fff',
119+
topTabActiveBgColor: (Platform.OS=='ios') ? '#cde1f9' : undefined,
120+
topTabBarBorderColor: (Platform.OS === 'ios' ) ? '#007aff' : '#fff',
121+
115122

116123
// Header
117124
iosToolbarBtnColor: '#007aff',

Components/Widgets/Badge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class BadgeNB extends NativeBaseComponent {
4646
}
4747
render() {
4848
return(
49-
<View {...this.prepareRootProps()}>
49+
<View ref={c => this._root = c} {...this.prepareRootProps()}>
5050
<Text style={{ color: (this.props.textStyle && this.props.textStyle.color) ? this.props.textStyle.color : this.getTheme().badgeColor,
5151
fontSize: (this.props.textStyle && this.props.textStyle.fontSize) ? this.props.textStyle.fontSize : this.getTheme().fontSizeBase,
5252
lineHeight: (this.props.textStyle && this.props.textStyle.lineHeight) ? this.props.textStyle.lineHeight : this.getTheme().lineHeight-1,

Components/Widgets/Button.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export default class Button extends NativeBaseComponent {
2929
rounded : React.PropTypes.bool,
3030
large : React.PropTypes.bool,
3131
small : React.PropTypes.bool,
32-
inputButton : React.PropTypes.bool
32+
inputButton : React.PropTypes.bool,
33+
tabButton : React.PropTypes.bool
3334
}
3435

3536
getInitialStyle() {
@@ -125,12 +126,15 @@ export default class Button extends NativeBaseComponent {
125126
(this.props.bordered) ? this.getTheme().btnPrimaryBg :
126127
(this.props.color) ? this.props.color :
127128
(this.props.header) ? this.getTheme().toolbarTextColor :
129+
(this.props.activeTabButton) ? this.getTheme().topTabBarActiveTextColor :
130+
(this.props.tabButton) ? this.getTheme().topTabBarTextColor :
128131
(this.props.transparent) ? this.getContextForegroundColor() :
129132
this.getTheme().inverseTextColor,
130-
133+
marginBottom: ((this.props.vertical) && (Platform.OS == 'android')) ? 2 : undefined,
131134
fontSize: (this.props.large) ? this.getTheme().iconSizeLarge :
132135
(this.props.small) ? this.getTheme().iconSizeSmall :
133136
(this.props.inputButton) ? this.getTheme().toolbarIconSize :
137+
(this.props.fabButton) ? 22 :
134138
(this.props.header) ? this.getTheme().iconFontSize : this.getTheme().iconFontSize-5,
135139
lineHeight: (this.props.large) ? 52: (this.props.small || this.props.inputButton) ? 22 : this.getTheme().iconLineHeight-9
136140
}
@@ -150,7 +154,6 @@ export default class Button extends NativeBaseComponent {
150154
return iconComponentPresent;
151155
}
152156
renderChildren() {
153-
154157
if(typeof this.props.children == 'string') {
155158
return <Text style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? this.props.children : this.props.children.toUpperCase()}</Text>
156159
}
@@ -205,7 +208,7 @@ export default class Button extends NativeBaseComponent {
205208

206209
render() {
207210
return(
208-
<TouchableOpacity {...this.prepareRootProps()} activeOpacity={0.5} >
211+
<TouchableOpacity ref={c => this._root = c} {...this.prepareRootProps()} activeOpacity={0.5} >
209212
{this.renderChildren()}
210213
</TouchableOpacity>
211214
);

Components/Widgets/Card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default class CardNB extends NativeBaseComponent {
6161
);
6262
}
6363
return(
64-
<View {...this.prepareRootProps()} >
64+
<View ref={c => this._root = c} {...this.prepareRootProps()} >
6565
{this.renderChildren()}
6666
</View>
6767
);

Components/Widgets/CardItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export default class CardItemNB extends NativeBaseComponent {
292292

293293
render() {
294294
return(
295-
<TouchableOpacity {...this.prepareRootProps()} activeOpacity={ (this.props.button) ? 0.2 : 1} >
295+
<TouchableOpacity ref={c => this._root = c} {...this.prepareRootProps()} activeOpacity={ (this.props.button) ? 0.2 : 1} >
296296
{this.renderChildren()}
297297
</TouchableOpacity>
298298
);

Components/Widgets/CardSwiper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ export default class CardSwiper extends NativeBaseComponent {
9191
let opacity = pan.x.interpolate({inputRange: [-150, 0, 150], outputRange: [0.5, 1, 0.5]})
9292
let scale = enter;
9393

94-
let animatedCardStyles = {transform: [{translateX}, {translateY}, {rotate}, {scale}], opacity};
94+
let animatedCardStyles = {transform: [{translateX}, {translateY}, {rotate}, {scale}], opacity};
95+
9596

96-
9797

9898
return(
99-
<View>
99+
<View ref={c => this._root = c}>
100100
<Animated.View style={ animatedCardStyles } {...this._panResponder.panHandlers} >
101101
{this.props.children}
102102
</Animated.View>

Components/Widgets/Checkbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class CheckBox extends NativeBaseComponent {
2626

2727
render() {
2828
return(
29-
<TouchableOpacity style={this.getInitialStyle().checkbox} {...this.props}>
29+
<TouchableOpacity ref={c => this._root = c} style={this.getInitialStyle().checkbox} {...this.props}>
3030
<Icon name={(Platform.OS === 'ios') ? 'ios-checkmark-outline' : 'md-checkmark'} style={{color: this.props.checked ? this.getTheme().checkboxTickColor : 'transparent', lineHeight: (Platform.OS === 'ios') ? this.getTheme().checkboxSize/0.93 : this.getTheme().checkboxSize-5, marginTop: (Platform.OS==='ios') ? undefined : 1, fontSize: (Platform.OS === 'ios') ? this.getTheme().checkboxSize/0.8 : this.getTheme().checkboxSize/1.2}} />
3131
</TouchableOpacity>
3232
);

Components/Widgets/Container.js

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,89 @@ import ViewNB from './View';
77
import Header from './Header';
88
import Content from './Content';
99
import Footer from './Footer';
10+
import Fab from './Fab';
1011
import NativeBaseComponent from '../Base/NativeBaseComponent';
1112
import _ from 'lodash';
1213
import computeProps from '../../Utils/computeProps';
1314

1415
export default class Container extends NativeBaseComponent {
1516

16-
propTypes: {
17+
propTypes: {
1718
style : React.PropTypes.object
1819
}
1920

20-
renderHeader() {
21-
if(Array.isArray(this.props.children)) {
22-
return _.find(this.props.children, function(item) {
23-
if(item && item.type == Header) {
24-
return true;
25-
}
26-
});
27-
}
28-
29-
else {
30-
if(this.props.children && this.props.children.type == Header) {
31-
return this.props.children;
32-
}
33-
}
34-
}
35-
renderContent() {
36-
if(Array.isArray(this.props.children)) {
37-
38-
return _.filter(this.props.children, function(item) {
39-
if(item && (item.type == ViewNB || item.type == Content || item.type == Image || item.type == View || item.type == ScrollView )) {
40-
41-
return true;
42-
}
43-
});
44-
}
45-
46-
else {
47-
if(this.props.children && (this.props.children.type == Content || this.props.children.type == ViewNB || this.props.children.type == View || this.props.children.type == Image || this.props.children.type == ScrollView)) {
48-
return this.props.children;
49-
}
50-
}
51-
}
52-
renderFooter() {
53-
if(Array.isArray(this.props.children)) {
54-
return _.find(this.props.children, function(item) {
55-
if(item && item.type == Footer) {
56-
return true;
57-
}
58-
});
59-
}
60-
61-
else {
62-
if(this.props.children && this.props.children.type == Footer) {
63-
return this.props.children;
64-
}
65-
}
66-
}
67-
prepareRootProps() {
68-
69-
var type = {
70-
flex: 1
71-
}
72-
73-
var defaultProps = {
74-
style: type
75-
}
76-
77-
return computeProps(this.props, defaultProps);
78-
}
79-
render() {
80-
return(
81-
<View {...this.prepareRootProps()}>
82-
83-
{this.renderHeader()}
84-
85-
{this.renderContent()}
86-
87-
{this.renderFooter()}
88-
89-
</View>
90-
);
91-
92-
}
21+
renderHeader() {
22+
if(Array.isArray(this.props.children)) {
23+
return _.find(this.props.children, function(item) {
24+
if(item && item.type == Header) {
25+
return true;
26+
}
27+
});
28+
}
29+
30+
else {
31+
if(this.props.children && this.props.children.type == Header) {
32+
return this.props.children;
33+
}
34+
}
35+
}
36+
renderContent() {
37+
if(Array.isArray(this.props.children)) {
38+
39+
return _.filter(this.props.children, function(item) {
40+
if(item && (item.type == ViewNB || item.type == Content || item.type == Image || item.type == View || item.type == ScrollView || item.type == Fab )) {
41+
42+
return true;
43+
}
44+
});
45+
}
46+
47+
else {
48+
if(this.props.children && (this.props.children.type == Content || this.props.children.type == ViewNB || this.props.children.type == View || this.props.children.type == Image || this.props.children.type == ScrollView)) {
49+
return this.props.children;
50+
}
51+
}
52+
}
53+
renderFooter() {
54+
if(Array.isArray(this.props.children)) {
55+
return _.find(this.props.children, function(item) {
56+
if(item && item.type == Footer) {
57+
return true;
58+
}
59+
});
60+
}
61+
62+
else {
63+
if(this.props.children && this.props.children.type == Footer) {
64+
return this.props.children;
65+
}
66+
}
67+
}
68+
prepareRootProps() {
69+
70+
var type = {
71+
flex: 1
72+
}
73+
74+
var defaultProps = {
75+
style: type
76+
}
77+
78+
return computeProps(this.props, defaultProps);
79+
}
80+
render() {
81+
return(
82+
<View ref={c => this._root = c} {...this.prepareRootProps()}>
83+
84+
{this.renderHeader()}
85+
86+
{this.renderContent()}
87+
88+
{this.renderFooter()}
89+
90+
</View>
91+
);
92+
93+
}
9394

9495
}

Components/Widgets/Content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class Content extends NativeBaseComponent {
3737
const contentContainerStyle = this.props.contentContainerStyle || {};
3838
contentContainerStyle.padding = (this.props.padder) ? this.getTheme().contentPadding : 0;
3939
return(
40-
<KeyboardAwareScrollView automaticallyAdjustContentInsets={false} ref={c => this._scrollview = c} {...this.prepareRootProps()} contentContainerStyle={contentContainerStyle}>{this.props.children}</KeyboardAwareScrollView>
40+
<KeyboardAwareScrollView automaticallyAdjustContentInsets={false} ref={(c) => {this._scrollview = c; this._root = c;}} {...this.prepareRootProps()} contentContainerStyle={contentContainerStyle}>{this.props.children}</KeyboardAwareScrollView>
4141
);
4242
}
4343
}

Components/Widgets/DeckSwiper.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ export default class CardSwiper extends NativeBaseComponent {
4040
findNextIndexes() {
4141
let currentIndex = this.props.dataSource.indexOf(this.state.selectedItem);
4242
let newIdx = currentIndex + 1;
43-
let newIdx2 = currentIndex + 2;
43+
let newIdx2 = currentIndex + 2;
4444

45-
if(newIdx2 > this.props.dataSource.length - 1 && newIdx === this.props.dataSource.length - 1) {
45+
if(newIdx2 > this.props.dataSource.length - 1 && newIdx === this.props.dataSource.length - 1) {
4646
return [newIdx, 0];
47-
} else if (newIdx > this.props.dataSource.length - 1) {
47+
} else if (newIdx > this.props.dataSource.length - 1) {
4848
return [0, 1];
49-
} else {
49+
} else {
5050
return [newIdx, newIdx2];
5151
}
5252
}
@@ -60,7 +60,7 @@ export default class CardSwiper extends NativeBaseComponent {
6060
setTimeout( () => {
6161
this.setState({
6262
selectedItem2: this.props.dataSource[nextIndexes[1]]
63-
});
63+
});
6464
}, 350);
6565
}, 50);
6666

@@ -99,9 +99,9 @@ export default class CardSwiper extends NativeBaseComponent {
9999
var velocity;
100100

101101
if (vx >= 0) {
102-
velocity = clamp(vx, 4.5, 10);
102+
velocity = clamp(vx, 4.5, 10);
103103
} else if (vx < 0) {
104-
velocity = clamp(vx * -1, 4.5, 10) * -1;
104+
velocity = clamp(vx * -1, 4.5, 10) * -1;
105105
}
106106

107107
if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {
@@ -161,7 +161,7 @@ export default class CardSwiper extends NativeBaseComponent {
161161

162162

163163
return(
164-
<View style={{position: 'relative', flexDirection: 'column'}}>{(this.state.selectedItem)===undefined ? (<View />) :
164+
<View ref={c => this._root = c} style={{position: 'relative', flexDirection: 'column'}}>{(this.state.selectedItem)===undefined ? (<View />) :
165165
(<View>
166166
<Animated.View style={[this.getCardStyles()[1],{opacity: this.state.fadeAnim}]} {...this._panResponder.panHandlers}>
167167
{this.props.renderItem(this.state.selectedItem2)}

0 commit comments

Comments
 (0)