Shopify checkout ui component <Link> onPress not working

Topic summary

Issue: In a Shopify Checkout UI extension, the Link component executes navigation (via the to prop) but does not trigger the onPress handler when both are set.

Details: The author references Shopify’s docs for Link and shares a code snippet where onPress should log to console and POST to DATA_URL (JSON body, content-type header, keepalive). Clicking the Link navigates to shop.storefrontUrl, and the expected onPress side effects do not occur.

Question: How to correctly use Link so it both navigates and runs an onPress callback?

Artifacts: A code snippet and a screenshot are central to understanding the implementation.

Status: No responses or solutions yet; the thread remains open with the key question unanswered.

Summarized with AI on December 25. AI used: gpt-5.

https://shopify.dev/docs/api/checkout-ui-extensions/2024-04/components/actions/link
i both set to and onPress , this only navigate to the location specified by to , onPress is not execute as expected.

how can i use ?

 <Link
  to={shop.storefrontUrl}
  onPress={() => {
   conosle.log('onPress')
                  fetch(DATA_URL, {
                    method: "POST",
                    body: JSON.stringify({message: '1'}),
                    headers: {
                      "content-type": "application/json",
                    },
                    keepalive: true,
                  });
                }}
              >
                {translate("Submit and leave")}
              </Link>