Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda