Значок не отображается на экране Android с использованием реагировать-родной-векторные иконки
Я новичок в реакции-родной и https://stack ru.com/images/dfcba5b7997034e03f5ceb5fe2a5275a239fa1be.png пытаюсь реализовать вкладку навигатор. Я использую реагировать родные векторные иконки. Я пытался отобразить значок на моем экране, но он не показывает мне значок. Вот что я сделал
1-npm установить реакцию-родной-векторные иконки --save
2-реагировать-нативная ссылка реагировать-нативный-векторные иконки
3-отредактированный android / app / build.gradle
project.ext.vectoricons = [
iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
4- реагировать родной запуск андроид
import React, { Component } from 'react';
import { StyleSheet, Text, View,Image,StatusBar,Button,TouchableOpacity} from 'react-native';
import { createBottomTabNavigator, createAppContainer } from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
import profile from './profile';
export class test extends Component
{ render()
{
return (
<View style={styles.container}>
<Text style={styles.text}>Test</Text>
</View>
);
}
}
export default createBottomTabNavigator({
'test':{screen:test,
navigationOption:{
tabBarLabel:'test',
tabBarIcon:({tintColor})=>(
<Icon name="rocket" color={tintColor} size={40}/>
)}},
'Profile': { screen:profile,
navigationOption:{
tabBarLabel:'profile',
tabBarIcon:({tintColor})=>(
<Icon name="rocket" color={tintColor} size={40}/>
) } }
},{
navigationOption:{
tabBarVisible:true
},
tabBarOptions:{
activeTintColor:'red',
inactiveTintColor:'grey'
}
});
const styles= StyleSheet.create({
container:{
flexGrow:1,
backgroundColor:'#1c313a',
justifyContent:'center',
alignItems:'center'
},
text:{
fontSize:25,
fontWeight:'500',
color :'#fff',
paddingHorizontal:16 ,
textAlign:'center'
}
});
https://stack ru.com/images/dfcba5b7997034e03f5ceb5fe2a5275a239fa1be.png
1 ответ
Думаю название rocket
для типа значка Ionicons
не существует Вы можете проверить это здесь
https://oblador.github.io/react-native-vector-icons/
Может быть, вы бы использовали другой тип или другое имя.