Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

ReactNative WebView doesn't load in a ternary

$
0
0

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.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>