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

Function onPress

packages/react-aria/src/toggle/useToggle.ts:168–185  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

166 },
167 onClick,
168 onPress(e) {
169 if (e.pointerType === 'keyboard' || e.pointerType === 'virtual') {
170 e.continuePropagation();
171 return;
172 }
173
174 onPress?.(e);
175 state.toggle();
176 ref.current?.focus();
177
178 // @ts-expect-error
179 let {[privateValidationStateProp]: groupValidationState} = props;
180
181 // oxlint-disable-next-line react/react-compiler
182 let {commitValidation} = groupValidationState ? groupValidationState : validationState;
183
184 commitValidation();
185 },
186 isDisabled: isDisabled || isReadOnly
187 });
188

Callers

nothing calls this directly

Calls 4

commitValidationFunction · 0.85
focusMethod · 0.80
continuePropagationMethod · 0.65
toggleMethod · 0.65

Tested by

no test coverage detected