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

Support new React Native architecture #42

Open
chris-sark opened this issue Aug 3, 2024 · 10 comments
Open

Support new React Native architecture #42

chris-sark opened this issue Aug 3, 2024 · 10 comments

Comments

@chris-sark
Copy link

chris-sark commented Aug 3, 2024

Hello,

I am having a very similar issue to this one. The extension is hanging in the exact same way as the video in that issue, and I am unsure why. I have excluded expo-updates as well as most other expo packages I don't need, and for some reason I'm still getting crashes.

related files:

app.json

"plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          }
        }
      ],
      "expo-router",
      [
        "expo-secure-store",
        {
          "faceIDPermission": "Allow $(PRODUCT_NAME) to access your Face ID biometric data."
        }
      ],
      "expo-font",
     [ "expo-share-extension",
      {
        "excludedPackages": [
          "expo-build-properties",
          "expo-clipboard",
          "expo-constants",
          "expo-contacts",
          "expo-dev-client",
          "expo-device",
          "expo-font",
          "expo-image-picker",
          "expo-image",
          "expo-insights",
          "expo-linking",
          "expo-mail-composer",
          "expo-notifications",
          "expo-secure-store",
          "expo-sms",
          "expo-splash-screen",
          "expo-status-bar",
          "expo-updates",
          "expo-web-browser"
        ],
        "backgroundColor": {
          "red": 255,
          "green": 255,
          "blue": 255,
          "alpha": 0.8
        },
        "height": 500
      }
     ]
    ],

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['react-native-reanimated/plugin'],
  };
};

package.json

{
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@expo-google-fonts/inter": "^0.2.3",
    "@faker-js/faker": "^8.4.1",
    "@gorhom/bottom-sheet": "^4.6.4",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-masked-view/masked-view": "^0.3.1",
    "@react-native-menu/menu": "^1.1.0",
    "@react-navigation/native": "^6.1.17",
    "@types/react": "~18.2.79",
    "axios": "^1.7.2",
    "expo": "~51.0.24",
    "expo-av": "~14.0.6",
    "expo-build-properties": "~0.12.4",
    "expo-clipboard": "~6.0.3",
    "expo-constants": "~16.0.2",
    "expo-contacts": "~13.0.5",
    "expo-dev-client": "~4.0.21",
    "expo-device": "~6.0.2",
    "expo-file-system": "~17.0.1",
    "expo-font": "~12.0.5",
    "expo-image": "~1.12.13",
    "expo-image-picker": "~15.0.7",
    "expo-insights": "~0.7.0",
    "expo-linear-gradient": "~13.0.2",
    "expo-linking": "~6.3.1",
    "expo-mail-composer": "~13.0.1",
    "expo-notifications": "~0.28.14",
    "expo-router": "~3.5.20",
    "expo-secure-store": "~13.0.2",
    "expo-share-extension": "^1.10.2",
    "expo-sms": "^12.0.1",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-updates": "~0.25.21",
    "expo-web-browser": "~13.0.3",
    "libphonenumber-js": "^1.11.2",
    "lodash": "^4.17.21",
    "patch-package": "^8.0.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "^0.74.3",
    "react-native-element-dropdown": "^2.12.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-gradients": "^2.1.1",
    "react-native-indicators": "^0.17.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-pager-view": "6.3.0",
    "react-native-progress-wheel": "^2.1.0",
    "react-native-reanimated": "^3.10.1",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-share": "^10.2.1",
    "react-native-svg": "15.2.0",
    "react-native-swipe-list-view": "^3.2.9",
    "react-native-tab-view": "^3.5.2",
    "react-native-toast-message": "^2.2.0",
    "react-native-uuid": "^2.0.2",
    "react-native-view-shot": "^3.8.0",
    "react-native-web": "~0.19.10",
    "react-native-web-refresh-control": "^1.1.2",
    "react-redux": "^9.1.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "name": "app",
  "version": "1.0.0",
  "private": true,
  "main": "index.js",
}

All other files are the same as in the previously mentioned issue. the only other difference is that I am using eas build instead of prebuild. I did try running prebuild to see if there was maybe a problem with using eas build, but it still crashes. Let me know what I might be missing. Thanks!

@chris-sark
Copy link
Author

chris-sark commented Aug 27, 2024

@MaxAst Still running into this issue and I'm totally unsure why. When I run it through the xcode debugger by attaching a debugger to the process, these are the logs I get:

