react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Image] Add scale support for base64-encoded image

Open cxfeng1-zz opened this issue 11 years ago • 6 comments

Now TabBar component support base64-encoded data-uris for the icon, but it has a image scale problem. If I use 3X image, it will become too large for the tab bar.

2015-05-04 10 08 31

And if I use 1X image, it will become too fuzzy for the retina screen.

2015-05-04 10 10 39

The correct way should be like this:

2015-05-04 10 17 43

Maybe UIImage converter should support scale for base64-encoded image , let js tell the native what scale the image is, or just use 3X image and make the scale 3.0.

cxfeng1-zz avatar May 04 '15 14:05 cxfeng1-zz

Thanks for the very detailed issue! I think what needs to be done here is not to tell whether the image is 3x or 1x but what the scale independent size of the image should be.

vjeux avatar May 04 '15 17:05 vjeux

Any news about this?

cxfeng1-zz avatar May 11 '15 07:05 cxfeng1-zz

Same problem here, any work around?

crysfel avatar May 17 '15 15:05 crysfel

@cxfeng1 @crysfel - could either of you take a crack at this and submit a PR?

brentvatne avatar May 30 '15 21:05 brentvatne

@vjeux Since RCTTabBarItem uses UITabBarItem which is not able to set custom UIImageView,I can not tell what size and content mode of the image should be. So the immediate solution may be to add scale support for base64-encoded image in case of similar situation that you can't change the size of view but just want the image to be scaled.

cxfeng1-zz avatar Jun 23 '15 10:06 cxfeng1-zz

@frantic Thanks for the merging, this issue will be closed.

cxfeng1-zz avatar Jun 26 '15 02:06 cxfeng1-zz