Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
How to share container screenshot in React Native | Expo for android

I have built an application where I want to share a component as an image. I am doing it like so.

 const shareImageHandler = async () => {
try {
  const uri = await captureRef(containerRef, {
    quality: 1,
    format: "jpg",
  });

  await Sharing.shareAsync(uri);
  console.log("action succeed");
} catch (error) {
  console.log("something went wrong!");
}

};

But I am getting this error.

[TypeError: undefined is not an object (evaluating '_expoSharing.default.shareAsync')]

the component that I want to share as an image.

 <ImageBackground
      ref={containerRef}
      source={{ uri: imgUrl ?? img() }}
      resizeMode="cover"
      style={styles.bgImg}
    >
      <View
        style={{
          width: "100%",
          height: "100%",
          position: "absolute",
          top: 0,
          left: 0,
          backgroundColor: "rgba(0,0,0,.7)",
        }}
      />
      <View style={styles.contentContainer}>
        <Text style={styles.quote}>&#8220; {content} &#8221;</Text>
        <Text style={styles.author}>&mdash;{data}</Text>
      </View>
    </ImageBackground>

I have tried many solutions but no one did the trick.

Note: I am able to save the component as an image in the gallery successfully, It is just a side note.

This application will be used only for android devices.

Thanks In advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You must be importing the lib wrong, the same happened to me, I was importing like this:

import Sharing from 'expo-sharing';

but the right way is this:

import * as Sharing from 'expo-sharing';
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda