Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Sites's height is 0 #187

Open
jihokim2 opened this issue Nov 18, 2020 · 11 comments
Open

Some Sites's height is 0 #187

jihokim2 opened this issue Nov 18, 2020 · 11 comments
Assignees
Labels

Comments

@jihokim2
Copy link

jihokim2 commented Nov 18, 2020

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
@sylvainbaronnet
Copy link

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

image

@sylvainbaronnet
Copy link

sylvainbaronnet commented Jan 4, 2021

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...

@KhubaibQaiser
Copy link

same issue. for me content becomes invisible after 872

@KhubaibQaiser
Copy link

KhubaibQaiser commented Feb 11, 2021

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

@oikkoikk
Copy link

oikkoikk commented May 2, 2021

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

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

@sachin-salian
Copy link

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

@thainm80
Copy link

thainm80 commented Oct 5, 2021

[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

@iou90
Copy link
Owner

iou90 commented Nov 23, 2021

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

@Bellarose143
Copy link

@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.

@thomascwo
Copy link

I fixed it by adding minHeight:

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

@vasylnahuliak
Copy link

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

I have a similar issue, height is coming different several times so I use a hack with Math.max()

const [height, setHeight] = useState(0);

const handleSizeUpdated = useCallback((size: SizeUpdate) => {
  setHeight((prevHeight) => {
    // HACK: AutoHeightWebView returns height with a small deviation
    const normalizedHeight = Math.max(size.height, prevHeight);

    return normalizedHeight;
  });
}, []);

<AutoHeightWebView
  onSizeUpdated={handleSizeUpdated}
  ...
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants