when i Hardcode the username and password in the uri it works fine, the webview opens the required page and logs the user in, but when i try to append variables to the uri it does not work, it gives an error in login , the credentials are wrong.
Hardcoded and works fine:
import React, { Component } from 'react';
import { WebView,AsyncStorage } from 'react-native';
export default class Test extends Component {
async getUsername(){
var username;
try {
username = await AsyncStorage.getItem('username');
console.log('username'+username);
return username;
} catch (error) {
// Error retrieving data
username ="";
console.log('username'+username);
return username;
}
}
async getPassword(){
var password;
try {
password = await AsyncStorage.getItem('password');
console.log('password'+password);
return password;
} catch (error) {
// Error retrieving data
password="";
return password;
}
}
render() {
let pic = {
  uri: 'http://www.userlogin.php?username=react&password=react@123'
   };
return (
  <WebView
    automaticallyAdjustContentInsets={false}
    scalesPageToFit={false}
    source={{uri:pic.uri}}
  />
);
Used Variables does not work:
    import React, { Component } from 'react';
    import { WebView,AsyncStorage } from 'react-native';
    export default class Test extends Component {
    async getUsername(){
    var username;
    try {
    username = await AsyncStorage.getItem('username');
    console.log('username'+username);
    return username;
    } catch (error) {
    // Error retrieving data
    username ="";
    console.log('username'+username);
    return username;
    }
    }
    async getPassword(){
    var password;
    try {
    password = await AsyncStorage.getItem('password');
    console.log('password'+password);
    return password;
    } catch (error) {
    // Error retrieving data
    password="";
    return password;
    }
    }
    render() {
    var usr=this.getUsername();
    var pass=this.getPassword();
    let pic = {
      uri: 'http://userlogin.php?username='+usr+'&password='+pass
       };
    return (
      <WebView
        automaticallyAdjustContentInsets={false}
        scalesPageToFit={false}
        source={{uri:pic.uri}}
      />
    );
  }
 
     
     
    