Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1307

get size of flex component

$
0
0

I have two components, one Parent and one Child. The latter should have flex-layout, so that it occupies 75% of the vertical space:

const Parent: FC<PropsWithChildren> = (props) => {    return (<View style={ styles.container }><MyChild /></View>)}const Child: FC<PropsWithChildren> = (props) => {    return (<View style={ styles.childSytle }/>)}const styles = StyleSheet.create({    container: {         flex: 1,        flexdirection: 'column'    },    childStyle: { flex: 9 }});

What I want to achieve now, is get the actual size of my Child-component from within Parent. Is it possible to get the size of a component, when it's flex?

I already tried a forwardref for my Child to get a reference to Child. However I have no idea how to get its size.


Viewing all articles
Browse latest Browse all 1307

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>