I am trying to pass a ref from the parent to its child. The child is a functional component, so I am doing:
// Child
const Configuration = forwardRef((props, ref) => {
const { colors } = useTheme();
const fall = useRef(new Animated.Value(1)).current;
return <></>
});
And all is working good. But when I try to do
export default withFirebase(Configuration);
The problem appears...
Here is the HOC Component:
import React from "react";
import { FirebaseContext } from "../Firebase/";
const withFirebase = (Component) => (props) => (
<FirebaseContext.Consumer>
{(firebase) => <Component {...props} firebase={firebase} />}
</FirebaseContext.Consumer>
);
export default withFirebase;
Any ideas how to pass a ref to a functional component that is wrapped on a HOC?
I have tried to do something like this:
const Configuration = forwardRef((props, ref) => withFirebase(() => {
const { colors } = useTheme();
const fall = useRef(new Animated.Value(1)).current;
return <></>
}));
export default Configuration;
but didn't work. Thank you.