Skip to content

Instantly share code, notes, and snippets.

@505aaron
Created July 27, 2018 19:37
Show Gist options
  • Save 505aaron/9dfc132ff229eb1e5b64809c2c5c894b to your computer and use it in GitHub Desktop.
Save 505aaron/9dfc132ff229eb1e5b64809c2c5c894b to your computer and use it in GitHub Desktop.
Dimenions Workaround for iPad Multitasking
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