android - Image.resizeMode doesn't work as expected in react-native -


i followed instruction(https://facebook.github.io/react-native/docs/image.html) on using image.resizemode resize image fit content of view. below code.

    import react, {component} 'react';     import {view, image,stylesheet, dimensions} 'react-native'     import tabnavigator 'react-native-tab-navigator';      class maincomponent extends component {      render() {         return (             <tabnavigator tabbarstyle={style.tab}>                 <tabnavigator.item                      title="护士说"                     rendericon={()=> <image source={require('../../icons/main/tab-button_01_pre.png') }                                         resizemode={image.resizemode.cover}/>}                      >                 </tabnavigator.item>               </tabnavigator>          )     } }  const screenheight = dimensions.get('window').height;  const style=stylesheet.create({     tab: {         alignself: 'stretch',         height: screenheight * 0.1     } })   export default maincomponent 

below screenshot of app. image @ bottom got clipped. have tried image.resizemode image.resizemode.cover, image.resizemode.contain , image.resizemode.stretch. of them doesn't have different on showing image. wrong code? how can set image size fit height of tab bar?

enter image description here

after using uiautomatorviewer check view layout found image height bigger navigation item. after add below style on image works now.

image: {      height: screenheight * 0.05 } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -