import React , { forwardRef , MutableRefObject , Ref , RefForwardingComponent , useImperativeHandle , useRef , } from 'react' ; import ViewPropTypes from './ViewPropTypes' ; const ViewRef = ( { children , unstable__transformChildren , style } , ref ) => { const nodeRef = useRef ( null ) ; useImperativeHandle ( ref , ( ) => ( { unstable__getComputedWidth : ( ) : number => { if ( ! nodeRef || ! nodeRef . current ) { return 0 ; } return nodeRef . current . yogaNode . getComputedWidth ( ) ; } , } ) ) ; const props = { ref : nodeRef , style , unstable__transformChildren , } ; return < div { ... props } > { children } < /div>; } ; const View = forwardRef ( ViewRef ) ; View . propTypes = ViewPropTypes ; View . defaultProps = { flexDirection : 'column' , flexGrow : 0 , flexShrink : 1 , } ; export default View ;