This boilerplate uses @sohantalukder/rn-kit as the shared source for themes, screen wrappers, typography, spacing, and overlay UI. Keep feature-specific layouts in modules, and use RN Kit for reusable primitives.
Wrap the app once with RN Kit's ThemeProvider and share colors, typography, spacing, and layout helpers everywhere.
Switch between default, dark, and system theme modes with the useTheme hook.
Use UiPortalProvider when the app needs toast, dialog, bottom sheet, or context menu APIs.
Pass theme.navigationTheme to NavigationContainer when navigation should follow the active theme.
Add RN Kit providers near the root of the app. Include UiPortalProvider whenever you use global overlays such as toast, dialog, bottom sheet, or context menu.
import {
ThemeProvider,
UiPortalProvider,
} from '@sohantalukder/rn-kit';
export function AppProviders({ children }: { children: React.ReactNode }) {
return (
<ThemeProvider>
<UiPortalProvider>{children}</UiPortalProvider>
</ThemeProvider>
);
}Read the active theme from useTheme and compose UI with RN Kit tokens instead of hardcoded colors and spacing.
import { Text, useTheme } from '@sohantalukder/rn-kit';
import { View } from 'react-native';
export function ProfileHeader() {
const { colors, gutters, layout, typographies } = useTheme();
return (
<View
style={[
layout.itemsCenter,
gutters.paddingHorizontal_32,
{ backgroundColor: colors.background },
]}
>
<Text
variant="heading1"
weight="bold"
style={typographies.heading1}
>
Welcome back
</Text>
</View>
);
}Use changeTheme from RN Kit to switch between default, dark, and system modes.
import { Button, useTheme } from '@sohantalukder/rn-kit';
export function ThemeToggleButton() {
const { changeTheme, variant } = useTheme();
return (
<Button
text="Toggle theme"
onPress={() =>
changeTheme(variant === 'default' ? 'dark' : 'default')
}
/>
);
}RN Kit exposes a navigationTheme value so React Navigation can match the selected app theme.
import { NavigationContainer } from '@react-navigation/native';
import { useTheme } from '@sohantalukder/rn-kit';
export function RootNavigator() {
const { navigationTheme } = useTheme();
return (
<NavigationContainer theme={navigationTheme}>
{/* navigators */}
</NavigationContainer>
);
}Keep the boilerplate aligned with RN Kit instead of building a second theme system.