HomeiOS Developmentjavascript - How do i do know if the headerRight button has...

javascript – How do i do know if the headerRight button has been pressed?


I wish to know if the headerRight button has been pressed.

_layout.js

import { Stack } from "expo-router";
import { useCallback } from "react";
import { useFonts } from "expo-font";
import * as SplashScreen from 'expo-splash-screen';
import { COLORS } from "../constants/colours";
import { Textual content, TouchableOpacity, View } from "react-native";
import NewMeal from "./newmeal";

SplashScreen.preventAutoHideAsync();

const Format = () => {
  const [fontsLoaded] = useFonts({
    SFProDisplay: require('../belongings/fonts/SF-Professional-Show-Black.otf')
  })

  const onLayoutRoutView = useCallback(async () => {
    if(fontsLoaded) {
      await SplashScreen.hideAsync();
    }
  }, [fontsLoaded]);

  if(!fontsLoaded) return null;

  return (
    <Stack onLayout={onLayoutRoutView} >
      <Stack.Display 
        // Code
      />
      <Stack.Display 
         // Code
      />
      <Stack.Display 
        title="newmeal"
        choices={{
          presentation: 'modal',
          headerStyle: {
            backgroundColor: COLORS.box1,
          },
          headerTitleStyle: {
            shade: "#FFF"
          },
          headerTitle: "New meal",
          // WANT TO KNOW IF THIS HEADER RIGHT HAS BEEN PRESSED
          headerRight: () => (
            <TouchableOpacity>
              <Textual content fashion={{ shade: COLORS.blue, fontSize: 17, fontWeight: 'daring' }}>Executed</Textual content>
            </TouchableOpacity>
          ),
          headerLeft: () => (
            <TouchableOpacity>
              <Textual content fashion={{ shade: COLORS.blue, fontSize: 17  }}>Cancel</Textual content>
            </TouchableOpacity>
          )
        }}
      />
    </Stack>
  )
}

export default Format;

newmeal.js

import { SafeAreaView, View } from "react-native"
import { COLORS } from "../constants/colours";

const NewMeal = () => {

  return(
    <SafeAreaView fashion={{ 
      flex: 1, 
      backgroundColor: COLORS.background,
    }}>
      // WANT TO KNOW HERE IF HEADER RIGHT HAS BEEN PRESSED
    </SafeAreaView>
  )
}

export default NewMeal;

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments