Skip to content

Commit

Permalink
merge picker changes
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-satija committed Dec 9, 2016
2 parents 524b9e4 + 1bdd1ae commit be95041
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Components/Widgets/InputGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Icon from './Icon';
import Button from './Button';
import computeProps from '../../Utils/computeProps';
import Input from './Input';
import Picker from './Picker';
import _ from 'lodash';

export default class InputGroup extends NativeBaseComponent {
Expand Down Expand Up @@ -145,7 +146,7 @@ export default class InputGroup extends NativeBaseComponent {
});

var inp = _.find(childrenArray, function(item) {
if(item && item.type == Input) {
if(item && (item.type == Input || item.type == Picker)) {
return true;
}
});
Expand Down
8 changes: 6 additions & 2 deletions Components/Widgets/Picker.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,20 @@ export default class PickerNB extends NativeBaseComponent {
}

render() {
let additionalProps = {marginLeft: -35};
if(this.props.inlineLabel) {
additionalProps = {paddingHorizontal: 4, justifyContent: 'flex-start', alignSelf: 'stretch'};
}
return (
<View ref={c => this._root = c}>
<Button
iconRight={(this.props.iosIcon== undefined) ? false : true}
transparent
textStyle={this.props.textStyle}
style={this.props.style}
style={[this.props.style,additionalProps]}
onPress={() => {this._setModalVisible(true)}}>
{this.state.currentLabel}
{(this.props.iosIcon == undefined) ? <View style={{ width: 0, height: 0 }} /> : this.renderIcon()}
{(this.props.iosIcon == undefined) ? '' : this.renderIcon()}
</Button>
<Modal animationType='slide'
transparent={false}
Expand Down
7 changes: 6 additions & 1 deletion Components/Widgets/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ export default class PickerNB extends NativeBaseComponent {
}

render() {
const {style, itemStyle, inlineLabel, iosHeader, children, ...otherProps } = this.prepareRootProps(); //eslint-disable-line
let additionalProps = {};
if(inlineLabel) {
additionalProps = { flex: 1};
}
return(
<Picker ref={c => this._root = c} {...this.prepareRootProps()}>
<Picker ref={c => this._root = c} style={[style, additionalProps]} itemStyle={[itemStyle]} {...otherProps}>
{this.props.children}
</Picker>
);
Expand Down

0 comments on commit be95041

Please sign in to comment.