简体   繁体   English

反应本机矢量图标

[英]React Native Vector Icons

I am working on developing a mobile app and want to add a react native vector icon component.我正在开发一个移动应用程序,并希望添加一个 react 本机矢量图标组件。 The problem is that the icon is not showing up--it seems to be invisible.问题是图标没有显示出来——它似乎是不可见的。 It know it is there because it is influencing a nearby element that shares the same flexbox.它知道它在那里,因为它正在影响共享相同 flexbox 的附近元素。

Here are the imports:以下是进口:

import React from "react";
import { Image, Text, View, Pressable } from "react-native";
import Icon from "react-native-vector-icons/Ionicons";
import { styles } from "./styles";

And here is the specific place in my code where I'm introducing the Icon这是我在代码中引入 Icon 的特定位置

<Icon name="checkbox-outline" size={40} color='black'/>

As well as the broader "Post" function in which it's used以及使用它的更广泛的“发布”功能

postFunction后函数

To give some context, this function is for a "post" that one would see on a "feed".为了提供一些上下文,此功能用于人们会在“提要”上看到的“帖子”。 Think of Twitter or Instagram.想想 Twitter 或 Instagram。

Here is also a screenshot of what the result looks like when this post function is called multiple times.这也是多次调用此 post 函数时结果的屏幕截图。 Notice that the Icon should be showing up at the bottom left corner of each post.请注意,图标应显示在每个帖子的左下角。 And the button (which has row flex of 1) is not covering the entire width indicating the Icon is present but not visible.并且按钮(其行 flex 为 1)没有覆盖整个宽度,表明图标存在但不可见。

results结果

What is going wrong?出了什么问题?

after installing React-native-vector-icons , you must always run this command :安装React-native-vector-icons 后,您必须始终运行以下命令:

react-native link反应原生链接

otherwise the icons will not appear否则不会出现图标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM