首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android上运行React-Native应用程序显示"Object is not iterable“

在android上运行React-Native应用程序显示"Object is not iterable“
EN

Stack Overflow用户
提问于 2021-04-06 17:00:46
回答 1查看 39关注 0票数 0

运行react原生android应用程序,在模拟器上显示以下输出。你知道怎么解决这个问题吗?

EN

Stack Overflow用户

发布于 2021-04-06 22:17:00

代码语言:javascript
复制
import React, { Component } from "react";
import { AppRegistry, Dimensions, ActivityIndicator, AsyncStorage, View, StyleSheet, StatusBar } from "react-native";
import { createAppContainer, createSwitchNavigator, createBottomTabNavigator } from "react-navigation"
import { createStackNavigator} from "react-navigation-stack";
import Ionicons from "react-native-vector-icons/FontAwesome";

//Components
import HomeScreen from "./app/screens/HomeScreen/homeScreen";
import MapScreen from "./app/screens/MapScreen/mapScreen";
import ProfileScreen from "./app/screens/ProfileScreen/profileScreen";
import LoginScreen from "./app/screens/LoginScreen/loginScreen";
import ChatListScreen from "./app/screens/ChatListScreen/chatListScreen";
import SignupScreen from "./app/screens/SignupScreen/signupScreen";
import NotificationScreen from "./app/screens/NotificationScreen/notificationScreen";
import ForgotPasswordScreen from "./app/screens/ForgotPasswordScreen/forgotPasswordScreen";
import NewPostScreen from "./app/screens/NewPostScreen/NewPostScreen";
import MessageScreen from "./app/screens/MessaginScreen/messaginScreen";
//Screen names
import { Home, Info, DetailView, Login } from "./app/screens/index";
//Screen size
var {height, width} = Dimensions.get("window");


class AuthLoadingScreen extends Component {
  constructor() {
    super();
    this._bootstrapAsync();
  }

  _bootstrapAsync = async () => {
    const userToken = await AsyncStorage.getItem("userToken");

    this.props.navigation.navigate(userToken ? "Auth" : "Auth");
  };

  render() {
    return (
      <View style={styles.container}>
        <ActivityIndicator/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
});

const AppStack = createBottomTabNavigator(
  {
    Home: { screen: HomeScreen },
    Messages : { screen: ChatListScreen },
    Map : { screen: MapScreen },
    Notifications : { screen: NotificationScreen },
    Profile: { screen: ProfileScreen }    
  },
  {
    defaultNavigationOptions: ({ navigation }) => ({
      tabBarIcon: ({ focused, tintColor }) => {
        const { routeName } = navigation.state;
        let iconName;
        if (routeName === "Home") {
          iconName = "home";
        } else if (routeName === "Messages") {
          iconName = "comment";

        } else if (routeName === "Map") {
          iconName = "map";
        
        } else if (routeName === "Notifications") {
          iconName = "bell";
        
        } else if (routeName === "Profile") {
          iconName = "user";
        }
        return <Ionicons name={iconName} size={25} color={tintColor} />;
      },
    }),
    tabBarOptions: {
      activeTintColor: "#3d9bf9",
      inactiveTintColor: "gray",
    },
  }  
);

const AuthStack = createStackNavigator(
  {
      Login:{
          screen:LoginScreen
      },
      Signup:{
          screen:SignupScreen
      },
      ForgotPassword:{
        screen:ForgotPasswordScreen
      },
      NewPost:{ 
        screen:NewPostScreen
      },
      MessageView:{ 
        screen:MessageScreen
      },
      App:{
        screen:AppStack
      }        
  },{
      initialRouteName:"Login", 
      mode: 'modal',       
      headerMode:"none"
  }
)

const AppContainer = createAppContainer(AuthStack);
export default AppContainer;
票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66965639

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档