react-native-autoheight-webview icon indicating copy to clipboard operation
react-native-autoheight-webview copied to clipboard

Some Sites's height is 0

Open jihokim2 opened this issue 5 years ago • 11 comments

Bug description: Height is always 0 To Reproduce: Test below Url Source (static HTML or url): url : https://recruit.kccworld.info/menu/menuDetail.do?lSeq=885

  <AutoHeightWebView
    source={{uri: https://recruit.kccworld.info/menu/menuDetail.do?lSeq=885}}
    style={{width: Dimensions.get('window').width - 40}}
    scrollEnabled={true}
    viewportContent={'width=device-width, user-scalable=no'}
    onSizeUpdated={(size) => {
      console.log(size);
    }}
  />

Expected behavior: Height is not 0 and draw all contents. Environment:

  • OS: Android
  • OS version: 9
  • react-native version: 0.63.3
  • react-native-webview version: 10.10.2
  • react-native-autoheight-webview version: 1.5.7

jihokim2 avatar Nov 18 '20 05:11 jihokim2

Same issue, looks like the height is calculated correctly and then again to 0 :

image

sylvainbaronnet avatar Jan 04 '21 14:01 sylvainbaronnet

ok so for me if the height is equal or greater than 924px, the content is hidden, if I set it to 923 or less I see the content. This number depend on device viewport...

sylvainbaronnet avatar Jan 04 '21 18:01 sylvainbaronnet

same issue. for me content becomes invisible after 872

KhubaibQaiser avatar Feb 11 '21 16:02 KhubaibQaiser

[Solved] Solved by adding prop androidLayerType="hardware"

KhubaibQaiser avatar Feb 11 '21 17:02 KhubaibQaiser

[Solved] Solved by adding prop androidLayerType="hardware"

Still same though I added this prop... :(

oikkoikk avatar May 02 '21 13:05 oikkoikk

Make sure that you are not calling stopLoading() while loading html content.

sachin-salian avatar Jul 30 '21 09:07 sachin-salian

[Solved] Solved by adding prop androidLayerType="hardware"

Still same though I added this prop... :(

Dear @oikkoikk

Please tell me if I can fix this error. How to fix it

thainm80 avatar Oct 05 '21 01:10 thainm80

@jihokim2 https://recruit.kccworld.info/menu/menuDetail.do?lSeq=885 shows 404 now. @oikkoikk Please provide source html/uri.

iou90 avatar Nov 23 '21 09:11 iou90

@iou90 I am having this issue as well. It only happens when I first open that screen though. To provide context, I am using this to show some local HTML, and that can change as the user clicks what is essentially a "Next" button.

Whenever the HTML changes, then yes, the Auto-Height part triggers and works amazingly. But I cannot for the life of me get this to auto-height that first initial time opening screen.

Any direction or insight would be appreciated.

Bellarose143 avatar Jul 07 '23 20:07 Bellarose143

I fixed it by adding minHeight:

<AutoHeightWebView
  style={{ minHeight: 1 }}
  ...
/>

thomascwo avatar Feb 15 '24 15:02 thomascwo