A static extension target that renders as a menu item on the product details screen
import React from 'react';
import {
reactExtension,
Button,
useApi,
} from '@shopify/ui-extensions-react/point-of-sale';
const ButtonComponent = () => {
const api = useApi<'pos.product-details.action.menu-item.render'>();
return <Button onPress={() => api.action.presentModal()} />;
};
export default reactExtension(
'pos.product-details.action.menu-item.render',
() => <ButtonComponent />,
);
import {Button, extension} from '@shopify/ui-extensions/point-of-sale';
export default extension(
'pos.product-details.action.menu-item.render',
(root, api) => {
const button = root.createComponent(Button, {
onPress: () => {
api.action.presentModal();
},
});
root.append(button);
},
);