File size: 742 Bytes
2485dd8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {extend} from '@react-three/fiber';
import {forwardRef} from 'react';
import ThreeMeshUI, {TextOptions} from 'three-mesh-ui';

extend(ThreeMeshUI);

/**
 * Hacky but component that wraps <text> since this has typescript issues because it collides with
 * the native <text> SVG element. Simple enough so abstracting it away in this file
 * so it could be used in other places with low risk. e.g:
 * <ThreeMeshUIText content="Hello" />
 */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ThreeMeshUITextType = any;

const ThreeMeshUIText = forwardRef<ThreeMeshUITextType, TextOptions>(
  function ThreeMeshUIText(props, ref) {
    return <text {...props} ref={ref} />;
  },
);

export default ThreeMeshUIText;