gre / react-native-view-shot

Snapshot a React Native view and save it to an image

Home Page:https://github.com/gre/react-native-view-shot-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The image doesn't have a transparent background

Pietro-Putelli opened this issue · comments

I am using the library to save a screenshot of a view, whose height is not initially defined, as I am using padding and setting the height of the view using the onLayout method.

The problem is that the image saved has a white background color, which I want to remove.

      <View
        onLayout={(e) => {
          setHeight(e.nativeEvent.layout.height);
        }}
        ref={contentRef}
        style={{
          height,
          padding:16,
          width: width-12,
          backgroundColor: "darkblue",
          borderRadius: 32,
        }}
      >
        <Text style={{color:"white"}}>This is a test using padding</Text>
      </View>

Expo Snack to reproduce the issue

I have the same problem. Android works great, but iOS adds the white background for some reason

@Antonio-Melo Try to with type png.