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

350
Views
¿Cómo resolver el error de mecanografiado ViewStyle en reaccionar nativo?

Estoy tratando de pasar el parámetro de ancho a StyleSheet de esta manera:

 <View style={styles.children(width)}>{children}</View>

Y utilízalo así:

 const styles = StyleSheet.create({ modalContent: { flex: 1, justifyContent: 'center', margin: '5%', }, modalOverlay: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, backgroundColor: 'rgba(0,0,0,0.5)', }, children: (width: any) => ({ width: width, backgroundColor: 'white', position: 'absolute', bottom: 0, borderTopRightRadius: 40, borderTopLeftRadius: 40, paddingVertical: 30, paddingHorizontal: 20, }), }); ,

Pero mecanografiado arroja un error This expression is not callable. No constituent of type 'ViewStyle | TextStyle | ImageStyle' is callable.

captura de pantalla

¿Cómo puedo resolver este problema mecanografiado?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si desea pasar accesorios a la hoja de estilo, debe hacer algo como esto

O

puede usar creando una función que devuelve ViewStyle

 import * as React from "react" import {View,ViewStyle,StyleSheet} from "react-native" const App = () => { return (<View style={Container(width)}></View>) }) const Container = (width: number | string): ViewStyle => ({ width: width, height: '50%', backgroundColor: 'white', position: 'absolute', bottom: 0, borderTopRightRadius: 40, borderTopLeftRadius: 40, paddingTop: 10, paddingHorizontal: 20, })
about 4 years ago · Juan Pablo Isaza Report
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!