-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
index.js
46 lines (43 loc) · 1.46 KB
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import {View} from 'react-native';
import CheckboxWithTooltipForMobileWebAndNative from './CheckboxWithTooltipForMobileWebAndNative';
import Checkbox from '../Checkbox';
import {propTypes, defaultProps} from './checkboxWithTooltipPropTypes';
import Tooltip from '../Tooltip';
import withWindowDimensions from '../withWindowDimensions';
const CheckboxWithTooltip = (props) => {
if (props.isSmallScreenWidth || props.isMediumScreenWidth) {
return (
<CheckboxWithTooltipForMobileWebAndNative
style={props.style}
isChecked={props.isChecked}
onPress={props.onPress}
text={props.text}
toggleTooltip={props.toggleTooltip}
disabled={props.disabled}
/>
);
}
const checkbox = (
<Checkbox
isChecked={props.isChecked}
onPress={props.onPress}
disabled={props.disabled}
/>
);
return (
<View style={props.style}>
{props.toggleTooltip
? (
<Tooltip text={props.text}>
{checkbox}
</Tooltip>
)
: checkbox}
</View>
);
};
CheckboxWithTooltip.propTypes = propTypes;
CheckboxWithTooltip.defaultProps = defaultProps;
CheckboxWithTooltip.displayName = 'CheckboxWithTooltip';
export default withWindowDimensions(CheckboxWithTooltip);