【问题标题】:React Native Firebase TypeError when importing导入时反应本机 Firebase TypeError
【发布时间】:2018-11-23 01:40:15
【问题描述】:

我正在使用 React Native 开发一个 Android 和 IOS 移动应用程序。我想为我的数据库使用 Firebase,但是当我安装 npm install --save firebase 然后我安装 import firebase from 'firebase' 时。

我会收到这个错误提示

"TypeError: undefined is not a function(evalating '_iteratortypeof 符号===“功能”? Symbol.iterator: "@@iterator"')"

这是我的输出截图

我想使用数据库为我的应用程序创建一个登录屏幕。如果将 Firebase 用于我的移动应用,任何其他建议都会有所帮助。

如果有帮助,这是我的编码。

import React from 'react';
import {
View,
Text,
StyleSheet,
Platform,
TextInput,
TouchableOpacity,
} from 'react-native';
import firebase from 'firebase';


export default class Login extends React.Component {

constructor(props) {
    super(props);
}
state = {
    email: "Enter email",
 password: "Enter password"
};





render() {
    return (
        <View style={styles.container}>
            <View style={styles.textContainer}>
                <Text style={styles.text}>Create an account below</Text>
                <TextInput
                    style={styles.textInput}
                    onChangeText={(text) => this.setState({ email: text })}
                    value={this.state.email}
                />
                <TextInput
                    style={styles.textInput}
                    onChangeText={(text) => this.setState({ password: text })}
                    value={this.state.password}
                />
                <TouchableOpacity

                >
                    <View>
                        <Text>Log In Existing</Text>
                    </View>
                </TouchableOpacity>

                <TouchableOpacity

                >
                    <View>
                        <Text>Create New User</Text>
                    </View>
                </TouchableOpacity>
            </View>
        </View>
    );
}}

【问题讨论】:

  • Outra here the content of your file that has import...

标签: firebase react-native


【解决方案1】:

编译使用的是哪个 babel 版本?所有 babel 插件和预设都应与 babel 版本匹配。 请检查 babel 版本和预设。

【讨论】:

  • 如何查看babel插件和预设版本?
  • 请检查 package.json 文件
  • 我正在使用这个“依赖项”:{“firebase”:“^5.5.9”,“react”:“16.6.0-alpha.8af6728”,“react-native”:“0.57。 3", }, "devDependencies": { "babel-jest": "23.6.0", "jest": "23.6.0", "metro-react-native-babel-preset": "0.48.1", "react-test-renderer": "16.6.0-alpha.8af6728"
  • 你必须需要 core-js。你可以找到解决方案here
猜你喜欢
  • 2018-12-08
  • 1970-01-01
  • 1970-01-01
  • 2018-09-26
  • 2019-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多