问题描述
我在React Native中遇到的错误是一个常见的错误,但是在other questions中找到的解决方案始终是确保react组件以大写字母开头。
但是,引起问题的组件已经大写了。
在我的App.js
中引起问题的组件是:
<FontAwesomeIcon icon={faCannabis}>
完整的参考代码为:
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet,Text,View } from "react-native";
// get our fontawesome imports
import { faHome } from "@fortawesome/free-solid-svg-icons";
import { faCannabis } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
export default function App() {
return (
<View>
<Text>My APP</Text>
<Text>
<FontAwesomeIcon icon={faCannabis}></FontAwesomeIcon>
</Text>
<StatusBar style="auto" />
</View>
);
}
另一个令人困惑的部分是,当使用Expo
时,该应用程序可以在网络上正常运行,但在android或iOS上会引发常见错误
Invariant Violation: View config getter callback for component 'path' must be a function (received undefined). Make sure to start component names with a capital letter
但是它们大写了!
还有什么可能导致此问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)