API
#
ProvidersDirectionProvider
#
Provides a direction to all children using context. Accepts the following optional props.
direction
(ltr | rtl
) - Explicit direction to use. Should not be used withvalue
.inline
(boolean
) - Render an inline element instead of block.value
(string
) - Locale aware string to deduce the direction from. Should not be used withdirection
.
ThemeProvider
#
Provides the current theme to the entire application and must be rendered at the root. Accepts the following optional props.
name
(string
) - Explicit name of a theme to provide. If undefined, will automatically determine the best theme.
ContextualThemeProvider
#
Provides a theme to a target component tree and will override the root theme. Requires the following prop.
name
(string
) - Explicit name of a theme to provide.
Renders a wrapping
View
under the hood.
#
HooksuseDirection
#
useDirection(): Direction
Returns the current direction, either ltr
or rtl
.
useStyles
#
useStyles(styleSheet: LocalSheet): StyleResultGenerator
Requires a local style sheet and returns a function to use for style sheet generation.
useTheme
#
useTheme(): Theme<NativeStyles>
Returns the current theme or throws an error.
#
HOCswithDirection
#
withDirection()(component: React.ComponentType): React.FunctionComponent
Wraps a component to pass the current direction as a direction
prop.
withStyles
#
withStyles(styleSheet: LocalSheet)(component: React.ComponentType): React.FunctionComponent
Wraps a component with a local style sheet to pass a compose
prop (renamed to sx
) to use for
style sheet composition.
withTheme
#
withTheme()(component: React.ComponentType): React.FunctionComponent
Wraps a component to pass the current theme as a theme
prop.
#
OthercreateStyled
#
createStyled(type: React.ComponentType, styleSheet: NativeStyles | LocalSheetFactory): StyledComponent
Creates and returns a styled component using the provided style sheet.
style
#
An alias for createElementStyles.
styles
#
An alias for createComponentStyles.
styled
#
An alias for createStyled.
themeStyle
#
An alias for createThemeStyles.