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

Function onPress

packages/dev/docs/src/ThemeSwitcher.js:78–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76export function ThemeSwitcher() {
77 let colorScheme = useCurrentColorScheme();
78 let onPress = () => {
79 localStorage.theme = colorScheme === 'dark' ? 'light' : 'dark';
80 window.dispatchEvent(new Event('storage'));
81 };
82 let label = colorScheme === 'dark' ? 'Switch to light theme' : 'Switch to dark theme';
83
84 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected