Skip to content
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

Asset icon package - Failed prop type: Invalid props.style key style #1026

Closed
SimonVillage opened this issue Apr 15, 2020 · 1 comment · Fixed by #1055
Closed

Asset icon package - Failed prop type: Invalid props.style key style #1026

SimonVillage opened this issue Apr 15, 2020 · 1 comment · Fixed by #1055

Comments

@SimonVillage
Copy link

🐛 Bug Report

I am trying to add my own asset package.

Icon register

import React from 'react';
import { Avatar } from '@ui-kitten/components';

const IconProvider = (source) => ({
  toReactElement: ({ animation, ...style }) => (
    <Avatar style={ style } shape="round" source={ source }/>
  ),
});

export const AssetIconsPack = {
  name: 'assets',
  icons: {
    iconLineChart: IconProvider(require('assets/commonIcons/icon_line_chart.png')),
    iconCandleChart: IconProvider(require('assets/commonIcons/icon_candle_chart.png')),
  },
};

using the new icon package

    const iconCandleChart = () => (
      <Icon name="iconCandleChart" pack="assets" width={ 18 } height={ 18 } />
    );

warning

Warning: Failed prop type: Invalid props.style key `style` supplied to `Image`.
Bad object: {
  "borderRadius": 9,
  "width": 18,
  "height": 18,
  "style": [
    {
      "width": 12,
      "height": 12,
      "tintColor": "#FF3D71",
      "marginHorizontal": 6
    },
    {},
    null
  ]
}
Valid keys: [
  "display",
  "width",
   ...
]

To Reproduce

Steps to reproduce the behavior:

Expected behavior

no warning

Link to runnable example or repository (highly encouraged)

UI Kitten and Eva version

Package Version
@eva-design/eva 4.4.0
@ui-kitten/components 4.4.0

Environment information

npx: installed 1 in 7.037s

  System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
  Binaries:
    Node: 11.10.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 23.0.3, 25.0.2, 25.0.3, 26.0.1, 27.0.3, 28.0.0, 28.0.3, 29.0.0, 29.0.1, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
@artyorsh
Copy link
Collaborator

artyorsh commented Apr 26, 2020

@SimonHausdorf sorry for the late reply.
Just checked this and yes. Sorry for such issue. For v4 you can use:

const IconProvider = (source) => ({
  toReactElement: ({ animation, ...props }) => (
    <Avatar {...props} source={source} />
  ),
});

or, if you want modify style somehow:

const IconProvider = (source) => ({
  toReactElement: ({ animation, ...props }) => (
    <Avatar {...props} style={[props.style, { backgroundColor: props.tintColor }]} source={source} />
  ),
});

Thanks for reporting 👍

@artyorsh artyorsh mentioned this issue Apr 26, 2020
2 tasks
@artyorsh artyorsh linked a pull request Apr 26, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants