Nativebase: WebView inside of a Container->Content?

Created on 10 Aug 2016  路  13Comments  路  Source: GeekyAnts/NativeBase

Sorry if this is a silly question, just wondering if this is possible? I have a PDF I need to show, and I'm using a WebView to display it. It doesn't seem to want to render within .

Most helpful comment

I have encountered the same problem and solved it as below.

render () {
  return (
    <Container>
      <Content contentContainerStyle={{ flex: 1 }}>
        <WebView source={{ uri: 'something' }} />
      </Content>
    </Container>
  );
}

All 13 comments

@robputer Do you have a screenshot of the error? Try using the webview inside a <View /> and see if that works.

+1
Started using WebView and if I use Container-> Content it will not render, If I replace the Container and Content with the View it will render.

Related to https://github.com/facebook/react-native/issues/4773
Please specify a height for the <WebView /> component.

Hello,

I'm opening this since I want to add a WebView inside the Content and it is not displaying. If I set the height it will, but I want it full page.

Set the height to deviceheight

And then it will display over the menu / footer .. so it's not good

Minus the height of header and footer. Because that is the way react native scrollview works and native-base is just a wrapper around it.

@grohsfabian @sankhadeeproy007 I think setting the height using deviceHeight isn't a good idea. We can achieve the same thing using flex. Instead of we can just place with { flex: 1 }

It just doesn't work. I've tried to set it with { flex: 1 } but It won't show.

Any update on this?

I have encountered the same problem and solved it as below.

render () {
  return (
    <Container>
      <Content contentContainerStyle={{ flex: 1 }}>
        <WebView source={{ uri: 'something' }} />
      </Content>
    </Container>
  );
}

Thank you horiuchie!

@horiuchie In that case the Content is unscrollable :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maphongba008 picture maphongba008  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

mcpracht picture mcpracht  路  3Comments

inv2004 picture inv2004  路  3Comments

Landerson352 picture Landerson352  路  3Comments