Skip to content

Wrong State Value Inside Reanimated Callback #1376

Answered by ngseba
ngseba asked this question in Q&A
Discussion options

You must be logged in to vote

Upon better reading the documentation I made it work by using the useCode hook. Hopefully I can apply the same thing on the actual project I have to work on.

Here's a snippet of the working solution if anyone else has this problem:

import * as React from 'react';
import { LongPressGestureHandler, State } from "react-native-gesture-handler";
import { View, StyleSheet, Text, Button } from "react-native";
import { useState } from "react";
import Animated, { event, block, call, set, useValue, useCode, onChange } from "react-native-reanimated";


export const TestContainer = () => {
  const [color, setColor] = useState('red');
  const handlerState = useValue(State.UNDETERMINED);

  const probl…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jakub-gonet
Comment options

Answer selected by ngseba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1375 on February 22, 2021 17:29.