Skip to main content

Function: useStyle()

useStyle(customStyleConfig?): StyleContextType

Defined in: hooks/useStyle.ts:38

Hook to access the current style configuration from the StyleContext.

Parameters​

customStyleConfig?​

StyleContextType

Optional custom style configuration to override the context value

Returns​

StyleContextType

The style configuration object containing theme, typography, sizing, and responsive settings

Examples​

const MyComponent = () => {
const style = useStyle();

return (
<View style={{ backgroundColor: style.themeConfig.light.primary }}>
<Text>Styled content</Text>
</View>
);
};
const MyComponent = () => {
const customStyle = {
themeConfig: { / custom theme / },
typographyConfig: { / custom typography / }
};
const style = useStyle(customStyle);

return <Text>Using custom style</Text>;
};