Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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
Reactjs 不变冲突:元素类型无效_Reactjs_React Native - Fatal编程技术网

Reactjs 不变冲突:元素类型无效

Reactjs 不变冲突:元素类型无效,reactjs,react-native,Reactjs,React Native,我试图通过使用样式表来清理我的样式,但我似乎无法让它工作。我相信错误(如下所示)是在我尝试创建样式表(constyles=EStyleSheet.create 注意,我使用的是react native的样式表,但这不是问题所在。 这是错误的图片: 这是我的代码: import React, { Component } from "react"; import { View, Text, Button, Image, StyleSheet, TextInput, Ke

我试图通过使用样式表来清理我的样式,但我似乎无法让它工作。我相信错误(如下所示)是在我尝试创建样式表(
constyles=EStyleSheet.create

注意,我使用的是react native的样式表,但这不是问题所在。 这是错误的图片:

这是我的代码:

import React, { Component } from "react";

import {
  View,
  Text,
  Button,
  Image,
  StyleSheet,
  TextInput,
  KeyboardAvoidingView,
  TouchableOpacity
} from "react-native";

export default class Login extends Component {
  render() {
    return (
      <View style={styles.wrapper}>
        <Text>Login screen </Text>

        <KeyboardAvoidingView behavior="padding" style={styles.loginContainer}>

          <TextInput
          placeholder="username or email"
          placeholderTextColor='whitesmoke'
          style={styles.input}
          />

          <TextInput
          placeholder="password"
          secureTextEntry
          placeholderTextColor='whitesmoke'
          style={styles.input}
          />

          <TouchableOpacity style={styles.loginbutton} onPress={() => this.props.navigation.navigate("Grades")}>
            <Text style={{
              textAlign: 'center',
              color: "whitesmoke",
              fontWeight: '700',
            }}>
            Login
            </Text>
          </TouchableOpacity>

        </KeyboardAvoidingView>

      </View>
    );
  }
}

const styles = StyleSheet.create({
  loginContainer: {
    paddingHorizontal: 9,
    backgroundColor: "red"
  },

  input: {
      paddingHorizontal: 10,
      marginBottom: 10,
      color: '#f1c40f', //sunflower color
      backgroundColor: '#3498db',
    },

 logo: {
    width: 231,
    height: 231
  },

  wrapper: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center" 
  }

});
请随时要求我附加任何附加信息。

提前感谢您的帮助。

为了修复我的错误,我刚刚重新克隆了repo,并添加回我编写的所有代码。
谢天谢地,我没有将此错误推送到主分支。
这修复了错误


*注意:在这个过程中,我去掉了react原生扩展样式表,所以这可能是错误的原因。

导入语句中的样式表后缺少一个逗号。这在代码中是相同的,还是仅仅在问题中?哇!这只是在我的问题中。请添加应用程序输入组件,例如app.js抱歉等待。I添加到我的app.js和router.js中。(我正在使用react导航)
import React from "react";
import { Font } from "expo";

import { Root } from "./app/router";
import { FontError } from "./app/components/fontError";

export default class App extends React.Component {
  state = {
    fontLoaded: false
  };
  async componentDidMount() {
    await Font.loadAsync({
      Arial: require("./app/resources/Arial.ttf")
    });
    this.setState({ fontLoaded: true });
  }
  render() {
    if (!this.state.fontLoaded) return <FontError/>;
    return <Root />;
  }
  // ...
}
import React, { Component } from "react";
import { createStackNavigator } from "react-navigation";

import {
  Login,
  Grades,
} from "./screens";

export const Root = createStackNavigator({
  Login: {screen: Login},
  Grades: {screen: Grades},

});