简体   繁体   中英

How to reposition image in ImageBackground React Native?

I have a big image that I'm using in the React Native ImageBackground component.

function Component(){
  return <ImageBackground style={{
    height: 300,
    width: '100%',
  }}/>;
}

The size is correct, but I would like to reposition the image internally as in object-position in css . What is an equivalent style selector?

Try using resizeMode prop of Image. ImageBackground inherits app the properties of Image. Setting correct image resizeMode should resolve your issuel. Refer this: https://reactnative.dev/docs/image#resizemode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM