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

Cannot add new property '__reanimatedHostObjectRef' #296

Closed
wanted-o opened this issue Nov 1, 2022 · 10 comments
Closed

Cannot add new property '__reanimatedHostObjectRef' #296

wanted-o opened this issue Nov 1, 2022 · 10 comments
Assignees
Labels
bug Something isn't working needs review The issue has been solved, Wait for confirmation. P1

Comments

@wanted-o
Copy link

wanted-o commented Nov 1, 2022

Describe the bug
I can't use an array of objects coming from Redux selector, it causes crash Cannot add new property '__reanimatedHostObjectRef'. Making a deep copy with JSON.parse(JSON.stringify(props.items)) solves the problem.

To Reproduce
Steps to reproduce the behavior:

  1. Use data from Redux selector
  2. See error

Expected behavior
It shouldn’t cause a crash.

Screenshots

Versions (please complete the following information):

  • react: v18.0.0
  • react-native: v0.69.6
  • react-native-reanimated: v2.10.0
  • react-native-reanimated-carousel: v3.1.1
  • react-native-gesture-handler: v2.5.0

Smartphone (please complete the following information):

  • Device: iPhone 13
  • OS: iOS 16.0

Additional context
The crash was before and issue was resolved here Closed issue but in react-native-reanimated-carousel: v3.1.1 it reappeared.

@wanted-o wanted-o added the bug Something isn't working label Nov 1, 2022
@oleksandr-dziuban
Copy link

Hi guys, have the same issue.

If you have some free time, could you please check? Thanks a lot

@wfern
Copy link

wfern commented Nov 1, 2022

Hey guys! I have this issue too after upgrade to 3.1.1, but I was able to fix it by "reducing" the item object, e.g:

BEFORE:

// Each user has a lot of data
const users = useSelector(({ userGroup }) => userGroup.users);

AFTER:

// Now, each user have only the necessary data
const loungeUsers = useSelector(({ userGroup }) =>
  userGroup.users.map((user) => {
    return {
      id: user.id,
      name: user.name,
      pictureUrl: user.pictureUrl,
    };
  }),
);

I don't know if it was because every item has a lot of data or it has a specific kind of data... But for me "reducing" the object that works.

And then, if not works, downgrading to 3.1.0 temporarily solves the issue too.

Please guys, test it and send a feedback, it helps the maintainers to have a north.

@dohooo
Copy link
Owner

dohooo commented Nov 1, 2022

Sorry, I've been working all day. I am really busy. It's a little tiring for me to maintain this project right now. 😞
Released in 3.1.2, and tell me the result, please. thx

@dohooo dohooo closed this as completed Nov 1, 2022
@dohooo dohooo added needs review The issue has been solved, Wait for confirmation. P1 labels Nov 1, 2022
@wfern
Copy link

wfern commented Nov 1, 2022

Hey guys! I have this issue too after upgrade to 3.1.1, but I was able to fix it by "reducing" the item object, e.g:

BEFORE:

// Each user has a lot of data
const users = useSelector(({ userGroup }) => userGroup.users);

AFTER:

// Now, each user have only the necessary data
const loungeUsers = useSelector(({ userGroup }) =>
  userGroup.users.map((user) => {
    return {
      id: user.id,
      name: user.name,
      pictureUrl: user.pictureUrl,
    };
  }),
);

I don't know if it was because every item has a lot of data or it has a specific kind of data... But for me "reducing" the object that works.

And then, if not works, downgrading to 3.1.0 temporarily solves the issue too.

Please guys, test it and send a feedback, it helps the maintainers to have a north.

After testing a little more, this issue still occurs on 3.1.2.

If the item data coming from redux has an object the error occurs. E.g:

{
  id: item.id,
  // this will not work
  objectExample: item.objectExample
}

but if you spread/copy the object, it will work, e.g:

{
  id: item.id,
  // this will work
  objectExample: { ...item.objectExample }
}

It's strange because it was not a issue on 3.1.0

@dohooo
Copy link
Owner

dohooo commented Nov 1, 2022

Hey guys! I have this issue too after upgrade to 3.1.1, but I was able to fix it by "reducing" the item object, e.g:
BEFORE:

// Each user has a lot of data
const users = useSelector(({ userGroup }) => userGroup.users);

AFTER:

// Now, each user have only the necessary data
const loungeUsers = useSelector(({ userGroup }) =>
  userGroup.users.map((user) => {
    return {
      id: user.id,
      name: user.name,
      pictureUrl: user.pictureUrl,
    };
  }),
);

I don't know if it was because every item has a lot of data or it has a specific kind of data... But for me "reducing" the object that works.
And then, if not works, downgrading to 3.1.0 temporarily solves the issue too.
Please guys, test it and send a feedback, it helps the maintainers to have a north.

After testing a little more, this issue still occurs on 3.1.2.

If the item data coming from redux has an object the error occurs. E.g:

{
  id: item.id,
  // this will not work
  objectExample: item.objectExample
}

but if you spread/copy the object, it will work, e.g:

{
  id: item.id,
  // this will work
  objectExample: { ...item.objectExample }
}

It's strange because it was not a issue on 3.1.0

Could you give me a repo that includes minimal reproducing?

@dohooo dohooo reopened this Nov 1, 2022
@dohooo
Copy link
Owner

dohooo commented Nov 1, 2022

OH, wait. Maybe I found a resolution. @wfern

@dohooo dohooo closed this as completed in a5af02a Nov 1, 2022
@dohooo
Copy link
Owner

dohooo commented Nov 1, 2022

3.1.3

@dohooo dohooo closed this as completed Nov 1, 2022
@wanted-o
Copy link
Author

wanted-o commented Nov 2, 2022

Hello @dohooo, checked 3.1.3 and the same crash still exist. Could you check?

@wanted-o
Copy link
Author

wanted-o commented Nov 2, 2022

I found the same issue in react-native-reanimated library, maybe it will help you to resolve the issue.
software-mansion/react-native-reanimated#1517

@ShaneZhengNZ
Copy link

We get the same crash. Woked fine with 3.0.6, but crashed with 3.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs review The issue has been solved, Wait for confirmation. P1
Projects
None yet
Development

No branches or pull requests

5 participants