import * as React from 'react'; import { StyleProp, StyleSheet, Text as NativeText, TextStyle, } from 'react-native'; import type { MD2Theme } from 'src/types'; import { useInternalTheme } from '../../../core/theming'; import { forwardRef } from '../../../utils/forwardRef'; type Props = React.ComponentProps & { style?: StyleProp; /** * @optional */ theme?: MD2Theme; }; // @component-group Typography /** * Text component which follows styles from the theme. * * @extends Text props https://reactnative.dev/docs/text#props */ const Text: React.ForwardRefRenderFunction<{}, Props> = ( { style, theme: overrideTheme, ...rest }: Props, ref ) => { const root = React.useRef(null); const theme = useInternalTheme(overrideTheme); React.useImperativeHandle(ref, () => ({ setNativeProps: (args: Object) => root.current?.setNativeProps(args), })); return ( ); }; const styles = StyleSheet.create({ text: { textAlign: 'left', }, }); export default forwardRef(Text);