I have a react native app and in the order, details screen its contain one button when I click it I want to call a function that's will send a notification to a specific device I have his FCM so how to handle these, I don't want to trigger the real-time database just click and calling,
orderDetails.js
<TouchableOpacity onPress={() => // here i want call function i wrote in index.js so?} >
<Text style={{ color: "#fff", fontSize: 17 }}>Completed</Text>
</TouchableOpacity>
index.js
exports.sendN = functions.https.onRequest((req, res) => {
try {
const response = await admin.messaging().sendToDevice(registrationTokens, payload);
console.log('Successfully sent message:', response);
}
catch (error) {
console.log('Error sending message:', error);
}
return null;
});