0

i try to use @shoutem/ui in my project! i have one Component with Webview and one View inside! I want design it like: Webview full screen, when scroll to end WebView i want see View, then i try to used ScrollView then put WebView and View inside, here is my code:

  <ScrollView >
          <Screen styleName="paper">
            <WebView
              style={{
                backgroundColor: '#fff',
                flex: 1,
              }}
              ref="myWebView"
              renderLoading={this.renderLoading}
              source={{ uri: this.state.rowdata.urlView }}
            />
          </Screen>

          <View styleName="horizontal space-between h-center" >
            <Button>
              <Icon name="like" />
            </Button>
            <TextInput
              placeholder={'Enter comment..'}
            />
            <Button>
              <Icon name="activity" />
            </Button>
          </View>
        </ScrollView>

But i think i wend wrong in some where! Here is my result: enter image description here

Please help me fix this! Thanks guys so much

Chu Việt Hưng
  • 141
  • 1
  • 1
  • 8

2 Answers2

2

WebView automatically resizes itself, which means it'll shrink itself to nothingness if put inside a ScrollView component. WebView will show up fine if you give it a specific size:

  <ScrollView style={{flex: 1}}>
    <WebView source={src} style={{height: 250}}/>
  </ScrollView>

You can find out a more detailed explanation of how ScrollView child components work here.

0

Something like this works as long as you can get height of webview before loading

<ScrollView style={{ height:1000}}>
        <WebView
        style={ { height:700} }
        javaScriptEnabled={true}
            domStorageEnabled={true}
        
            source={{uri:"https://www.facebook.com" }}
            scrollEnabled={false}
        />
        <WebView
        style={ { height:700} }
            javaScriptEnabled={true}
            domStorageEnabled={true}
        
            source={{uri:"https://www.facebook.com" }}
            scrollEnabled={false}
        />
        <View/>
                                    }
                                />
    </ScrollView> 
Devmaleeq
  • 541
  • 6
  • 9