react-native-view-shot icon indicating copy to clipboard operation
react-native-view-shot copied to clipboard

Map(RNMapboxGL) is blank when taking a screenshot on ANDROID

Open gabrielluka opened this issue 4 years ago • 4 comments

Bug report

Map(RNMapboxGL) is blank when taking a screenshot on ANDROID

I'm trying to take a screenshot of the map to share, but on the android platform it doesn't work as expected because the map doesn't appear on the screenshot

Version & Platform

    "react-native": "0.61.5"
    "react-native-view-shot": "^3.1.2"
    "@react-native-mapbox-gl/maps": "8.0.0"

Platform: Android

Expected behavior

only android happens, in ios works perfetly

Captura de Tela 2020-09-10 às 18 38 14

Actual behavior

ReactNative-snapshot-image8353495037924145253

Steps to reproduce the behavior

Implementation

StoryContainer.tsx

  const viewShot = useRef(null)
  
  ....
   
  const onShareHandler = async () => {
    try {
      // eslint-disable-next-line
      const shareImage = await viewShot.current.capture()
      // eslint-disable-next-line
      const shareResponse = await Share.open({ url: shareImage })
    } catch (error) {
      sentryService().captureException(error)
    }
  }
  
  
  ....

  return (
    <ViewShot ref={viewShot} style={styles.storyContainer} options={{ format: 'jpg', quality: 1 }}>
      <Carousel
        ref={fowardedRef}
        data={farmStories}
        firstItem={currentFarmStory}
        renderItem={({ item, index }) => (
          <StoryContainerItem
            onClose={onClose}
            onNextStoryHandler={onNextStoryHandler}
            onPrevStoryHandler={onPrevStoryHandler}
            onShareHandler={onShareHandler}
            activeStory={item}
            activeIndex={index}
          />
        )}
        sliderWidth={width}
        itemWidth={width}
        slideStyle={{ opacity: 1 }}
        inactiveSlideOpacity={1}
        containerCustomStyle={{ width }}
        onSnapToItem={onAreaStoryChange}
        scrollInterpolator={scrollInterpolator}
        slideInterpolatedStyle={animatedStyles}
      />
    </ViewShot>
  )

gabrielluka avatar Sep 10 '20 21:09 gabrielluka

Hey, I have the same problem, did you find a solution?

maryaibtissem avatar Feb 15 '22 20:02 maryaibtissem

+1

bartlomiejlechowski avatar Nov 10 '22 13:11 bartlomiejlechowski