Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
No se pudo encontrar un archivo de declaración para el módulo del paquete RN npm

Creé un componente de paquete básico de npm que me permite colocar imágenes de carga personalizadas en mi componente de imagen, pero cuando intenté usar en mi aplicación de ejemplo, el componente volvió indefinido y apareció este mensaje: Could not find a declaration file for module 'react-native-default-image'.

Después de algunas investigaciones, descubrí que se debe a que el módulo no proporciona tipeos para TypeScript, pero no estoy usando TypeScript en absoluto, mi componente es un archivo .js . ¿Hay alguna forma de pasar por esto?

Mi archivo de componentes:

 import React, { Component } from 'react'; import { Image } from 'react-native'; export default class DefaultImage extends React.Component { state = { showDefault: true, error: false }; render() { var image = this.state.showDefault ? this.props.defaultSource : ( this.state.error ? this.props.defaultSource : this.props.source ); return ( <Image style={this.props.style} source={{uri: image}} onLoadEnd={() => this.setState({showDefault: false})} onError={() => this.setState({error: true})} resizeMode={this.props.resizeMode}/> ); } }

Mi archivo de índice:

 import { DefaultImage } from "./DefaultImage"; export { DefaultImage };

Mi archivo package.json:

 { "name": "react-native-default-image", "version": "1.0.3", "type": "module", "description": "Image component that allow to set up a default image to be shown when the custom image is loading and when the custom image can't be loaded", "main": "index.js", "directories": { "example": "example" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "react-native", "image", "default" ], "author": "anti-duhring <mateusvnlima@gmail.com> (http://example.com)", "license": "ISC", "devDependencies": { "@babel/cli": "^7.17.10", "@babel/preset-react": "^7.17.12", "metro-react-native-babel-preset": "^0.71.0" } }

Todos mis archivos:

carpeta del paquete

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!