Merge pull request #14 from MattFoley/feature-bundle-load

Update to load Bundles by their class name if not found in typical bundle path.
This commit is contained in:
Tj 2015-08-27 10:43:21 -07:00
commit 6b9b98b07f

View File

@ -127,14 +127,27 @@ RCT_EXPORT_METHOD(pathForBundle:(NSString *)bundleNamed
{
NSString *path = [[NSBundle mainBundle].bundlePath stringByAppendingFormat:@"/%@.bundle", bundleNamed];
NSBundle *bundle = [NSBundle bundleWithPath:path];
if (!bundle) {
bundle = [NSBundle bundleForClass:NSClassFromString(bundleNamed)];
path = bundle.bundlePath;
}
if (!bundle.isLoaded) {
[bundle load];
}
if (path) {
callback(@[[NSNull null], path]);
} else {
callback(@[[NSError errorWithDomain:NSPOSIXErrorDomain
code:NSFileNoSuchFileError
userInfo:nil].localizedDescription,
[NSNull null]]);
}
}
- (NSNumber *) dateToTimeIntervalNumber:(NSDate *)date
- (NSNumber *)dateToTimeIntervalNumber:(NSDate *)date
{
return @([date timeIntervalSince1970]);
}