🟢 Registering module 'ExpoAsset'
🟢 Registering module 'ExpoVideoView'
🟢 Registering module 'EASClient'
🟢 Registering module 'ExponentFileSystem'
🟢 Registering module 'ExpoHaptics'
🟢 Registering module 'ExpoKeepAwake'
🟢 Registering module 'ExpoLinearGradient'
🟢 Registering module 'ExpoHead'
🟢 Registering module 'ExpoShareExtension'
🟢 Registering module 'ExpoDevLauncherInternal'
🟢 Registering module 'ExpoDevLauncherAuth'
🟢 Registering module 'RNCSafeAreaProvider'
🟢 Registering module 'ExpoDevMenu'
🟢 Registering module 'ExpoDevMenuInternal'
🟢 Registering module 'DevMenuPreferences'
🟢 Registering module 'RNCSafeAreaProvider'
AddInstanceForFactory: No factory registered for id <CFUUID 0x11051aca0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
-[_EXSinkLoadOperator loadItemForTypeIdentifier:completionHandler:expectedValueClass:options:] nil expectedValueClass allowing {(
    _EXItemProviderSandboxedResource,
    NSData,
    NSNumber,
    NSDictionary,
    NSError,
    NSArray,
    NSUUID,
    NSString,
    NSDate,
    CKShare,
    UIImage,
    DDRemoteActionContext,
    NSValue,
    NSURL
)}
Running application shareExtension ({
    initialProps =     {
        url = "https://www.apple.com/";
    };
    rootTag = 1;
})
Unbalanced calls start/end for tag 19

And then the process just aborts. Would love some more insight here if you have any, thanks!

Attached is an img with data re memory useage, etc.
Screenshot 2024-08-26 at 9 35 10 PM

@chris-sark
Copy link
Author

chris-sark commented Aug 28, 2024

@MaxAst As a third follow up - I tried to get the share extension working with a minimum reproducible example, but I'm still running into the same issue. Here is the repo for the example - all the files are there. I essentially just ran npx create-expo-app@latest and then followed the install instructions for expo share extension. To run, npm install -> npx expo prebuild -p ios --clean -> npx expo run:ios should do the trick.

Please let me know if you can help out here, thanks!

@chris-sark
Copy link
Author

@MaxAst Okay! I finally figured out what was causing the issue: it's because I'm using the new react native architecture through expo's expo-build-properties. In my plugins, I have the following:

      [
        "expo-build-properties",
        {
          "ios": {
            "newArchEnabled": true
          }
        }
      ],

and when I remove it, there's no crash!

Going to update this card to detail 'support new architecture'.

Thx again for the lib, going to be using this all the time

@chris-sark chris-sark changed the title Extension hanging / not loading Support new React Native architecture Aug 28, 2024
@MaxAst
Copy link
Owner

MaxAst commented Aug 29, 2024

ohh interesting, thanks for reporting @chris-sark! I'll make sure that the new architecture is supported going forward. Sorry for getting back to you late, I haven't had much time for expo-share-extension over the past month

@chris-sark
Copy link
Author

No worries! I'll likely be around a lot posting bugs / requests, looking forward to collaborating!

While I have you - what's the best way to share data between the extension and the main app via async storage? I need to make an api call in the share extension which requires a token stored in async storage under the main app.

Thanks again!

@MaxAst
Copy link
Owner

MaxAst commented Aug 30, 2024

For that I use react-native-mmkv

@AkbarKhamid
Copy link

AkbarKhamid commented Sep 5, 2024

@MaxAst Hi, may I ask how you are using mmkv without the new arch enabled? mmkv supports app groups from the version 3 and up which requires the new arch.
I had a similar use case so I upgraded to new arch, unfortunately now this package is crashing...

@chris-sark
Copy link
Author

@AkbarKhamid I ended up using react-native-shared-group-preferences, although I imagine you could just download an older version of mmkv (v2.x.x) as that does not require new arch

@AkbarKhamid
Copy link

I do not think app groups are supported by mmkv in versions below 3.x (per the release notes).
I will try to setup react-native-shared-group-preferences then.

@MaxAst
Copy link
Owner

MaxAst commented Dec 10, 2024

I've got everything working aside from an issue with font scaling. Once this is fixed, the new architecture is ready

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

3 participants