Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions dist/components/FontAwesomeIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function normalizeIconArgs(icon) {
}
}

const noop = () => {};

function FontAwesomeIcon(props) {
var _props = _objectSpread({
icon: null,
Expand All @@ -83,15 +85,17 @@ function FontAwesomeIcon(props) {
color: null,
secondaryColor: null,
secondaryOpacity: null,
size: DEFAULT_SIZE
size: DEFAULT_SIZE,
onPress: noop
}, props);

var iconArgs = _props.icon,
maskArgs = _props.mask,
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);

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
}
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface Props {
transform?: string | Transform;
style?: FontAwesomeIconStyle;
testID?: string;
onPress?: () => void;
}

export function FontAwesomeIcon(props: Props): JSX.Element;
6 changes: 5 additions & 1 deletion src/components/FontAwesomeIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function normalizeIconArgs (icon) {
}
}

const noop = () => {};

export default function FontAwesomeIcon (props) {
const _props = {
icon: null,
Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down