Gaston Morixe
Gaston Morixe

Reputation: 847

Unload / Release / Remove React Native View from runtime

I am creating a App that uses React Native in some part, but not all.

I have an instance of RCTRootView

Setting it to nil and removing it from the superview doesn't seem to release it.

The CPU and RAM stays high, so it seems the React app stills executing on the threads.

How can I stop it?

Thanks :)

Upvotes: 13

Views: 2845

Answers (2)

Shashi3456643
Shashi3456643

Reputation: 2041

RCTBridge * bridge
[bridge invalidate];
bridge = nil;

invalidate and nil will clear all modules from jsbundle and it clears RCTRootView instances from memory . Note bridge is object of RCTBridge.

Upvotes: 5

Gaston Morixe
Gaston Morixe

Reputation: 847

You have to create your own RTCBridge separately and release it ( = nil), not only the view.

Upvotes: 4

Related Questions