@@ -40,25 +40,21 @@ export const PollAllOptionsContent = ({
4040
4141 const {
4242 theme : {
43- colors : { bg_user, black, white } ,
4443 poll : {
4544 allOptions : { listContainer, titleContainer, titleText, wrapper } ,
4645 } ,
4746 } ,
4847 } = useTheme ( ) ;
48+ const styles = useAllOptionStyles ( ) ;
4949
5050 return (
51- < ScrollView
52- contentContainerStyle = { { paddingBottom : 70 } }
53- style = { [ styles . allOptionsWrapper , { backgroundColor : white } , wrapper ] }
54- { ...additionalScrollViewProps }
55- >
56- < View style = { [ styles . allOptionsTitleContainer , { backgroundColor : bg_user } , titleContainer ] } >
57- < Text style = { [ styles . allOptionsTitleText , { color : black } , titleText ] } > { name } </ Text >
51+ < ScrollView style = { [ styles . allOptionsWrapper , wrapper ] } { ...additionalScrollViewProps } >
52+ < View style = { [ styles . allOptionsTitleContainer , titleContainer ] } >
53+ < Text style = { [ styles . allOptionsTitleText , titleText ] } > { name } </ Text >
5854 </ View >
59- < View style = { [ styles . allOptionsListContainer , { backgroundColor : bg_user } , listContainer ] } >
55+ < View style = { [ styles . allOptionsListContainer , listContainer ] } >
6056 { options ?. map ( ( option : PollOptionClass ) => (
61- < View key = { `full_poll_options_${ option . id } ` } style = { { paddingVertical : 16 } } >
57+ < View key = { `full_poll_options_${ option . id } ` } style = { styles . optionWrapper } >
6258 < PollOption key = { option . id } option = { option } showProgressBar = { false } />
6359 </ View >
6460 ) ) }
@@ -134,15 +130,15 @@ export const PollOption = ({ option, showProgressBar = true }: PollOptionProps)
134130 < Text style = { [ styles . votesText , votesText ] } > { voteCountsByOption [ option . id ] || 0 } </ Text >
135131 </ View >
136132 </ View >
137- < View style = { styles . progressBarContainer } >
138- { showProgressBar ? (
133+ { showProgressBar ? (
134+ < View style = { styles . progressBarContainer } >
139135 < ProgressBar
140136 progress = { votes / maxVotes }
141137 filledColor = { filledColor }
142138 emptyColor = { unFilledColor }
143139 />
144- ) : null }
145- </ View >
140+ </ View >
141+ ) : null }
146142 </ View >
147143 </ View >
148144 ) ;
@@ -256,18 +252,39 @@ const useStyles = () => {
256252 } , [ semantics ] ) ;
257253} ;
258254
259- const styles = StyleSheet . create ( {
260- allOptionsListContainer : {
261- borderRadius : 12 ,
262- marginTop : 32 ,
263- paddingBottom : 18 ,
264- paddingHorizontal : 16 ,
265- } ,
266- allOptionsTitleContainer : {
267- borderRadius : 12 ,
268- paddingHorizontal : 16 ,
269- paddingVertical : 18 ,
270- } ,
271- allOptionsTitleText : { fontSize : 16 , fontWeight : '500' } ,
272- allOptionsWrapper : { flex : 1 , marginBottom : 16 , padding : 16 } ,
273- } ) ;
255+ const useAllOptionStyles = ( ) => {
256+ const {
257+ theme : { semantics } ,
258+ } = useTheme ( ) ;
259+ return useMemo (
260+ ( ) =>
261+ StyleSheet . create ( {
262+ allOptionsListContainer : {
263+ borderRadius : primitives . radiusLg ,
264+ padding : primitives . spacingMd ,
265+ backgroundColor : semantics . backgroundCoreSurfaceCard ,
266+ marginTop : primitives . spacing2xl ,
267+ } ,
268+ allOptionsTitleContainer : {
269+ borderRadius : primitives . radiusLg ,
270+ padding : primitives . spacingMd ,
271+ backgroundColor : semantics . backgroundCoreSurfaceCard ,
272+ } ,
273+ allOptionsTitleText : {
274+ fontSize : primitives . typographyFontSizeLg ,
275+ lineHeight : primitives . typographyLineHeightRelaxed ,
276+ fontWeight : primitives . typographyFontWeightSemiBold ,
277+ color : semantics . textPrimary ,
278+ } ,
279+ allOptionsWrapper : {
280+ flex : 1 ,
281+ padding : primitives . spacingMd ,
282+ backgroundColor : semantics . backgroundElevationElevation1 ,
283+ } ,
284+ optionWrapper : {
285+ paddingVertical : primitives . spacingMd ,
286+ } ,
287+ } ) ,
288+ [ semantics ] ,
289+ ) ;
290+ } ;
0 commit comments