Merge pull request #1 from Mar-er/patch-1

Update index.js
This commit is contained in:
phantom 2019-04-08 06:58:17 -05:00 committed by GitHub
commit d7340b8e78
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>