MCPcopy Create free account
hub / github.com/adobe/react-spectrum / onPressStart

Function onPressStart

packages/dev/s2-docs/src/IconPicker.tsx:67–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 let [isPressed, setPressed] = useState(false);
66 let {addGlobalListener} = useGlobalListeners();
67 let onPressStart = e => {
68 if (e.pointerType !== 'mouse') {
69 return;
70 }
71 setPressed(true);
72 addGlobalListener(
73 document,
74 'pointerup',
75 () => {
76 setPressed(false);
77 },
78 {once: true, capture: true}
79 );
80 };
81
82 let valueObject: IconValue = typeof value === 'string' ? {text: value} : value;
83

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected