How to use icon in button?
See original GitHub issue💬 Question
UI Kitten and Eva version
Package | Version |
---|---|
@eva-design/eva | 1.3.2 |
@ui-kitten/components | 4.3.2 |
File 1: MyIcons.js
import React from 'react';
import { Icon } from '@ui-kitten/components';
export default FacebookIcon = (style) => (
<Icon name='facebook' {...style} />
);
File 2: Login Screen
import React, {Component} from 'react';
import {AsyncStorage, ScrollView, View, StyleSheet} from 'react-native';
import {LOGIN} from "../api/endpoints";
import {Text, Button, Input, Layout, Icon} from "@ui-kitten/components";
import axiosInstance from "../api/axiosInstance";
import FacebookIcon from '../MyIcons'
export default class LoginScreen extends Component {
render() {
const {username, password} = this.state;
return (
<Layout style={styles.container}>
<Button
style={styles.signUpButton}
textStyle={styles.signUpText}
icon={FacebookIcon} //added icon to button
size='large'
>Hello</Button>
</Layout>
)
}
}
This is not working. Right now I’m testing it on Android device.
The error get is:
**Error while updating property ‘fill’ of a view managed by: RNSVGRect
null
java.lang.Double cannot be cast to java.lang.String**
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:17
Top Results From Across the Web
How To Create Icon Buttons - W3Schools
Tip: Go to our Icons Tutorial to learn more about icons. Go to our CSS Buttons Tutorial to learn more about how to...
Read more >HTML/CSS - Adding an Icon to a button - Stack Overflow
I making some css buttons and I want to add an icon before the text, "Button Text". But I dont know how I...
Read more >How to add icons in the button in HTML ? - GeeksforGeeks
It is as simple as applying Font Awesome icon on any button. The <i> tag and <span> tag are used widely to add...
Read more >Easily Create Buttons With Icons Using HTML & CSS - YouTube
View the Code & CodePen:https://dcode.domenade.com/tutorials/easily-create- buttons -with- icons -html-and-cssIn today's video I'll be showing ...
Read more >How to Add Font Awesome Icons to Your Buttons
How to Add Font Awesome Icons to Your Buttons ... Font Awesome is a convenient library of icons. These icons can be vector...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@artyorsh huge thanks! works now. guess it’s just the version causing the issue. i didn’t use watchman. i just deleted node_modules folder and package lock then npm i and
expo start -c
. Thanks for the support!hey @artyorsh so sorry! i replied on my phone at work. yup i ran
expo init [app_name]
, and followed the documentation by runningnpm i @ui-kitten/components @eva-design/eva react-native-svg --save
.i’ve also done the necessary amendments to App.js file to import
IconRegistry
, etc. all based on the docs.What i wanted to achieve: https://akveo.github.io/react-native-ui-kitten/docs/assets/playground-build/#/InputWithIcon
Exact codes i followed from the docs:
my package.json file (how do i format this properly? it’s my first comment on the issue section on github. EDIT: I did it.):
Appreciate the help, thank you so much! P.S I’m relatively new to RN…