Skip to content

Commit

Permalink
Release 0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
robmadole committed May 14, 2020
1 parent 708009b commit 539b91b
Show file tree
Hide file tree
Showing 9 changed files with 1,348 additions and 10,615 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 12.16.0
nodejs 12.6.0
python 3.7.5
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

---

## [0.2.5](https://github.com/FortAwesome/react-native-fontawesome/releases/tag/0.2.5) - 2020-05-14

### Added

- Support for Duotone icons #59

---

## [0.2.4](https://github.com/FortAwesome/react-native-fontawesome/releases/tag/0.2.4) - 2020-04-27

### Fixed

- Loosen peerDependencies versions to allow newere react-native and react-native-svg packages
- Loosen peerDependencies versions to allow newer react-native and react-native-svg packages

---

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,12 @@ Community:

"David Martin <github.com/iamdavidmartin>",

| | Name | GitHub |
| :---------------------------------------------------------: | -------------- | ---------------------------------------------------- |
| <img src="https://github.com/dizy.png?size=72" /> | Dizy | [@dizy](https://github.com/dizy) |
| <img src="https://github.com/iamdavidmartin.png?size=72" /> | David Martin | [@iamdavidmartin](https://github.com/iamdavidmartin) |
| <img src="https://github.com/puremana.png?size=72" /> | Jeremey | [@puremana](https://github.com/puremana) |
| | Name | GitHub |
| :---------------------------------------------------------: | ----------------- | ---------------------------------------------------- |
| <img src="https://github.com/dizy.png?size=72" /> | Dizy | [@dizy](https://github.com/dizy) |
| <img src="https://github.com/iamdavidmartin.png?size=72" /> | David Martin | [@iamdavidmartin](https://github.com/iamdavidmartin) |
| <img src="https://github.com/puremana.png?size=72" /> | Jeremey | [@puremana](https://github.com/puremana) |
| <img src="https://github.com/schonfeld.png?size=72" /> | Michael Schonfeld | [@schonfeld](https://github.com/schonfeld) |

The Font Awesome team:

Expand Down
21 changes: 17 additions & 4 deletions dist/components/FontAwesomeIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = FontAwesomeIcon;
exports.DEFAULT_COLOR = exports.DEFAULT_SIZE = void 0;
exports.DEFAULT_SECONDARY_OPACITY = exports.DEFAULT_COLOR = exports.DEFAULT_SIZE = void 0;

var _react = _interopRequireDefault(require("react"));

Expand Down Expand Up @@ -38,9 +38,11 @@ var _Dimensions$get = _reactNative.Dimensions.get('window'),

var DEFAULT_SIZE = 16;
exports.DEFAULT_SIZE = DEFAULT_SIZE;
var DEFAULT_COLOR = '#000'; // Deprecated height and width defaults

var DEFAULT_COLOR = '#000';
exports.DEFAULT_COLOR = DEFAULT_COLOR;
var DEFAULT_SECONDARY_OPACITY = 0.4; // Deprecated height and width defaults

exports.DEFAULT_SECONDARY_OPACITY = DEFAULT_SECONDARY_OPACITY;
var DEFAULT_HEIGHT = windowHeight * 0.1;
var DEFAULT_WIDTH = windowWidth * 0.1;

Expand Down Expand Up @@ -93,7 +95,12 @@ function FontAwesomeIcon(props) {

var _abstract = renderedIcon["abstract"]; // This is the color that will be passed to the "fill" prop of the Svg element

var color = props.color || style.color || DEFAULT_COLOR; // To avoid confusion down the line, we'll remove properties from the StyleSheet, like color, that are being overridden
var color = props.color || style.color || DEFAULT_COLOR; // This is the color that will be passed to the "fill" prop of the secondary Path element child (in Duotone Icons)
// `null` value will result in using the primary color, at 40% opacity

var secondaryColor = props.secondaryColor || null; // Secondary layer opacity should default to 0.4, unless a specific opacity value or a specific secondary color was given

var secondaryOpacity = props.secondaryOpacity || (secondaryColor ? 1 : DEFAULT_SECONDARY_OPACITY); // To avoid confusion down the line, we'll remove properties from the StyleSheet, like color, that are being overridden
// or resolved in other ways, to avoid ambiguity as to which inputs cause which outputs in the underlying rendering process.
// In other words, we don't want color (for example) to be specified via two different inputs.

Expand All @@ -119,6 +126,8 @@ function FontAwesomeIcon(props) {
height: resolvedHeight,
width: resolvedWidth,
fill: color,
secondaryFill: secondaryColor,
secondaryOpacity: secondaryOpacity,
style: modifiedStyle
};
Object.keys(props).forEach(function (key) {
Expand All @@ -135,6 +144,8 @@ FontAwesomeIcon.propTypes = {
width: _propTypes["default"].number,
size: _propTypes["default"].number,
color: _propTypes["default"].string,
secondaryColor: _propTypes["default"].string,
secondaryOpacity: _propTypes["default"].number,
style: _propTypes["default"].oneOfType([_propTypes["default"].shape(_objectSpread({}, _reactNative.ViewPropTypes.style)), _propTypes["default"].array]),
icon: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array, _propTypes["default"].string]),
mask: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array, _propTypes["default"].string]),
Expand All @@ -146,6 +157,8 @@ FontAwesomeIcon.defaultProps = {
transform: null,
style: {},
color: null,
secondaryColor: null,
secondaryOpacity: null,
height: undefined,
width: undefined // Once the deprecation of height and width props is complete, let's put the real default prop value for size here.
// For now, adding it breaks the default/override logic for height/width/size.
Expand Down
23 changes: 15 additions & 8 deletions dist/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ var _reactNativeSvg = require("react-native-svg");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
Expand All @@ -25,6 +19,12 @@ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var svgObjectMap = {
"svg": _reactNativeSvg.Svg,
"path": _reactNativeSvg.Path,
Expand All @@ -42,8 +42,15 @@ function convert(createElement, element) {
return element;
}

var children = (element.children || []).map(function (child) {
return convert(createElement, child);
var isDuotone = (element.children || []).length === 2;
var children = (element.children || []).map(function (child, childIndex) {
var isDuotoneSecondLayer = isDuotone && childIndex === 0;
var fill = isDuotoneSecondLayer ? extraProps.secondaryFill : extraProps.fill;
var fillOpacity = isDuotoneSecondLayer ? extraProps.secondaryOpacity : 1;
return convert(createElement, child, _objectSpread({}, extraProps, {
fill: fill,
fillOpacity: fillOpacity
}));
});
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {
var val = element.attributes[key];
Expand Down
Binary file removed fortawesome-react-native-fontawesome-0.2.4.tgz
Binary file not shown.
Loading

0 comments on commit 539b91b

Please sign in to comment.