{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/2282","labels_url":"https://api.github.com/repos/facebook/react-native/issues/2282/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/2282/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/2282/events","html_url":"https://github.com/facebook/react-native/issues/2282","id":100096632,"number":2282,"title":"Image loading from named bundles: UIImage -imageNamed:inBundle:compatibleWithTraitCollection:","user":{"login":"fatuhoku","id":430233,"avatar_url":"https://avatars.githubusercontent.com/u/430233?v=3","gravatar_id":"","url":"https://api.github.com/users/fatuhoku","html_url":"https://github.com/fatuhoku","followers_url":"https://api.github.com/users/fatuhoku/followers","following_url":"https://api.github.com/users/fatuhoku/following{/other_user}","gists_url":"https://api.github.com/users/fatuhoku/gists{/gist_id}","starred_url":"https://api.github.com/users/fatuhoku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatuhoku/subscriptions","organizations_url":"https://api.github.com/users/fatuhoku/orgs","repos_url":"https://api.github.com/users/fatuhoku/repos","events_url":"https://api.github.com/users/fatuhoku/events{/privacy}","received_events_url":"https://api.github.com/users/fatuhoku/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-10T15:38:20Z","updated_at":"2015-08-10T22:12:36Z","closed_at":null,"body":"I'm building a private pod called `RNUI` that contains all of my React Native UI elements in my app. This private pod is then going to be used as a dependency in a main app project, so that I can mix-and-match RN and standard UI components.\r\n\r\nWhen I develop with RN, I normally load some associated static Image assets by using this syntax:\r\n\r\n```\r\n        <Image\r\n          style={styles.icon}\r\n          source={{uri: 'image-name', isStatic: true}}\r\n        />\r\n```\r\n\r\nThis normally works well. However, because I'm building a private pod, the `Images.xcassets` actually needs to be bundled as a resource because Cocoapods needs to embed it into a framework for distribution (i.e. when `MyMainApp` declares `RNUI` as a dependency).\r\n\r\nThis causes RN to not find the images I want, because RN just usees `UIImage`'s `-imageNamed:` (e.g. in this case, `image-name`), when instead you need to use:\r\n\r\n```objc\r\n+ (UIImage * _Nullable)imageNamed:(NSString * _Nonnull)name\r\n                         inBundle:(NSBundle * _Nullable)bundle\r\n    compatibleWithTraitCollection:(UITraitCollection * _Nullable)traitCollection\r\n```\r\n\r\nHow can image loading support add support for loading images from specific named bundles?"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/129631008","html_url":"https://github.com/facebook/react-native/issues/2282#issuecomment-129631008","issue_url":"https://api.github.com/repos/facebook/react-native/issues/2282","id":129631008,"user":{"login":"vjeux","id":197597,"avatar_url":"https://avatars.githubusercontent.com/u/197597?v=3","gravatar_id":"","url":"https://api.github.com/users/vjeux","html_url":"https://github.com/vjeux","followers_url":"https://api.github.com/users/vjeux/followers","following_url":"https://api.github.com/users/vjeux/following{/other_user}","gists_url":"https://api.github.com/users/vjeux/gists{/gist_id}","starred_url":"https://api.github.com/users/vjeux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjeux/subscriptions","organizations_url":"https://api.github.com/users/vjeux/orgs","repos_url":"https://api.github.com/users/vjeux/repos","events_url":"https://api.github.com/users/vjeux/events{/privacy}","received_events_url":"https://api.github.com/users/vjeux/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T22:12:35Z","updated_at":"2015-08-10T22:12:35Z","body":"The packager implements a better solution for this: require('./image.png') in JavaScript. Then, you don't need to link it into xcode and therefore deal with cocoapods for assets, just put them where js lives and it'll work.\r\n\r\nIt's implemented on iOS but disabled until we get it working for Android. But I think that it'll be the solution for this"}}