11import { useState } from 'react' ;
2- import { Text , StyleSheet , Platform } from 'react-native' ;
2+ import { View , Text , StyleSheet , Platform } from 'react-native' ;
33import { EaseView } from 'react-native-ease' ;
44
55import { Section } from '../components/Section' ;
@@ -9,35 +9,37 @@ export function ShadowDemo() {
99 const [ active , setActive ] = useState ( false ) ;
1010 return (
1111 < Section title = "Shadow / Elevation" >
12- < EaseView
13- animate = {
14- active
15- ? {
16- shadowOpacity : 0.4 ,
17- shadowRadius : 16 ,
18- shadowOffset : { width : 0 , height : 8 } ,
19- elevation : 12 ,
20- }
21- : {
22- shadowOpacity : 0 ,
23- shadowRadius : 0 ,
24- shadowOffset : { width : 0 , height : 0 } ,
25- elevation : 0 ,
26- }
27- }
28- transition = { {
29- shadow : { type : 'spring' , damping : 15 , stiffness : 120 } ,
30- } }
31- style = { styles . box }
32- >
33- < Text style = { styles . text } >
34- { active
35- ? Platform . OS === 'android'
36- ? 'Elevated'
37- : 'Shadow'
38- : 'Flat' }
39- </ Text >
40- </ EaseView >
12+ < View style = { styles . surface } >
13+ < EaseView
14+ animate = {
15+ active
16+ ? {
17+ shadowOpacity : 0.4 ,
18+ shadowRadius : 16 ,
19+ shadowOffset : { width : 0 , height : 8 } ,
20+ elevation : 12 ,
21+ }
22+ : {
23+ shadowOpacity : 0 ,
24+ shadowRadius : 0 ,
25+ shadowOffset : { width : 0 , height : 0 } ,
26+ elevation : 0 ,
27+ }
28+ }
29+ transition = { {
30+ shadow : { type : 'spring' , damping : 15 , stiffness : 120 } ,
31+ } }
32+ style = { styles . box }
33+ >
34+ < Text style = { styles . text } >
35+ { active
36+ ? Platform . OS === 'android'
37+ ? 'Elevated'
38+ : 'Shadow'
39+ : 'Flat' }
40+ </ Text >
41+ </ EaseView >
42+ </ View >
4143 < Button
4244 label = { active ? 'Remove' : 'Add Shadow' }
4345 onPress = { ( ) => setActive ( ( v ) => ! v ) }
@@ -47,6 +49,12 @@ export function ShadowDemo() {
4749}
4850
4951const styles = StyleSheet . create ( {
52+ surface : {
53+ backgroundColor : '#e8eaf0' ,
54+ borderRadius : 12 ,
55+ padding : 32 ,
56+ alignItems : 'center' ,
57+ } ,
5058 box : {
5159 width : 100 ,
5260 height : 100 ,
0 commit comments