Compare commits

..

No commits in common. "main" and "0.3.1" have entirely different histories.
main ... 0.3.1

7 changed files with 13 additions and 48 deletions

View File

@ -9,19 +9,13 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [ node: [
18.16.x 18.x
] ]
fontawesome-svg-core: [ fontawesome-svg-core: [
1.2.x, 1.2.x,
6.x 6.x
] ]
react-native: [ react-native: [
latest,
0.73.x,
0.72.x,
0.71.x,
0.70.x,
0.69.x,
0.68.x, 0.68.x,
0.67.x 0.67.x
] ]
@ -38,11 +32,11 @@ jobs:
- name: npm install and test - name: npm install and test
run: | run: |
sudo apt-get install -y jq sudo apt-get install -y jq
npm install -g npm@9 npm install -g npm
npm install npm install
npm install --no-save --force @fortawesome/fontawesome-svg-core@${{ matrix.fontawesome-svg-core }} react-native@${{ matrix.react-native }} npm install --no-save @fortawesome/fontawesome-svg-core@${{ matrix.fontawesome-svg-core }} react-native@${{ matrix.react-native }}
export REACT_VERSION=`cat node_modules/react-native/package.json|jq -r .peerDependencies.react` export REACT_VERSION=`cat node_modules/react-native/package.json|jq -r .peerDependencies.react`
npm install --no-save react@${REACT_VERSION} react-dom@${REACT_VERSION} react-test-renderer@${REACT_VERSION} npm install --no-save react@${REACT_VERSION} react-dom@${REACT_VERSION} react-test-renderer@${REACT_VERSION}
npm list --depth 0 react react-dom react-test-renderer react-native-svg || exit 0 npm list react react-dom react-test-renderer react-native-svg
npm run lint npm run lint
npm test npm test

View File

@ -1,2 +1,2 @@
nodejs 18.16.0 nodejs 16.13.1
python 3.10.4 python 3.10.4

View File

@ -6,14 +6,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
--- ---
## [0.3.2](https://github.com/FortAwesome/react-native-fontawesome/releases/tag/0.3.2) - 2024-05-23
### Fixed
- Props with nullable/undefined values no longer throw an error
---
## [0.3.1](https://github.com/FortAwesome/react-native-fontawesome/releases/tag/0.3.1) - 2024-05-16 ## [0.3.1](https://github.com/FortAwesome/react-native-fontawesome/releases/tag/0.3.1) - 2024-05-16
### Changed ### Changed

View File

@ -109,7 +109,7 @@ function FontAwesomeIcon(props) {
var _abstract = renderedIcon["abstract"]; // This is the color that will be passed to the "fill" prop of the Svg element 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; // This is the color that will be passed to the "fill" prop of the secondary Path element child (in Duotone Icons) 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 // `null` value will result in using the primary color, at 40% opacity
var secondaryColor = _props.secondaryColor || color; // Secondary layer opacity should default to 0.4, unless a specific opacity value or a specific secondary color was given var secondaryColor = _props.secondaryColor || color; // Secondary layer opacity should default to 0.4, unless a specific opacity value or a specific secondary color was given
@ -118,9 +118,8 @@ function FontAwesomeIcon(props) {
// or resolved in other ways, to avoid ambiguity as to which inputs cause which outputs in the underlying rendering process. // 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. // In other words, we don't want color (for example) to be specified via two different inputs.
var _ref2 = style || {}, var styleColor = style.color,
styleColor = _ref2.color, modifiedStyle = _objectWithoutProperties(style, _excluded);
modifiedStyle = _objectWithoutProperties(_ref2, _excluded);
var resolvedHeight, resolvedWidth; var resolvedHeight, resolvedWidth;

View File

@ -1,6 +1,6 @@
{ {
"name": "@fortawesome/react-native-fontawesome", "name": "@fortawesome/react-native-fontawesome",
"version": "0.3.2", "version": "0.3.1",
"description": "Official React Native component for Font Awesome", "description": "Official React Native component for Font Awesome",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -53,7 +53,7 @@
"eslint-plugin-react": "^7.30.0", "eslint-plugin-react": "^7.30.0",
"jest": "^28.1.0", "jest": "^28.1.0",
"metro-react-native-babel-preset": "^0.57.0", "metro-react-native-babel-preset": "^0.57.0",
"react": "^17 || ^18", "react": "^17",
"react-native": "^0.68.0", "react-native": "^0.68.0",
"react-native-svg": "^12.3.0", "react-native-svg": "^12.3.0",
"react-test-renderer": "^17" "react-test-renderer": "^17"

View File

@ -50,7 +50,7 @@ export default function FontAwesomeIcon (props) {
secondaryOpacity: null, secondaryOpacity: null,
size: DEFAULT_SIZE, size: DEFAULT_SIZE,
...props ...props
} };
const { icon: iconArgs, mask: maskArgs, maskId, height, width, size } = _props const { icon: iconArgs, mask: maskArgs, maskId, height, width, size } = _props
const style = StyleSheet.flatten(_props.style) const style = StyleSheet.flatten(_props.style)
@ -78,7 +78,7 @@ export default function FontAwesomeIcon (props) {
const { abstract } = renderedIcon const { abstract } = renderedIcon
// This is the color that will be passed to the "fill" prop of the Svg element // This is the color that will be passed to the "fill" prop of the Svg element
const color = _props.color || (style || {}).color || DEFAULT_COLOR const 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) // 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 // `null` value will result in using the primary color, at 40% opacity
@ -90,7 +90,7 @@ export default function FontAwesomeIcon (props) {
// To avoid confusion down the line, we'll remove properties from the StyleSheet, like color, that are being overridden // 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. // 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. // In other words, we don't want color (for example) to be specified via two different inputs.
const { color: styleColor, ...modifiedStyle } = (style || {}) const { color: styleColor, ...modifiedStyle } = style
let resolvedHeight, resolvedWidth let resolvedHeight, resolvedWidth

View File

@ -145,26 +145,6 @@ describe('snapshots', () => {
}) })
}) })
describe('using defaultProps', () => {
const UNDEFINED_DEFAULT_PROPS = {
icon: undefined,
mask: undefined,
maskId: undefined,
transform: undefined,
style: undefined,
color: undefined,
secondaryColor: undefined,
secondaryOpacity: undefined,
size: undefined
}
test('undefined props passed', () => {
expect(() =>
renderer.create(<FontAwesomeIcon {...UNDEFINED_DEFAULT_PROPS} icon={ faCoffee } />).toJSON()
).not.toThrow(TypeError)
})
})
describe('when icon prop', () => { describe('when icon prop', () => {
beforeEach(() => { beforeEach(() => {
fontawesome.library.add(faCoffee, faCircle, faSquare, faAcorn) fontawesome.library.add(faCoffee, faCircle, faSquare, faAcorn)