Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 图标在我的终端中消失且为空_Javascript_Reactjs_React Native_Expo - Fatal编程技术网

Javascript 图标在我的终端中消失且为空

Javascript 图标在我的终端中消失且为空,javascript,reactjs,react-native,expo,Javascript,Reactjs,React Native,Expo,多亏了你的帮助,我更新了代码。当我使用Expo启动应用程序时,我有两个错误: 1/我丢失了屏幕上未显示的扫描图标。此图标以前出现过。其想法是扫描一些条形码,以显示来自产品的相关数据。 2/在我的终端中,当使用Expo启动应用程序时,我收到以下消息:Array[],null,null 如果您能就我的问题发表意见,我将不胜感激。祝你一切顺利 这是我的新代码: import React, { useState, useEffect } from "react"; import { StyleShe

多亏了你的帮助,我更新了代码。当我使用Expo启动应用程序时,我有两个错误: 1/我丢失了屏幕上未显示的扫描图标。此图标以前出现过。其想法是扫描一些条形码,以显示来自产品的相关数据。 2/在我的终端中,当使用Expo启动应用程序时,我收到以下消息:Array[],null,null

如果您能就我的问题发表意见,我将不胜感激。祝你一切顺利

这是我的新代码:

import React, { useState, useEffect } from "react";
import {
  StyleSheet,
  Text,
  View,
  FlatList,
  Button,
  AsyncStorage,
} from "react-native";
import { useNavigation } from "@react-navigation/core";
import { TouchableOpacity } from "react-native-gesture-handler";
import { FontAwesome5 } from "@expo/vector-icons";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { ActivityIndicator } from "react-native-paper";

function ProductsScreen() {
  const navigation = useNavigation();
  const [data, setData] = useState([]);
  const [isLoading, setisLoading] = useState(true);

  useEffect(() => {
    const fetchData = async () => {
      const data = await AsyncStorage.getItem("userData");

      setData(data);
      setisLoading(false);
    };
    fetchData();
  }, []);

  console.log(data);
  return isLoading ? (
    <ActivityIndicator />
  ) : (
    <>
      {data ? (
        <FlatList
          data={dataArray}
          keyExtractor={(item) => item.name}
          renderItem={({ item }) => (
            <>
              <Text>{item.brand}</Text>

              <View style={styles.scan}>
                <MaterialCommunityIcons
                  name="barcode-scan"
                  size={40}
                  color="black"
                  onPress={() => {
                    navigation.navigate("CameraScreen");
                  }}
                />
              </View>
            </>
          )}
        />
      ) : null}
    </>
  );
}
export default ProductsScreen;
import React,{useState,useffect}来自“React”;
进口{
样式表,
文本,
看法
平面列表,
按钮
异步存储,
}从“反应本族语”;
从“@react-navigation/core”导入{useNavigation}”;
从“反应本机手势处理程序”导入{TouchableOpacity};
从“@expo/vector icons”导入{FontAwesome5}”;
从“@expo/vector icons”导入{MaterialCommunityIcons}”;
从“react native paper”导入{ActivityIndicator};
函数ProductsScreen(){
const navigation=useNavigation();
const[data,setData]=useState([]);
const[isLoading,setisLoading]=useState(true);
useffect(()=>{
const fetchData=async()=>{
const data=await AsyncStorage.getItem(“userData”);
setData(数据);
设置加载(假);
};
fetchData();
}, []);
控制台日志(数据);
返回卸载(
) : (
{数据(
item.name}
renderItem={({item})=>(
{item.brand}
{
导航。导航(“摄像机屏幕”);
}}
/>
)}
/>
):null}
);
}
导出默认产品屏幕;

你能再解释一下吗?在创建Asyncstroge设置项时遇到问题?如果矢量图标不可见

反应本地运行的android


您可以尝试执行npm启动--重置缓存。

您能再解释一下吗?在创建Asyncstroge设置项时遇到问题?如果矢量图标不可见

反应本地运行的android


您可以尝试执行npm启动--重置缓存。

这不是答案,而是一条评论,请访问并查看。感谢您的留言。我无法比我共享的代码更明确。这不是答案,而是一条评论,请访问并检查。谢谢您的消息。我不能比我共享的代码更明确。