2017-10-29 4 views
0

어떤 이유로 든 반응이있는 웹보기가 전혀 표시되지 않습니다. 내 텍스트 필드 뒤에 아무 것도 나타나지 않습니다. 여기 내 코드가반응 네이티브 웹보기가 나타나지 않습니다.

import React, { Component } from 'react'; 


import { 
View, 
Text, 
WebView, 

} from 'react-native'; 


export default class Home extends Component { 

    render() { 
     return (
     <View style={{flexDirection:'column'}}> 
      <Text>Show webview</Text> 
      <WebView source={{html:"<html><body style='color:red'>Hello<br/>This is a test</body></html>"}} style={{width:200,height:200,backgroundColor:'blue',marginTop:20}} /> 
     </View> 
     ); 
    } 
} 

내가 뭘 잘못하고 있니?

답변

0

<View /> 구성 요소에 flex: 1을 추가하십시오.

<View style={{flex: 1, flexDirection:'column'}}> 
    <Text>Show webview</Text> 
    <WebView source={{html:"<html><body style='color:red'>Hello<br/>This is a test</body></html>"}} style={{width:200,height:200,backgroundColor:'blue',marginTop:20}} /> 
</View> 

Here's a demo

+0

나는 당신은보기에 적용해야하는 이유를 말해 줄 수, 여전히 플렉스에 새로 온 사람? 나는 무엇이든 그것이 Text와 WebView에 적용되어야한다고 생각했다. – John

관련 문제