Get react-native element height before rendering?

530
August 01, 2017, at 10:06 PM

Is it possible to get element height before rendering?

My code:

render() {
let content =
  <View style={styles.body} onLayout={this._setMaxHeight.bind(this)}>
    {this.props.children}
  </View>;
return (
  <Animated.View style={[styles.container, {height: this.state.animation}]}>
    {this.state.expanded ? content : null}
  </Animated.View>
);}

But onLayout is only fired when content is rendered, and this.state.expanded is set to true. I need to get the size before rendering it. Is it possible?

READ ALSO
Split an array of arrays with no key

Split an array of arrays with no key

I am using Ajax to submit a form but because I like being complicated I am using JS to allow the end user to add as many input fields to the form as they needThe inputs all have the same name, for example: "val-note[]"

300
Chose No jquery return value

Chose No jquery return value

How to make chosen display the search valueYou are not displaying the options within the select

336
Nunjucks dynamic page template

Nunjucks dynamic page template

i'm using nunjucks (gulp) as templating language and i want to build a dynamic page template

279
Nightwatchjs getvalue of several input

Nightwatchjs getvalue of several input

Is there any way using nightwatchjs to get the value of several inputs?

318