diff --git a/dist/components/FontAwesomeIcon.js b/dist/components/FontAwesomeIcon.js index b87b492..3b7dc33 100644 --- a/dist/components/FontAwesomeIcon.js +++ b/dist/components/FontAwesomeIcon.js @@ -73,6 +73,8 @@ function normalizeIconArgs(icon) { } } +const noop = () => {}; + function FontAwesomeIcon(props) { var _props = _objectSpread({ icon: null, @@ -83,7 +85,8 @@ function FontAwesomeIcon(props) { color: null, secondaryColor: null, secondaryOpacity: null, - size: DEFAULT_SIZE + size: DEFAULT_SIZE, + onPress: noop }, props); var iconArgs = _props.icon, @@ -91,7 +94,8 @@ function FontAwesomeIcon(props) { maskId = _props.maskId, height = _props.height, width = _props.width, - size = _props.size; + size = _props.size, + onPress = _props.onPress; var style = _reactNative.StyleSheet.flatten(_props.style); @@ -134,12 +138,14 @@ function FontAwesomeIcon(props) { rootAttributes.height = resolvedHeight; rootAttributes.width = resolvedWidth; rootAttributes.style = modifiedStyle; + rootAttributes.onPress = onPress; replaceCurrentColor(_abstract[0], color, secondaryColor, secondaryOpacity); return convertCurry(_abstract[0]); } FontAwesomeIcon.displayName = 'FontAwesomeIcon'; FontAwesomeIcon.propTypes = { + onPress: _propTypes["default"].func, height: _propTypes["default"].number, width: _propTypes["default"].number, size: _propTypes["default"].number, @@ -186,4 +192,4 @@ function replaceFill(obj, primaryColor, secondaryColor, secondaryOpacity) { function hasPropertySetToValue(obj, property, value) { return Object.prototype.hasOwnProperty.call(obj, property) && obj[property] === value; -} \ No newline at end of file +} diff --git a/index.d.ts b/index.d.ts index 5ac0d4a..11264de 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,6 +24,7 @@ export interface Props { transform?: string | Transform; style?: FontAwesomeIconStyle; testID?: string; + onPress?: () => void; } export function FontAwesomeIcon(props: Props): JSX.Element; diff --git a/src/components/FontAwesomeIcon.js b/src/components/FontAwesomeIcon.js index 876839e..808f529 100644 --- a/src/components/FontAwesomeIcon.js +++ b/src/components/FontAwesomeIcon.js @@ -38,6 +38,8 @@ function normalizeIconArgs (icon) { } } +const noop = () => {}; + export default function FontAwesomeIcon (props) { const _props = { icon: null, @@ -49,10 +51,11 @@ export default function FontAwesomeIcon (props) { secondaryColor: null, secondaryOpacity: null, size: DEFAULT_SIZE, + onPress: noop, ...props } - const { icon: iconArgs, mask: maskArgs, maskId, height, width, size } = _props + const { icon: iconArgs, mask: maskArgs, maskId, height, width, size, onPress } = _props const style = StyleSheet.flatten(_props.style) const iconLookup = normalizeIconArgs(iconArgs) @@ -106,6 +109,7 @@ export default function FontAwesomeIcon (props) { rootAttributes.height = resolvedHeight rootAttributes.width = resolvedWidth rootAttributes.style = modifiedStyle + rootAttributes.onPress = onPress replaceCurrentColor(abstract[0], color, secondaryColor, secondaryOpacity)