mattermost-mobile/app/components/math_view/index.tsx
Daniel Espino García cff12f7182
Enable exhaustive deps in the repo (#9508)
* Enable exhaustive deps in the repo

* Add tests for the new hooks

* Update claude.md

* Remove pre-commit overwrite
2026-02-18 11:56:16 +01:00

30 lines
805 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useId, useMemo} from 'react';
import RNMathView from 'react-native-math-view';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
// From node_modules/react-native-math-view/src/common.tsx
type Props = {
math: string;
onError?: (error: Error) => any;
renderError: ({error}: {error: Error}) => JSX.Element;
resizeMode: 'cover' | 'contain';
style: StyleProp<ViewStyle & Pick<TextStyle, 'color'>>;
}
const MathView = (props: Props) => {
const id = useId();
const config = useMemo(() => ({id}), [id]);
return (
<RNMathView
{...props}
config={config}
/>
);
};
export default MathView;