자식 컴포넌트 내에서 Props 로 받은 ref 를
사용 후
React.memo 와 같이
자식 컴포넌트를
React.forwardRef 로 감싸 export 하여
사용할 수 있다
const BorderedInput = ({hasMarginBottom, ...rest}: Props, ref) => {
return (
<TextInput
style={[styles.input, hasMarginBottom && styles.margin]}
{...rest}
ref={ref}
/>
);
};
export default React.forwardRef(BorderedInput);