Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to give radius to imagebackground in react native

<ImageBackground
  style={{height: 100, width: 100}}
  imageStyle={{ borderRadius: 6}}
  source={{ uri: 'www.imageislocatedhere.com }}
>
Comment

border radius on an image react native

// You need overflow set to 'hidden' for the radius to take effect,
// If your images have transparent backgrounds,
	// you'll probably want to have both image and image container
	// components.

const styles = StyleSheet.create({
  imgContainer: {
    width: 10,
    height: 10,
    resizeMode: 'cover',
    borderRadius: 50,
    overflow: 'hidden',
    justifyContent: 'center',
    alignItems: 'center',
  },
  profilePic: {
    width: 8,
    height: 8,
    aspectRatio: 1,
    resizeMode: 'contain',
  },
// Note that the image is slightly smaller than its container
})

// If you don't have transparent backgrounds or known background colors,
	// the above solution will lead to an awkward square in the middle of
	// your circle.
// In this case, you'll have to loose the corners of your image.
const styles = StyleSheet.create({
  imgContainer: {
    justifyContent: 'center',
    alignItems: 'center',
  },
  profilePic: {
    width: 10,
    height: 10,
    aspectRatio: 1,
    resizeMode: 'cover',
    borderRadius: 50,
    overflow: 'hidden',
  },
// If you're not worried about centering your image in a row,
  //the container might not be necessary here.
})

<View style={styles.imgContainer}>
  <Image source={img} style={styles.profilePic} />
</View>
                                 
Comment

PREVIOUS NEXT
Code Example
Javascript :: update all packages in package.json 
Javascript :: javascript split and trim 
Javascript :: string split last slash in js get previous results 
Javascript :: get parameter from the actual url javascript 
Javascript :: javascript how to remove accents or diacritics 
Javascript :: Use jQuery in Console 
Javascript :: jquery checkbox change event 
Javascript :: js get base url 
Javascript :: ondomcontentloaded javascript 
Javascript :: Uncaught ReferenceError: jsPDF is not defined 
Javascript :: node check if file exists 
Javascript :: javascript get url 
Javascript :: bcrypt_lib.node not found 
Javascript :: javascript change url without redirect 
Javascript :: js loop array backward 
Javascript :: javascript clear localstorage 
Javascript :: reload page jquery timer 
Javascript :: window resize event javascript 
Javascript :: google dino game hack 
Javascript :: js wait for seconds 
Javascript :: javascript int to float 
Javascript :: add leading zeros to number javascript 
Javascript :: update create react app 
Javascript :: js object to querystring 
Javascript :: Uncaught TypeError: $(...).select2 is not a function 
Javascript :: react native view background transparency 
Javascript :: react js installation 
Javascript :: puppeteer get html 
Javascript :: jquery disable class attribute 
Javascript :: how to adjust the caledar height fullcalendar 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =