Function useTextStyle

Custom hook that returns the text style based on the provided props.

This hook takes optional text style properties and returns the appropriate text style. If the input is undefined or empty, it returns an empty object. It also merges with any new styles provided.

const style = useTextStyle({ fontSize: 16 }, { color: 'blue' });
// style will be { fontSize: 16, color: 'blue' }

const style = useTextStyle({ fontSize: 16 });
// style will be { fontSize: 16 }

const style = useTextStyle();
// style will be {}
  • Parameters

    • OptionaltextStyleProps: TextStyle

      The initial style props for the text, which can be a single style object.

    • OptionalnewStyles: TextStyle

      Additional style props to be merged with the initial styles, which can be a single style object.

    Returns TextStyle

    The merged text style object.