Skip to content

Commit

Permalink
Add flushImmediates to useAnimatedSensor (#4123)
Browse files Browse the repository at this point in the history
## Summary

When we update the shared value on the UI thread without animation, we
need manually flush queued mappers.
  • Loading branch information
piaskowyk authored Mar 3, 2023
1 parent e2a5454 commit 027d650
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/reanimated2/hook/useAnimatedSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ValueRotation,
IOSReferenceFrame,
} from '../commonTypes';
import { flushImmediates } from '../threads';

export type SensorConfig = {
interval: number | 'auto';
Expand Down Expand Up @@ -144,6 +145,7 @@ export function useAnimatedSensor(
}
}
sensorData.value = data;
flushImmediates();
}
);

Expand Down

0 comments on commit 027d650

Please sign in to comment.