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

176
Vistas
React Native disable component button from another screen when function is called

I have a Flatlist card component from where a user can press a Send Request button, that will redirect him to Request Screen. I need to disable the component Send Request button once user has navigated to that screen and successfully sent a request. How can I pass the successfully called function prop to the component so that i can check whether user has sent a request or not?

Request Screen

function sendRequest() {
        try {
          API.graphql(graphqlOperation(createTripRequest, { input: initialState }))
        } catch (err) {
          Alert.alert('Error creating trip')
        };
      }

    return (

        <ScrollView style={styles.container}>

            <TouchableOpacity style={styles.commandButton} onPress={() => {
                sendRequest();
                navigation.navigate("Request Sent");
            }} 
            activeOpacity={0.5}>
                <Text style={styles.panelButtonTitle}>Send Request</Text>
            </TouchableOpacity>


        </ScrollView>
    );
};

Component

const Post = (props)  => {

    const post = props.post;
 
    const navigation = useNavigation();

    const goToSendRequestScreen= () => {
      navigation.navigate("Send Request", {postId: post.id });
   };


    return (
        <View >
          
          <TouchableOpacity style={styles.postCarouselButton} activeOpacity={0.6} onPress= 
          {goToSendRequestScreen}>
             <Text style={styles.buttonText} >Send Request</Text>
           </TouchableOpacity> 

        </View>
    );
about 4 years ago · Juan Pablo Isaza
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