forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRadio.js
More file actions
31 lines (27 loc) · 1.08 KB
/
Radio.js
File metadata and controls
31 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { Component } from 'react';
import { TouchableOpacity, Platform } from 'react-native';
import { connectStyle } from '@shoutem/theme';
import { IconNB as Icon } from './IconNB';
import mapPropsToStyleNames from '../Utils/mapPropsToStyleNames';
import variable from '../theme/variables/platform';
class Radio extends Component {
render() {
return (
<TouchableOpacity ref={c => this._root = c} {...this.props}>
{(Platform.OS === 'ios') ?
(this.props.selected) && <Icon name="ios-checkmark" style={{height: 20, lineHeight: 25, fontSize: 30, color: variable.brandPrimary}} />
:
<Icon name={this.props.selected ? 'md-radio-button-on' : 'md-radio-button-off'} style={{fontSize: 22, lineHeight: 23, color: (this.props.selected) ? variable.radioSelectedColorAndroid : undefined}} />
}
</TouchableOpacity>
);
}
}
Radio.propTypes = {
...TouchableOpacity.propTypes,
selected: React.PropTypes.bool,
};
const StyledRadio = connectStyle('NativeBase.Radio', {}, mapPropsToStyleNames)(Radio);
export {
StyledRadio as Radio,
};