Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worklets.createSharedValue can't set fields on an object value individually #182

Open
caheinz2 opened this issue May 2, 2024 · 0 comments

Comments

@caheinz2
Copy link
Contributor

caheinz2 commented May 2, 2024

I can't create a shared value that contains an object and then update the object's fields later. The get_set_object_value test in sharedvalue-tests.ts describes exactly what I am trying to do, and the test seems to be failing in release 1.2.0.

  get_set_object_value: () => {
    const sharedValue = Worklets.createSharedValue({ a: 100, b: 200 });
    sharedValue.value.a = 50;
    sharedValue.value.b = 100;
    return ExpectValue(sharedValue.value, { a: 50, b: 100 });
  },

The test output is:

 LOG  Running "WorkletsExample" with {"rootTag":11}
 LOG  Starting test with index 1
 LOG  Running test: get_set_object_value
 LOG  Loading react-native-worklets-core...
 LOG  Worklets loaded successfully
 LOG  ExpectValue, resolved: {"a": 100, "b": 200}
 LOG  ExpectValue, failed: Expected {"a":50,"b":100}, got {"a":100,"b":200}.
 LOG  Test: get_set_object_value failed.

I can only update the entire sharedValue like so:

  sharedValue.value = {
    a: 50,
    b: 100,
  };

I believe this is a regression of #178.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant