Skip to content

[android] react native 0.43 webview issue display blank?? #13627

Description

@gongchao
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  WebView,
  TouchableOpacity
} from 'react-native';

export default class testapp extends Component {

  constructor(props) {
    super(props)
    this.state = {
      tab: 0
    }
  }

  render() {
    return (
      <View style={styles.container}>
        <View style={{flex: 1, paddingTop: 30, paddingLeft: 30}}>
          <TouchableOpacity onPress={()=>this.setState({tab: this.state.tab ? 0 : 1})}><Text>切换</Text></TouchableOpacity>
          <Text>{this.state.tab}</Text>
        </View>
        {!!this.state.tab && (
          <WebView source={{uri: 'http://www.google.com'}} style={{ width: 200, height: 200 }}/>
        )}
        {!this.state.tab && (
          <WebView source={{uri: 'http://www.google.com'}} style={{ width: 200, height: 200 }}/>
        )}
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'row',
    backgroundColor: '#F5FCFF',
  }
});

AppRegistry.registerComponent('testapp', () => testapp);

上边代码,点击 切换 tab

如果点击速度快的话,webview 会不显示,只在 android 是这样子。

并且没有任何报错信息

android 6/5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions