ewindsor
ewindsor

Reputation: 885

How can I get React Native to put JS bundle in Share Extension when compiling for Release?

I can load via jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; when developing, but using jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; in Extension doesn't work by default.

I can get the file from main app's bundle through getting parent directory of parent directory but prob. not the best way to ensure it works long-term...

Upvotes: 1

Views: 421

Answers (1)

ewindsor
ewindsor

Reputation: 885

Ok it's simple enough -- I just copied Bundle React Native code and images in Build Phases from app into Extension's Build Phases. It does double the work, so there's prob. a way to get it to reuse what it did before in the extension, but this works for me for now.

Upvotes: 2

Related Questions