Hooks
Hooks utilities.
useTheme
You can access all values of the current theme
import { useTheme } from '@redshank/native';
const MyApp = () => {
const {
theme,
setTheme,
colors,
paddings,
margins,
borderRadius
} = useTheme();
return null;
}
const App = () => {
return (
<ThemeProvider>
<MyApp />
</ThemeProvider>
)};
useModal
You can toggle modals easy.
import { View } from 'react-native';
import { useModal, Modal, Title, Button } from '@redshank/native';
const MyApp = () => {
const [visible, toggleVisible, { onVisible, onHidden }] = useModal();
return (
<View>
<Button onPress={toggleVisible}>Open modal</Button>
<Modal visible={visible} onClose={toggleVisible}>
<Title>Welcome</Title>
<Text>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Dolorum fugiat itaque repellat similique voluptate. Amet animi assumenda
aut corporis, dolorum natus provident rerum sed vitae voluptatem? Dolor
dolore iste optio!
</Text>
</Modal>
</View>
);
}
const App = () => {
return (
<ThemeProvider>
<MyApp />
</ThemeProvider>
)};
useHeaderHeight
You can get current status bar height (Header).
import { View } from 'react-native';
import { useHeaderHeight, Title, Text } from '@redshank/native';
const MyApp = () => {
const headerHeight = useHeaderHeight();
return (
<View>
<Title>Header Height</Title>
<Text>
{headerHeight}
</Text>
</View>
);
}
const App = () => {
return (
<ThemeProvider>
<MyApp />
</ThemeProvider>
)};
Community:
We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!
DiscordGithubContributing:
PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.