@@ -4,14 +4,18 @@ import { Dimensions, Image, StyleSheet, Text, TouchableOpacity, View } from 'rea
44import ScalableImage from 'react-native-scalable-image'
55
66import Lightbox from './Lightbox'
7- import { font , rounded , shadow , theme } from '../styles'
7+ import { Theme } from '../@types/theme'
8+ import { font , rounded , shadow } from '../styles'
9+ import { useTheme } from '../theme/ThemeProvider'
810
911type Props = {
1012 src : string
1113 alt ?: string
1214}
1315
1416const ContentImage = ( { src, alt } : Props ) => {
17+ const theme = useTheme ( )
18+ const styles = createStyles ( theme )
1519 const [ photoIndex , setPhotoIndex ] = React . useState < number > ( )
1620 if ( ! alt ) {
1721 return < ScalableImage width = { Dimensions . get ( 'window' ) . width - 2 * theme . margin . common } source = { { uri : src } } />
@@ -53,43 +57,44 @@ const ContentImage = ({ src, alt }: Props) => {
5357
5458export default ContentImage
5559
56- const styles = StyleSheet . create ( {
57- outerContainer : {
58- margin : - theme . margin . common ,
59- marginBottom : - theme . margin . half ,
60- ...shadow . normal . ios ,
61- } ,
62- innerContainer : {
63- flexDirection : 'row' ,
64- margin : theme . margin . common ,
65- backgroundColor : theme . color . white ,
66- ...shadow . normal . android ,
67- ...rounded . large ,
68- borderWidth : 1 ,
69- borderColor : theme . color . grey50 ,
70- } ,
71- imageContainer : {
72- margin : theme . margin . common ,
73- marginRight : theme . margin . half ,
74- ...rounded . large ,
75- } ,
76- image : {
77- height : 80 ,
78- width : 80 ,
79- } ,
80- textContainer : {
81- flex : 1 ,
82- marginRight : theme . margin . common ,
83- marginLeft : theme . margin . half ,
84- justifyContent : 'center' ,
85- } ,
86- title : {
87- ...font . smallBold ,
88- color : theme . color . black ,
89- marginBottom : theme . margin . quarter ,
90- } ,
91- description : {
92- ...font . small ,
93- color : theme . color . grey500 ,
94- } ,
95- } )
60+ const createStyles = ( theme : Theme ) =>
61+ StyleSheet . create ( {
62+ outerContainer : {
63+ margin : - theme . margin . common ,
64+ marginBottom : - theme . margin . half ,
65+ ...shadow . normal . ios ,
66+ } ,
67+ innerContainer : {
68+ flexDirection : 'row' ,
69+ margin : theme . margin . common ,
70+ backgroundColor : theme . color . white ,
71+ ...shadow . normal . android ,
72+ ...rounded . large ,
73+ borderWidth : 1 ,
74+ borderColor : theme . color . grey50 ,
75+ } ,
76+ imageContainer : {
77+ margin : theme . margin . common ,
78+ marginRight : theme . margin . half ,
79+ ...rounded . large ,
80+ } ,
81+ image : {
82+ height : 80 ,
83+ width : 80 ,
84+ } ,
85+ textContainer : {
86+ flex : 1 ,
87+ marginRight : theme . margin . common ,
88+ marginLeft : theme . margin . half ,
89+ justifyContent : 'center' ,
90+ } ,
91+ title : {
92+ ...font . smallBold ,
93+ color : theme . color . black ,
94+ marginBottom : theme . margin . quarter ,
95+ } ,
96+ description : {
97+ ...font . small ,
98+ color : theme . color . grey500 ,
99+ } ,
100+ } )
0 commit comments