useStyles

The purpose of useStyles hook is to merge the default StockUI styles with custom styles provided by the integrator.

Example Usage:
export function LLChatHeader({ title, styles: stylesProp }: LLChatHeaderProps) {
  const headerStyles = useStyles({
    componentStylesFn: getChatHeaderStyles,
    stylesProp,
  });
  
  return (
    <View style={headerStyles.headerContainer}>
      <Text style={headerStyles.headerTitle}>{title}</Text>
    </View>
  );
}

const getChatHeaderStyles: LLComponentStyleFn<LLChatHeaderStyles> = ({
  theme,
}) =>
  StyleSheet.create({
    headerContainer: {
      display: 'flex',
      flexDirection: 'row',
      padding: 12,
    },
    headerTitle: {
      alignSelf: 'center',
      fontSize: 16,
      textAlign: 'center',
      flex: 1,
      color: theme.text,
    },
  });

Hook Argument

componentStylesFn

Type
Function of type: LLComponentStyleFn (Required)

stylesProp

TypeDefault
Partial stylesheet object of type returned by LLComponentStyleFnNo Default

Hook Return Value

xxxyyyStyle

TypeDefault
Stylesheet object of type returned by LLComponentStyleFnNo Default