KBLNY / react-native-message-bar

A notification bar alert displayed at the top of the screen for react-native
MIT License
442 stars 125 forks source link

Avatars can be local images too, not just URLs #9

Closed emiraydin closed 8 years ago

emiraydin commented 8 years ago

I think it’s better to leave the design flexible and let the user decide if they want to use local images or images online. This pull request changes the avatarUrl prop to avatar and allows for the ability to add local images. to add local image: ‘avatar’: require(‘../myImage.png’) to add online image: ‘avatar’: {uri: ‘http://example.com/myImage.png’}

emiraydin commented 8 years ago

@KBLNY why are you limiting source to uri in 0b40f0ab0c270a8fb478ad3dfbeb30d8c8fadf22? The reason for my pull request was that you cannot use static assets with {uri: '...'} construct. It has to have require. (See here). And using local files is no good because again uri construct doesn't support relative paths, it has to absolute paths which doesn't work in an actual device. So, I cannot put an image like ../../assets/avatar.png. I believe the best way here is to leave the design open just like the React Native's Image API instead of abstracting and limiting the source. Please take another look at my pull request and let me know what you think. Thanks.

KBLNY commented 8 years ago

mea culpa, please use v1.5.2 (latest), you can now use a local image file or a remote image file like the following: