Hooks
Collection of useful hooks including:
- useColorScheme
- useClipboard
Installation
yarn add @nuskin/hooks
Usage - useColorScheme
import { useColorScheme } from '@nuskin/hooks'
const colorScheme = useColorScheme()
const theme = React.useMemo(() => {
return colorScheme === 'dark' ? MavelyDarkTheme : MavelyDefaultTheme
}, [colorScheme])
return (
<NavigationContainer theme={theme}>
<Navigation />
</NavigationContainer>
)
Usage - useClipboard
import { useClipboard } from '@nuskin/hooks'
import { Button } from '@nuskin/ui'
const [, updateContent] = useClipboard()
return (
<Button title="Copy link to clipboard" onPress={() => updateContent(link)} />
)