Created
July 27, 2018 19:37
-
-
Save 505aaron/9dfc132ff229eb1e5b64809c2c5c894b to your computer and use it in GitHub Desktop.
Dimenions Workaround for iPad Multitasking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Index extends React.Component { | |
state = { | |
}; | |
onLayout = e => { | |
const { width, height } = e.nativeEvent.layout; | |
this.setState(() => ({ width, height})); | |
} | |
render() { | |
const { width, height } = this.state; | |
return ( | |
<View flex={1} onLayout={this.onLayout}> | |
<DimensionProvider width={width} height={height}> | |
<App /> | |
</DimensionProvider> | |
<View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment