diff --git a/phone/src/ui/components/Input.tsx b/phone/src/ui/components/Input.tsx index f5f9427b2..939cce77d 100644 --- a/phone/src/ui/components/Input.tsx +++ b/phone/src/ui/components/Input.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { forwardRef } from 'react'; import MUITextField, { TextFieldProps } from '@mui/material/TextField'; import MUIInputBase, { InputBaseProps } from '@mui/material/InputBase'; import { PhoneEvents } from '@typings/phone'; @@ -10,43 +10,41 @@ const toggleKeys = (keepGameFocus: boolean) => keepGameFocus, }).catch((e) => (isEnvBrowser() ? () => {} : console.error(e))); -export const TextField: React.FC = (props) => { - return ( - { - toggleKeys(false); - if (props.onFocus) { - props.onFocus(e); - } - }} - onBlur={(e) => { - toggleKeys(true); - if (props.onBlur) { - props.onBlur(e); - } - }} - /> - ); -}; +export const TextField = forwardRef((props, ref) => ( + { + toggleKeys(false); + if (props.onFocus) { + props.onFocus(e); + } + }} + onBlur={(e) => { + toggleKeys(true); + if (props.onBlur) { + props.onBlur(e); + } + }} + /> +)); -export const InputBase: React.FC = (props) => { - return ( - { - toggleKeys(false); - if (props.onFocus) { - props.onFocus(e); - } - }} - onBlur={(e) => { - toggleKeys(true); - if (props.onBlur) { - props.onBlur(e); - } - }} - /> - ); -}; +export const InputBase: React.FC = forwardRef((props, ref) => ( + { + toggleKeys(false); + if (props.onFocus) { + props.onFocus(e); + } + }} + onBlur={(e) => { + toggleKeys(true); + if (props.onBlur) { + props.onBlur(e); + } + }} + /> +));