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.

Capture ScrollView beyond screen get black background

See original GitHub issue

Environment

Android: 7.0 React Native: 0.53.3 react-native-view-shot: 2.3.0

Describe

Capture ScrollView container , the beyond screen part get black background

download

the black part is beyond screen

code

import { captureRef } from 'react-native-view-shot'

  captureScreen = () => {
    console.log('this is captureScreen')
    captureRef(this.refs.Sc, {
      format: 'jpg',
      result: 'base64',
      snapshotContentContainer: true
    })
      .then(res => {
        console.log(`data:image/jpg;base64,${res}`, 'this is res')
      }).catch(error => {
        console.log(error, 'this is error')
      })
  }

<ScrollView
     ref='Sc'
     collapsable={false}
>
  <View>
    <Text>This is test</Text>
  </View>
</ScrollView>

Expect

the beyond screen part not get black background

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tza17313commented, Dec 20, 2018

try add style={{backgroundColor:"#fff"}} to ScrollView. like this:

<ScrollView
     ref='Sc'
     collapsable={false}
     style={{backgroundColor:"#fff"}}
>
  <View>
    <Text>This is test</Text>
  </View>
</ScrollView>
0reactions
otherRickcommented, May 26, 2022

I just gave a style={{backgorundColor: ‘#fff’ to my ViewShot and got it fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scrollview causes black background to appear - Stack Overflow
Since the backgroud of the complete page is grey, this black area distorts the complete screen. I used scroll views many times before...
Read more >
ScrollView - React Native
Component that wraps platform ScrollView while providing integration with touch locking "responder" system.
Read more >
ScrollView - Android Developers
Scroll view may have only one direct child placed within it. To add multiple views within the ... android:background, A drawable to use...
Read more >
ScrollView - React Native
white , scroll indicator is white. This style is good against a black content background. Type, Required, Platform. enum('default', 'black ...
Read more >
How to ignore safe area insets in UIKit - Sarunw
As you can see, UIKit will automatically adjust content insets of a scroll view to make sure the content stays visible within a...
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