style

react native 원형 border radius 만들기

escher_ 2021. 8. 8. 21:45

 

https://stackoverflow.com/questions/30404067/creating-css-circles-in-react-native

 

Creating css circles in react-native

I'm having some trouble creating css circles in react-native. The following works in iPhone 6 Plus but in all the other iPhones, they become diamonds. circle: { height: 30, width: 30,

stackoverflow.com

 

리액트 네이티브에서는 

 

borderRadius : '50%' // wrong (x)

 

테두리 속성에 문자열 %를 줄 수 없다.

 

그러므로 크기의 반으로 나누어 준다.

 

const circle = ({size}) => {

	const styles = StyleSheet.create({
            container : {
                borderRadius : size / 2
            }
	})

}