Реагировать на собственный код ошибки Код AppEntry Bundle требуется .. js: 322: 6 - PullRequest
0 голосов
/ 31 марта 2020

Я не уверен, что означает этот код ошибки. Я искал вокруг, чтобы понять это, чтобы я мог решить проблему, но мне просто нужно знать, что это значит, чтобы я мог go в свой код, чтобы исправить это. В настоящее время я работаю над подключением базы данных локального хоста, которая у меня есть на mySql, к коду, чтобы добавить функциональность входа в систему. введите описание изображения здесь

Вот код, над которым я работал

логин. php

<?php 

include 'DBConfig.php';

$con = mysqli_connect($HostName,$HostUser,$HostPass,$DatabaseName);

    $json = file_get_contents('php://input');   
    $obj = json_decode($json,true);

    $email = $obj['email'];

    $password = $obj['password'];

    if($obj['email']!=""){  

    $result= $mysqli->query("SELECT * FROM wp_hootbr.wp_ak_users where email='$email' and password='$password'");

        if($result->num_rows==0){
            echo json_encode('Wrong Details');              
        }
        else{       
        echo json_encode('ok');             
        }
    }   
    else{
      echo json_encode('try again');
    }

?>

DBConfig. php

<?php

//Define your host here.
$HostName = "localhost";

//Define your database name here.
$DatabaseName = "wp_hootbr";

//Define your database username here.
$HostUser = "root";

//Define your database password here.
$HostPass = "Pokemon#15";

?>

LoginScreen. js

import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import {
  Image,
  Input, 
  Platform,
  Button,
  ScrollView,
  StyleSheet,
  Text,
  TextInput,
  TouchableOpacity,
  View,
} from 'react-native';

import { MonoText } from '../components/StyledText';
import { StackNavigator } from 'react-navigation';

class LoginScreen extends Component {

  // Setting up Login Activity title.
  static navigationOptions =
   {
      title: 'LoginScreen',
   };

constructor(props) {

    super(props)

    this.state = {

      email: '',
      password: ''

    }

  }
  UserLoginFunction = () =>{

    const { email }  = this.state ;
    const { password }  = this.state ;


   fetch('https://reactnativecode.000webhostapp.com/User_Login.php', {
     method: 'POST',
     headers: {
       'Accept': 'application/json',
       'Content-Type': 'application/json',
     },
     body: JSON.stringify({

       email: email,

       password: password



     })

   }).then((response) => response.json())
         .then((responseJson) => {

           // If server response message same as Data Matched
          if(responseJson === 'Data Matched')
           {

               //Then open Profile activity and send user email to profile activity.
               this.props.navigation.navigate('Second', { email: email });

           }
           else{

             Alert.alert(responseJson);
           }

         }).catch((error) => {
           console.error(error);
         });

     }
}
export default function LinksScreen() {

  return (
    <View style={styles.container}>
      <ScrollView
        style={styles.container}
        contentContainerStyle={styles.contentContainer}>
        <View style={styles.welcomeContainer}>
          <Image
            source={
              __DEV__
                ? require('../assets/images/HootLogo.png')
                : require('../assets/images/robot-prod.png')
            }
            style={styles.welcomeImage}
          />
        </View>

        <View style={styles.container}>
          <Text style={styles.headerText}>email</Text>

          <TextInput
            placeholder= "email"
            onChangeText={email => this.setState({email})}
            placeholderTextColor = 'rgba(96,100,109, 1)'
            returnKeyType = "next"
            autoCapitalize = "none"
            autoCorrect = {false}
            style={styles.input}
          />

          <View style={styles.container}>
              <Text style={styles.headerText}>Password</Text>
          </View>

          <TextInput
            placeholder= "password"
            onChangeText={password => this.setState({password})}
            placeholderTextColor = 'rgba(96,100,109, 1)'
            returnKeyType = "go"
            secureTextEntry
            style={styles.input}
          />
<Button title="Click Here To Login" onPress={this.UserLoginFunction} color="#2196F3" />


          <TouchableOpacity onPress={handleHelpPress} style={styles.forgotLink}>
            <Text style={styles.forgotText}>Forgot password?</Text>
          </TouchableOpacity>

          <TouchableOpacity style={styles.buttonContainer}>
            <Text style={styles.buttonText}>Log In</Text>
          </TouchableOpacity>

          <View style={styles.helpContainer}>
            <DevelopmentModeNotice />
          </View>

        </View> 
      </ScrollView>
    </View>
  );
}

function handleLearnMorePress() {
  WebBrowser.openBrowserAsync(
    'https://docs.expo.io/versions/latest/workflow/development-mode/'
  );
}

function handleHelpPress() {
  WebBrowser.openBrowserAsync(
    'https://docs.expo.io/versions/latest/workflow/up-and-running/#cant-see-your-changes'
  );
}

function DevelopmentModeNotice() {
  if (__DEV__) {
    const learnMoreButton = (
      <Text onPress={handleLearnMorePress} style={styles.helpLinkText}>
        Register
      </Text>
    );

    return (
      <Text style={styles.developmentModeText}>
        Don't have an account?  {learnMoreButton}
      </Text>
    );
  } else {
    return (
      <Text style={styles.developmentModeText}>
        You are not in development mode: your app will run at full speed.
      </Text>
    );
  }
}

LinksScreen.navigationOptions = {
  title: 'Links',
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
  },

  contentContainer: {
    paddingTop: 30,
  },

  welcomeContainer: {
    alignItems: 'center',
  },

  welcomeImage: {
    width: 250,
    height: 230,
    resizeMode: 'contain',
    marginLeft: -10,
  },
  headerText: {
    fontSize: 20,
    color: 'rgba(96,100,109, 1)',
    lineHeight: 24,
    marginLeft: 50,
    marginBottom: 15,
  },

  input: {
    height: 40,
    borderBottomColor: 'rgba(0,0,0,0.4)',
    borderBottomWidth: 3,
    padding: 10,
    marginBottom: 10,
    marginHorizontal: 50,
  },

  forgotLink: {
    marginRight: 50,
    marginBottom: 10
  },

  forgotText: {
    fontSize: 13,
    color: 'rgba(96,100,109, 1)',
    textAlign: 'right'
  },

  buttonContainer: {
    backgroundColor: '#78AA3A',
    padding: 15,
    marginTop: 10,
    marginHorizontal: 50,
    borderColor: '#fff',
    borderRadius:10,
    borderWidth: 1,
  },

  buttonText: {
    textAlign: 'center',
    color: '#FFFFFF',
  },

  developmentModeText: {
    marginBottom: 20,
    color: 'rgba(0,0,0,0.4)',
    fontSize: 14,
    lineHeight: 19,
    textAlign: 'center',
  },

  helpContainer: {
    marginTop: 10,
    alignItems: 'center',
  },

  helpLink: {
    paddingVertical: 15,
  },

  helpLinkText: {
    fontSize: 14,
    color: '#78AA3A',
  },
});

AccountScreen. js

import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import LoginScreen from '../screens/LoginScreen';
import {
  Input,
  Image,
  Linking, 
  Platform,
  Button,
  SafeAreaView,
  ScrollView,
  StyleSheet,
  Text,
  TextInput,
  TouchableOpacity,
  View,
  TouchableWithoutFeedback,
} from 'react-native';

import { MonoText } from '../components/StyledText';


