ref prop is not passed, TypeError: null is not an object (evaluating ‘inputRef.current.focus’)

I am making a custom input component


const CustomInput = (props) => {
  console.log(props);
  return (
    <TextInput
      {...props}
      ref={props.ref}
      placeholder={props.placeholder}
      style={{ ...styles.text, ...props.style }}
    />
  );
};

in the file I want to use it I have

const ForgottenPasswordScreen = (props) => {
...
const inputRef = React.createRef();

  useEffect(() => {
    inputRef.current.focus();
  }, []);
...

<CustomInput
          placeholder={"E-mail..."}
          value={email.value}
          ref={inputRef}
          onChangeText={(text) => setEmail({ value: text, error: "" })}
        />
...

If I am using normal TextInput there is no problem, but when I try to use my CustomInput,
i get the error

TypeError: null is not an object (evaluating ‘inputRef.current.focus’)

I don’t get why ref={props.ref} is not doing the job. I thought that ref will be passed to my component too. How to pass ref properly ?