You can get the height of a view using the onLayout prop.
<View onLayout={(event) => {
const {x, y, width, height} = event.nativeEvent.layout;
// do something here like set your initial animated value for the height
}} />
https://facebook.github.io/react-native/docs/view#onlayout
Animating height is not the best approach as height animations are not performant. You may wish to animate a transform instead and animate the vertical scale of the view.
If you can use the Native driver for animations then they will be very performant
https://facebook.github.io/react-native/docs/animations#using-the-native-driver
Not everything you can do with Animated is currently supported by the
native driver. The main limitation is that you can only animate
non-layout properties: things like transform and opacity will work,
but flexbox and position properties will not.
This SO answer explain well how to perform a transform animation https://stackoverflow.com/a/45634834/5508175
My personal approach would be to fade out the contents of the view and then animate the vertical scale of the view to zero.