Tried both ways to show Icon:
- with
import { Icon } from 'react-native-elements'
- with
import Icon from 'react-native-vector-icons/FontAwesome'
Dependencies
import { Icon } from 'react-native-elements'
import { Icon } from 'react-native-elements'
<Icon
raised
name='heartbeat'
type='font-awesome'
color='#f50'
onPress={() => console.log('hello')} />
import Icon from 'react-native-vector-icons/FontAwesome'
import Icon from 'react-native-vector-icons/FontAwesome';
import { Input } from 'react-native-elements';
<Input
placeholder='INPUT WITH CUSTOM ICON'
leftIcon={
<Icon
name='user'
size={24}
color='black'
/>
}
/>
Also CheckBox shows an X instead of the usual
<CheckBox
title="Remember me"
checked={false}/>
Showing:
What I tried
- Edit app/build.gradle for manual linking
react-native-vector-icons
- I didn't understand this, do I have to download and load my icons/assets inside my project manually?
Solved
Solved by manually copying their folder with all the ttf inside android/app/src/main/assets/fonts
as said here
CodePudding user response:
I don't know much about elements, but for the vector icons, you just have to write like that :
import FontAwesome from 'react-native-vector-icons/FontAwesome'
then
<FontAwesome name="user" size={24} style={{color:'black'}} />
CodePudding user response:
If its on android you have to follow the following steps:
go into android/app/build.gradle
and paste the below line at top.
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
After that you have to npx react-native run-android and it will show the icons.