I am using a ternary to display my created view and to display a WebView. But when I want to load my WebView I have a blank screen.
The code :
export default class TabThreeScreen2 extends React.Component { async googleBtn() { var urlGmail:string; var userToken:string = await SecureStore.getItemAsync("userToken"); axios("http://" + Ip.ip_addr +":8080/area-create/gmail/init?userToken=" + userToken +"&redirectURI=://area") .then(res => { console.log("Get Link Gmail"); console.log(res); urlGmail = res.data.link console.log("URL = "+urlGmail); this.setState({ url: urlGmail }); }); } render() { return ( !this.state.url ?<View style={styles.container}><Text style={styles.title}>Connection Button</Text><View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" /><GoogleSocialButton onPress={() => {this.googleBtn()}} buttonText={this.state.gmailTxt}/></View> :<View> {/* <Text style={styles.title}>{ this.state.url }</Text> */}<WebView source={{ uri: this.state.url }} /></View> ); }}
I got the URL afer doing an axios request, and I stock it in a state. The URL is correctly stock and the URL is working.
For the WebView I'm using this.
More Information : I create this ReactNative project with Expo and the Tabs(TypeScript) template.