无法识别我的本机项目Firebase模块中的问题

时间:2019-09-29 19:18:41

标签: firebase react-native

  • 我将firebase安装到了我的项目文件夹中,并且可以在node modules文件夹中看到它,但是当我尝试从“ firebase”导入firebase时,仍然没有发生
  • 我不知道为什么要卸载并重新安装
  • 我搜索了此问题,但找不到解决方案,就像根本不存在firebase模块一样
  • 我什至重新启动了计算机
  • 我什至无法初始化App
  • 我也尝试过更改进口行
    import React from 'react'

    import {
      View,
      Button,
      TextInput,
      StyleSheet,
      Image,
    } from 'react-native'
    // import firebase from 'firebase';
    import * as firebase from 'firebase'
    const firebaseConfig={
      apiKey: "AIzaSyCDh998mIGLdyHaE3EK5tRnhLY-I7jiPOY",
      authDomain: "shiftorgnaizer.firebaseapp.com",
      databaseURL: "https://shiftorgnaizer.firebaseio.com",
      projectId: "shiftorgnaizer",
      storageBucket: ""
    };




    export default class SignUp extends React.Component {



      state = {
        username: '', password: '', email: '', phone_number: ''
      }
      onChangeText = (key, val) => {
        this.setState({ [key]: val })
      }
      signUp = async () => {
        const { username, password, email, phone_number } = this.state
      }


      render() {
        return (
          <View style={styles.container}>
            <Image source={require('./Images/allImages.jpg')}
            style={{width: 150,height: 100}}/>
            <TextInput
              style={styles.input}
              placeholder='Username'
              autoCapitalize="none"
              placeholderTextColor='white'
              onChangeText={val => this.onChangeText('username', val)}
            />
            <TextInput
              style={styles.input}
              placeholder='Password'
              secureTextEntry={true}
              autoCapitalize="none"
              placeholderTextColor='white'
              onChangeText={val => this.onChangeText('password', val)}
            />
            <TextInput
              style={styles.input}
              placeholder='Email'
              autoCapitalize="none"
              placeholderTextColor='white'
              onChangeText={val => this.onChangeText('email', val)}
            />
            <TextInput
              style={styles.input}
              placeholder='Phone Number'
              autoCapitalize="none"
              placeholderTextColor='white'
              onChangeText={val => this.onChangeText('phone_number', val)}
            />
            <Button
              title='Sign Up'
              onPress={this.signUp}
            />
          </View>
        )
      }
    }

    const styles = StyleSheet.create({
      input: {
        width: 350,
        height: 55,
        backgroundColor: '#42A5F5',
        margin: 10,
        padding: 8,
        color: 'white',
        borderRadius: 14,
        fontSize: 18,
        fontWeight: '500',
      },
      container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center'
      }
    })

希望能够识别该模块并使用Firebase

0 个答案:

没有答案