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

174
Views
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
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!