Reputation: 20786
I am loading Three.JS Model using WebView in my react-native app. After loading the Model the memory is increased.
Now when i tap on button i want to deallocate the webView Component and want release the memory.
OR when i go to next screen i would like to release the memory.
Below is my code.
{this.state.showWebview &&
<WebView
ref={(wbref) => {
this.webview = wbref;
}}
style={styles.middleview}
source={{
uri: this.state.showWebview && this.props.isCurrentScreenOnTop
? '3DMODEL/vechicle.html'
: null,
}}
onLoadStart={this.onLoadStart}
onLoad={this.onLoad}
onLoadEnd={this.onLoadEnd}
onError={this.onError}
renderError={this.renderError}
onMessage={this.handleMessageFromBuilder}
cacheEnabled={false}
cookiesEnabled={false}
/>}
componentWillUnmount() {
this.webview = null;
}
Below is the memory graph.
Upvotes: 3
Views: 2062