fix(app): add worklet directives to working indicator functions
Functions called inside useAnimatedStyle must be marked as worklets. Missing directives caused a native crash on Android with newer react-native-reanimated/worklets that enforce UI-thread safety.
This commit is contained in:
@@ -6,6 +6,7 @@ export const WORKING_INDICATOR_OFFSETS = [
|
|||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
function normalizePhase(value: number): number {
|
function normalizePhase(value: number): number {
|
||||||
|
"worklet";
|
||||||
const wrapped = value % 1;
|
const wrapped = value % 1;
|
||||||
return wrapped < 0 ? wrapped + 1 : wrapped;
|
return wrapped < 0 ? wrapped + 1 : wrapped;
|
||||||
}
|
}
|
||||||
@@ -14,6 +15,7 @@ export function getWorkingIndicatorDotStrength(
|
|||||||
progress: number,
|
progress: number,
|
||||||
offset: number
|
offset: number
|
||||||
): number {
|
): number {
|
||||||
|
"worklet";
|
||||||
const phase = normalizePhase(progress + offset);
|
const phase = normalizePhase(progress + offset);
|
||||||
if (phase <= 0.5) {
|
if (phase <= 0.5) {
|
||||||
return phase * 2;
|
return phase * 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user