추천사이트
- 그림자 설정값 시뮬레이션 : https://ethercreative.github.io/react-native-shadow-generator/
값에 따른 그림자 정도를 실시간으로 확인할 수 있다.
그림자 설정
그림자는
ios
, android
별로 적용 방법이 다르므로 platform-specific code를 작성 필요.import { Platform, StyleSheet } from 'react-native'; ... const styles = StyleSheet.create({ shadow:{ ...Platform.select({ ios:{ shadowColor: "#000", shadowOffset:{ height: -0.3, width: 1, }, shadowOpacith:0.3, shadowRadius: 7, }, android:{ elevation: 2, } }) } })
ios
shadowColor
: 그림자 색상
shadowOffset
: 그림자 위치
shadowOpacity
: 그림자 투명도
shadowRadius
: 그림자 둥글게
android
안드로이드는 이거 하나로 퉁침.
elevation
: 숫자 값, 숫자가 커질수록 그림자 짙음.