Khan/aphrodite

Cant get height of Aphrodite element

inciteio opened this issue · 1 comments

I am using React and Aphrodite. I need to get the height of a fixed element in order to position it properly. Because I cannot know when Aphrodite styles are rendered, I can't use javascript to get the height of my element. Is there any way to capture height after Aphrodite styles have been applied to an element?

`componentDidUpdate(props, state) {
		Styles(this.props.button).then(results => {
			this.setState({ styles: results }, () => {
				console.log(
					this.feedback_ref.current.getBoundingClientRect()
				)
			})
		})
}

render() {
	return (
		<div id={'wrapper'}>
			{isEmpty(this.state.styles) ? null : (
				<div
					ref={this.feedback_ref}
					id={'feedback_container'}
					className={
						(this.state.styles.universal,
						this.state.styles.position,
						this.state.styles.foreground,
						this.state.styles.text)
					}
				>
					Feedback
				</div>
			)}
		</div>
	)
}`

Solved this by adding a setTimeout after style update.