Skip to content

Commit

Permalink
Create new component
Browse files Browse the repository at this point in the history
  • Loading branch information
pecanoro committed Oct 5, 2021
1 parent 5db4b8a commit aaf4275
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/CheckboxWithTooltip/CheckboxWithTooltipPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import PropTypes from 'prop-types';
import {windowDimensionsPropTypes} from '../withWindowDimensions';

const propTypes = {
/** Whether the checkbox is checked */
isChecked: PropTypes.bool.isRequired,

/** Called when the checkbox or label is pressed */
onPress: PropTypes.func.isRequired,

/** The text to display in the tooltip. */
text: PropTypes.string.isRequired,

/** Container styles */
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),

/** Props inherited from withWindowDimensions */
...windowDimensionsPropTypes,
};

const defaultProps = {
style: [],
};

export {
propTypes,
defaultProps,
};
32 changes: 32 additions & 0 deletions src/components/CheckboxWithTooltip/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';

const propTypes = {
/** Whether the checkbox is checked */
isChecked: PropTypes.bool.isRequired,

/** Called when the checkbox or label is pressed */
onPress: PropTypes.func.isRequired,

/** Container styles */
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
};

const defaultProps = {
style: [],
};

/**
* @param {propTypes} props
* @returns {ReactNodeLike}
*/
const CheckboxWithTooltip = props => (
<View style={props.style}>
</View>
);

CheckboxWithTooltip.propTypes = propTypes;
CheckboxWithTooltip.defaultProps = defaultProps;
CheckboxWithTooltip.displayName = 'CheckboxWithTooltip';
export default CheckboxWithTooltip;
32 changes: 32 additions & 0 deletions src/components/CheckboxWithTooltip/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';

const propTypes = {
/** Whether the checkbox is checked */
isChecked: PropTypes.bool.isRequired,

/** Called when the checkbox or label is pressed */
onPress: PropTypes.func.isRequired,

/** Container styles */
style: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
};

const defaultProps = {
style: [],
};

/**
* @param {propTypes} props
* @returns {ReactNodeLike}
*/
const CheckboxWithTooltip = props => (
<View style={props.style}>
</View>
);

CheckboxWithTooltip.propTypes = propTypes;
CheckboxWithTooltip.defaultProps = defaultProps;
CheckboxWithTooltip.displayName = 'CheckboxWithTooltip';
export default CheckboxWithTooltip;

0 comments on commit aaf4275

Please sign in to comment.