@@ -66,22 +66,19 @@ export const CreatePollContent = () => {
6666
6767 useEffect ( ( ) => {
6868 if ( ! createPollOptionHeight ) return ;
69+ const newCurrentOptionPositions : CurrentOptionPositionsCache = {
70+ inverseIndexCache : { } ,
71+ positionCache : { } ,
72+ } ;
6973 options . forEach ( ( option , index ) => {
70- currentOptionPositions . value = {
71- ...currentOptionPositions . value ,
72- inverseIndexCache : {
73- ...currentOptionPositions . value . inverseIndexCache ,
74- [ index ] : option . id ,
75- } ,
76- positionCache : {
77- ...currentOptionPositions . value . positionCache ,
78- [ option . id ] : {
79- updatedIndex : index ,
80- updatedTop : index * createPollOptionHeight ,
81- } ,
82- } ,
74+ newCurrentOptionPositions . inverseIndexCache [ index ] = option . id ;
75+ newCurrentOptionPositions . positionCache [ option . id ] = {
76+ updatedIndex : index ,
77+ updatedTop : index * createPollOptionHeight ,
8378 } ;
8479 } ) ;
80+ console . log ( 'TEST' , newCurrentOptionPositions ) ;
81+ currentOptionPositions . value = newCurrentOptionPositions ;
8582 } , [ createPollOptionHeight , currentOptionPositions , options ] ) ;
8683
8784 const onBackPressHandler = useCallback ( ( ) => {
@@ -104,7 +101,7 @@ export const CreatePollContent = () => {
104101 style = { [ styles . scrollView , { backgroundColor : white } , scrollView ] }
105102 >
106103 < NameField />
107- < CreatePollOptions currentOptionPositions = { currentOptionPositions } />
104+ < CreatePollOptions currentOptionPositions = { currentOptionPositions } options = { options } />
108105 < MultipleAnswersField />
109106 < View
110107 style = { [ styles . textInputWrapper , { backgroundColor : bg_user } , anonymousPoll . wrapper ] }
0 commit comments