Update index.js

修改iOS上图表无法显示bug
This commit is contained in:
Mar-er 2019-04-08 16:32:44 +08:00 committed by GitHub
parent 2b222c123f
commit 584acc1b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -22,6 +22,7 @@ export default class App extends Component {
} }
render() { render() {
const source = Platform.OS === 'ios' ? require('./tpl.html') : {uri: 'file:///android_asset/tpl.html'}
return ( return (
<View style={{flex: 1, height: this.props.height || 400,}}> <View style={{flex: 1, height: this.props.height || 400,}}>
<WebView <WebView
@ -34,8 +35,7 @@ export default class App extends Component {
}} }}
scalesPageToFit={Platform.OS !== 'ios'} scalesPageToFit={Platform.OS !== 'ios'}
originWhitelist={['*']} originWhitelist={['*']}
// source={require('./tpl.html')} source={source}
source={{uri: 'file:///android_asset/tpl.html'}}
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null} onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
/> />
</View> </View>