-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix secondaryFill and secondaryOpacity errors by renaming to lowercase #74
Conversation
Hi, I get the same error. |
My guess is this could potentially break the layout on mobile apps because of the prop name change... for now I just npm install direct from my repo :) |
Any update on this? |
I don't think that A better fix for this would be to remove the |
Hey there 👋🏻 Here's the patch I created using patches/@FortAwesome+react-native-fontawesome+0.2.6.patch
diff --git a/node_modules/@fortawesome/react-native-fontawesome/dist/converter.js b/node_modules/@fortawesome/react-native-fontawesome/dist/converter.js
index 5b737a8..3849cd6 100644
--- a/node_modules/@fortawesome/react-native-fontawesome/dist/converter.js
+++ b/node_modules/@fortawesome/react-native-fontawesome/dist/converter.js
@@ -41,6 +41,9 @@ var svgObjectMap = {
function convert(createElement, element) {
var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+ var withoutFillProps = _objectSpread({}, extraProps);
+ delete withoutFillProps.secondaryFill;
+ delete withoutFillProps.secondaryOpacity;
if (typeof element === 'string') {
return element;
@@ -51,7 +54,7 @@ function convert(createElement, element) {
var isDuotoneSecondLayer = isDuotone && childIndex === 0;
var fill = isDuotoneSecondLayer ? extraProps.secondaryFill : extraProps.fill;
var fillOpacity = isDuotoneSecondLayer ? extraProps.secondaryOpacity : 1;
- return convert(createElement, child, _objectSpread(_objectSpread({}, extraProps), {}, {
+ return convert(createElement, child, _objectSpread(withoutFillProps, {}, {
fill: fill,
fillOpacity: fillOpacity
}));
@@ -84,7 +87,7 @@ function convert(createElement, element) {
}, {
attrs: {}
});
- return createElement.apply(void 0, [svgObjectMap[element.tag], _objectSpread(_objectSpread({}, mixins.attrs), extraProps)].concat(_toConsumableArray(children)));
+ return createElement.apply(void 0, [svgObjectMap[element.tag], _objectSpread(_objectSpread({}, mixins.attrs), withoutFillProps)].concat(_toConsumableArray(children)));
}
var _default = convert; This is based on the |
@micheleb: remove the This is my patch file:
|
Any idea when this gets merged? And Is there a workaround we can follow until then? |
Consider using @fortawesome/react-fontawesome on web. import {FontAwesomeIcon as FontAwesomeReact} from '@fortawesome/react-fontawesome';
import {FontAwesomeIcon as FontAwesomeNative} from '@fortawesome/react-native-fontawesome';
import {number} from 'prop-types';
import React from 'react';
import {Platform, StyleSheet} from 'react-native';
FaIcon.propTypes = {
size: number,
};
export default function FaIcon({size, style, ...props}) {
if (Platform.OS === 'web') {
const webStyles = StyleSheet.flatten([style, {width: size, height: size}]);
return <FontAwesomeReact {...props} style={webStyles} />;
}
return <FontAwesomeNative {...props} size={size} style={style} />;
} |
Thanks @Muffinoota I'm building an expo app, and my implementation looks like this:
Not sure if it's the best way, but it removed the console errors on web for me. |
Ok, we've finally spent some time on this and it was crazier than we first thought. Our PR #134 has a proper fix for this. We'll get this released pretty soon. |
Ok release 0.3.0 should have this all fixed up! Let me know if that's not the case and I'll re-open. |
I was getting a react errors when using this in react-native-web:
I resolved the issue by renaming these as recommended. Tests still pass so I think it's fine?