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

Upgrade to expo 49 #1

Closed
wants to merge 2 commits into from
Closed

Upgrade to expo 49 #1

wants to merge 2 commits into from

Conversation

Nasseratic
Copy link
Owner

No description provided.

@spencerc99
Copy link

@Nasseratic 👋 hey! wandering in here as I've been trying to get react-native-hold-menu to work with expo 49. Wondering if you got any further along on this?

I used the fix located in expo/expo#23539 (and I don't seem to get the error you mentioned around reanimated v3.4.0), and the blurred focus seems to be working now but the menu is not rendering. Wondering if you had already encountered this when you were working on it / if you have any pointers! thanks :)

image

@Nasseratic
Copy link
Owner Author

Nasseratic commented Sep 25, 2023

@spencerc99 Hi 👋🏼

Not truly remember, but might be related to putting an object or function in the shared value
In reanimated @3.4.2 try applying this patch that I fount here:

diff --git a/src/reanimated2/shareables.ts b/src/reanimated2/shareables.ts
index 03575ab9e4f399a6a3a6fa6e7786b92b2c671830..1bf9451adcea074339105fef0c494b118c445385 100644
--- a/src/reanimated2/shareables.ts
+++ b/src/reanimated2/shareables.ts
@@ -21,6 +21,7 @@ const _shareableFlag = Symbol('shareable flag');
 const MAGIC_KEY = 'REANIMATED_MAGIC_KEY';
 
 function isHostObject(value: NonNullable<object>): boolean {
+  "worklet"
   // We could use JSI to determine whether an object is a host object, however
   // the below workaround works well and is way faster than an additional JSI call.
   // We use the fact that host objects have broken implementation of `hasOwnProperty`
@@ -257,6 +258,15 @@ export function makeShareableCloneOnUIRecursive<T>(value: T): ShareableRef<T> {
   function cloneRecursive<T>(value: T): ShareableRef<T> {
     const type = typeof value;
     if ((type === 'object' || type === 'function') && value !== null) {
+      // apply https://github.com/software-mansion/react-native-reanimated/commit/e76311f05c661787ffcc14bb9ab71d7403d680e7
+      // @ts-expect-error
+      if (value?.__remoteFunction) {
+        // @ts-expect-error
+        return value.__remoteFunction;
+      }
+      if (isHostObject(value as object)) {
+        return value as ShareableRef<T>;
+      }
       let toAdapt: any;
       if (Array.isArray(value)) {
         toAdapt = value.map((element) => cloneRecursive(element));

@spencerc99
Copy link

hmm unfortunately doesn't work :/ thanks anyways!

so it sounds like you never managed to get it fully working?

@Nasseratic
Copy link
Owner Author

Okay, I created a newer pr with most updated code I had: enesozturk#112

I managed to get it working with this patch and these changes in the pr above

@Nasseratic
Copy link
Owner Author

Will close this pr for favor of WIP pr: enesozturk#112

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

Successfully merging this pull request may close these issues.

2 participants