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

83
Views
Función BottomSheet llamada antes de onPress?

Soy nuevo en reaccionar + js y no puedo entender por qué se abre la hoja inferior antes de presionar Avatar onPress. ¡Por favor, ayúdame!

 function Profile() { const sheetRef = React.useRef(null); return ( <SafeAreaView style={styles.container2}> <View style={styles.profileview}> <TouchableOpacity onPress={() => sheetRef.current.snapTo(0)}> <Avatar.Image source={require("../assets/defaultprofile.jpg")} size={80}/> </TouchableOpacity> <Title style={styles.text}>Name</Title> <Caption style={styles.caption}>@username</Caption> </View> <BottomSheet ref={sheetRef} snapPoints={[200, 150, 0]} borderRadius={10} renderContent={renderContent}/> </SafeAreaView> );}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El paquete toma el primer índice de la propiedad 'snapPoints' como el punto predeterminado cuando se monta. Hay dos opciones para solucionarlo:

1- Puede cambiar el accesorio 'snapPoints' a [0, 150, 200]. Cuando hagas este cambio, tomará el primer índice (0), y se montará como 'cerrado' 2- La segunda opción es usar otra propiedad llamada 'initialSnap' que toma el índice del punto inicial, que es 2 para ti.

Entonces, para ser claros, aquí está el bloque de código que creo que es una solución:

 function Profile() { const sheetRef = React.useRef(null); return ( <SafeAreaView style={styles.container2}> <View style={styles.profileview}> <TouchableOpacity onPress={() => sheetRef.current.snapTo(0)}> <Avatar.Image source={require("../assets/defaultprofile.jpg")} size={80}/> </TouchableOpacity> <Title style={styles.text}>Name</Title> <Caption style={styles.caption}>@username</Caption> </View> <BottomSheet ref={sheetRef} snapPoints={[200, 150, 0]} initialSnap={2} borderRadius={10} renderContent={renderContent} /> </SafeAreaView> );}

Espero que ayude. La mejor de las suertes

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!