export default function AccountScreen() {
  return (
    <View style={styles.container}>
      <ScrollView
        style={styles.container}
        contentContainerStyle={styles.contentContainer}>

          <View style={styles.headerContainer}>
            <View style={styles.photoContainer}>
              <Image
              source={
                __DEV__
                  ? require('../assets/images/addPhoto.png')
                  : require('../assets/images/robot-prod.png')
              }
              style={styles.photoImage}/> 
              <TouchableOpacity style={styles.photoButtonContainer}>
                <Text style={styles.photoButtonText}>Change Photo</Text>
              </TouchableOpacity>
            </View>

            <View style={styles.nameContainer}>
              <Text style={styles.nameText}>First Name</Text>
              <Text style={styles.nameText}>Last Name</Text>
            </View>
          </View>

          <View style={styles.bodyContainer}>
            <Text style={styles.bodyText}>User Name</Text>
          </View>

          <View style={styles.emailContainer}>
          <Text style = {styles.TextComponentStyle}> { this.props.navigation.state.params.Email } </Text>

            <TouchableOpacity style={styles.emailButtonContainer}>
              <Text style={styles.emailButtonText}>Change Email</Text>
            </TouchableOpacity>
          </View>

          <View style={styles.bodyContainer}>
            <Text style={styles.bodyText}>Store Name</Text>
          </View>

          <TouchableOpacity style={styles.buttonContainer}>
            <Text style={styles.buttonText}>Settings</Text>
          </TouchableOpacity>

          <Button title="Click here to Logout" onPress={ () => goBack(null) } />

      </ScrollView>
    </View>
  );
}


AccountScreen.navigationOptions = {
  header: null,
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
  },

  contentContainer: {
    paddingTop: 30,
  },

  headerContainer: {
    marginTop: 30,
    marginBottom: 10,
    flexDirection: 'row',
    }, 

  headerPhoto: {
    marginTop: 30,
    marginBottom: 10,
    flexDirection: 'column',
  }, 

  photoImage: {
    width: 150,
    height: 150,
    resizeMode: 'contain',
    marginTop: 10,
    marginLeft: 20,
  },

  photoButtonContainer: {
    backgroundColor: '#6D5645',
    marginTop: 10,
    marginLeft: 30,
    marginRight: 30,
    padding: 15,
    borderColor: '#fff',
    borderRadius:10,
    borderWidth: 1,
  },

  photoButtonText: {
    textAlign: 'center',
    color: '#FFFFFF',
    fontSize: 15
  },

  nameContainer: {
    marginTop: 20,
    flexDirection: "column",
  },

  nameText: {
    paddingTop: 15,
    padding: 20,
    fontSize: 20,
    color: 'rgba(96,100,109, 1)',
    lineHeight: 24,
  },

  bodyContainer: {
    marginHorizontal: 5,
  },

  bodyText: {
    paddingTop: 15,
    padding: 20,
    fontSize: 20,
    color: 'rgba(96,100,109, 1)',
    lineHeight: 24,
    textAlign: 'left',
  },

  emailContainer: {
    marginHorizontal: 5,
    flexDirection: 'row',
  },

  emailText: {
    paddingTop: 15,
    padding: 20,
    fontSize: 20,
    color: 'rgba(96,100,109, 1)',
    lineHeight: 24,
    textAlign: 'left',
  },

  emailButtonContainer: {
    backgroundColor: '#6D5645',
    padding: 25,
    marginHorizontal: 20,
    borderColor: '#fff',
    borderRadius:10,
    borderWidth: 1,
  },

  emailButtonText: {
    textAlign: 'center',
    color: '#FFFFFF',
    fontSize: 15
  },

  buttonContainer: {
    backgroundColor: '#78AA3A',
    padding: 15,
    marginTop: 20,
    marginHorizontal: 50,
    borderColor: '#fff',
    borderRadius:10,
    borderWidth: 1,
  },

  buttonText: {
    textAlign: 'center',
    color: '#FFFFFF',
    fontSize: 15
  },
});

1 Ответ

0 голосов
/ 31 марта 2020

Пожалуйста, исправьте это, вы забыли импортировать Компонент

import React, { Component } from "react"; //import Component

class LoginScreen extends Component 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...