question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScrollView height gets cut by StatusBar height in standalone app

See original GitHub issue

ScrollView height gets cut by StatusBar height in standalone app when installed in android Nougat or Oreo, but works fine in lower versions (tested in KitKat) and also in development mode in expo client. This is happening for the last 2-3 weeks. Is it because of SDK/XDE upgradation? I’m using exp build:android for building apk.

Environment

OS: macOS Sierra 10.12.1 Node: 10.0.0 Target OS: Android

Steps to Reproduce

I have tried ScrollView inside View and then another View inside ScrollView with 100% height, window height, and flex layout. Also tried ScrollView inside View / View inside ScrollView.

Expected Behavior

act

Actual Behavior

err

Reproducible Demo

<View style={{ flex: 1, backgroundColor: 'green' }}>
	<StatusBar hidden={ false } backgroundColor="#ff9933" barStyle="light-content" translucent={ true } />
	<ScrollView showsVerticalScrollIndicator={ false } contentContainerStyle={{ flex: 1 }} style={{ backgroundColor: 'gray', padding: 10 }}>
		<View style={{ flex: 1, backgroundColor: 'lightgray', minHeight: Dimensions.get('window').height }}>
		</View>
	</ScrollView>
</View>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kafi-rashidcommented, Nov 8, 2018

@nicovanzyl @kmnwee

I fixed it this way:

In App.js I had to set StatusBar property hidden = false, translucent = true inside a View with flex = 1 and imported the component inside it.

<View style={{ flex: 1 }}>
	<StatusBar hidden={ false } backgroundColor="#FFFFFF" barStyle="dark-content" translucent={ true } />
	<MyComponent/>
</View>

In MyComponent:

<View style={{ flex: 1, backgroundColor: 'green' }}>
	<StatusBar hidden={ false } backgroundColor="#ff9933" barStyle="light-content" translucent={ true } />
	<ScrollView showsVerticalScrollIndicator={ false } contentContainerStyle={{ flex: 1 }} style={{ backgroundColor: 'gray', padding: 10 }}>
		<View style={{ flex: 1, backgroundColor: 'lightgray', minHeight: Dimensions.get('window').height }}>
		</View>
	</ScrollView>
</View>
1reaction
kmnweecommented, Nov 8, 2018

Hi Guys,

I was able find a fix/workaround. Here’s what I did: -If you have “androidStatusBar” set in you app.json, remove it. -Use StatusBar component [import {StatusBar} from ‘react-native’] in your view to modify your status bar screen shot 2018-11-08 at 9 04 29 am

Hope this works with you too!

-Ken

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native scrollView Height always stays static and does not ...
There is an existing limitation with ScrollView where height cannot be provided directly. Wrap the ScrollView in another View and give height to...
Read more >
[Solved]-How to prevent UIView from being resized to fit ScrollView ...
Coding example for the question How to prevent UIView from being resized to fit ScrollView height (autoresizing disabled)?
Read more >
Build a fully offline app using React Native and WatermelonDB
See how you can build a fully featured offline app using React Native for the frontend and WatermelonDB for data storage.
Read more >
UIScrollView Class (UIKit) | Microsoft Learn
The need for and range of scrolling is specified by the application developer setting the UIScrollView's ContentSize to a SizeF greater than the...
Read more >
keyboardavoidingview doesn't work - You.com | The AI Search ...
If you are using react-navigation, this is affected by the header of the react-navigation. The height of the header is vary on different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found