Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
use proxy instead of {}
  • Loading branch information
sumo-slonik committed Nov 22, 2024
1 parent 1c180c3 commit 7e3c4ef
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions packages/react-native-reanimated/src/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,31 @@ const hook = {
// useHandler: ADD ME IF NEEDED
useWorkletCallback: ID,
useSharedValue: <Value>(init: Value) => {
let value = init;

return {
set: (newValue: Value) => {
value = newValue;
let value = { value: init }
const handler = {
get(target: any, prop: string) {
if (prop === 'value') {
return target.value;
}
if (prop === 'get') {
return () => target.value;
}
if (prop === 'set') {
return (newValue: Value) => {
target.value = newValue;
};
}
return undefined;
},
get: () => value
set(target: any, prop: string, newValue: any) {
if (prop === 'value') {
target.value = newValue;
return true;
}
return false;
}
};
return new Proxy(value, handler);
},
// useReducedMotion: ADD ME IF NEEDED
useAnimatedStyle: IMMEDIATE_CALLBACK_INVOCATION,
Expand Down

0 comments on commit 7e3c4ef

Please sign in to comment.