margelo / react-native-worklets-core

🧵 A library to run JS functions ("Worklets") on separate Threads
https://margelo.io
MIT License
552 stars 37 forks source link

"The following Swift pods cannot yet be integrated as static libraries" Error | pod install #209

Open lukachi opened 2 months ago

lukachi commented 2 months ago

The error:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `VisionCamera` depends upon `react-native-worklets-core`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

image

The app builds and run correctly if i install vision-camera only, or worklets-core only. But when i try to use both - it fails in pod-install:

i've tried to set use_modular_headers! to Podfile and seems like other modules ain't like this move, so then i've tried :modular_headers => true for specific pods e.g. VisonCamera and WorkletsCore, both and separately. still got error

i've tried to remove all build caches from xcode, removed ios, android folders, node_modules, yarn.lock and reinstall everything, and still got this error

note: that worklets inits for android fine

image

versions:

"react-native-vision-camera": "^4.5.2", "react-native-worklets-core": "^1.3.3",

Environment:

Dependencies

"dependencies": {
    "@dev-plugins/react-navigation": "^0.0.6",
    "@dev-plugins/react-query": "^0.0.6",
    "@distributedlab/tools": "^1.0.0-rc.16",
    "@gorhom/bottom-sheet": "^4.6.4",
    "@hookform/resolvers": "^3.9.0",
    "@react-native-community/hooks": "^3.0.0",
    "@react-native/js-polyfills": "^0.74.85",
    "@react-navigation/bottom-tabs": "^7.0.0-rc.26",
    "@react-navigation/elements": "^2.0.0-rc.19",
    "@react-navigation/native": "^7.0.0-rc.17",
    "@react-navigation/native-stack": "^7.0.0-rc.22",
    "@tanstack/react-query": "^5.51.9",
    "app-icon-badge": "^0.0.15",
    "axios": "^1.7.2",
    "babel-preset-expo": "^11.0.12",
    "burnt": "^0.12.2",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "constants-browserify": "^1.0.0",
    "expo": "51.0.26",
    "expo-asset": "~10.0.10",
    "expo-build-properties": "~0.12.3",
    "expo-clipboard": "~6.0.3",
    "expo-constants": "~16.0.2",
    "expo-dev-client": "~4.0.21",
    "expo-file-system": "~17.0.1",
    "expo-font": "~12.0.8",
    "expo-image": "~1.12.13",
    "expo-linking": "~6.3.1",
    "expo-local-authentication": "~14.0.1",
    "expo-secure-store": "~13.0.2",
    "expo-splash-screen": "^0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "i18next": "^23.11.5",
    "jsona": "^1.12.1",
    "lodash": "^4.17.21",
    "mrz": "^4.2.0",
    "nativewind": "^4.0.36",
    "os-browserify": "^0.3.0",
    "path-browserify": "^1.0.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.52.1",
    "react-i18next": "^14.1.2",
    "react-native": "0.74.5",
    "react-native-avoid-softinput": "^5.0.0",
    "react-native-crypto": "^2.2.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-get-random-values": "^1.11.0",
    "react-native-mmkv": "^3.0.0-beta.7",
    "react-native-quick-base64": "^2.1.2",
    "react-native-reanimated": "^3.15.0",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "4.10.8",
    "react-native-screens": "3.32.0",
    "react-native-toast-message": "^2.2.0",
    "react-native-vision-camera": "^4.5.2",
    "react-native-vision-camera-text-recognition": "^3.1.1",
    "react-native-worklets-core": "^1.3.3",
    "readable-stream": "^4.5.2",
    "stream-http": "^3.2.0",
    "tailwind-merge": "^2.4.0",
    "tailwind-variants": "^0.2.1",
    "tailwindcss": "^3.4.5",
    "tailwindcss-animate": "^1.0.7",
    "uuid": "^10.0.0",
    "yup": "^1.4.0",
    "zod": "^3.23.8",
    "zustand": "^4.5.4"
  },
  "devDependencies": {
    "@babel/core": "^7.24.6",
    "@expo/config": "~9.0.2",
    "@expo/metro-config": "~0.18.4",
    "@expo/metro-runtime": "~3.2.1",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tanstack/eslint-plugin-query": "^5.51.10",
    "@testing-library/jest-dom": "^6.4.6",
    "@types/eslint": "^8.56.10",
    "@types/jest": "^29.5.12",
    "@types/lodash": "^4",
    "@types/path-browserify": "^1",
    "@types/react": "~18.2.79",
    "@types/react-native-get-random-values": "^1.8.2",
    "@types/readable-stream": "^4",
    "@types/uuid": "^10",
    "@typescript-eslint/eslint-plugin": "^7.1.0",
    "@typescript-eslint/parser": "^7.1.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "dotenv": "^16.4.5",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-i18n-json": "^4.0.0",
    "eslint-plugin-jest": "^28.6.0",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-simple-import-sort": "^12.1.1",
    "eslint-plugin-testing-library": "^6.2.2",
    "eslint-plugin-unused-imports": "^4.0.0",
    "jest": "^29.7.0",
    "jest-environment-jsdom": "^29.7.0",
    "jest-expo": "~51.0.3",
    "jest-junit": "^16.0.0",
    "prettier": "^3.3.3",
    "prettier-plugin-tailwindcss": "^0.6.5",
    "react-native-svg": "15.2.0",
    "react-native-svg-transformer": "^1.5.0",
    "ts-jest": "^29.1.2",
    "typescript": "~5.3.3"
  }

Expo build properties plugin config:

    [
      'expo-build-properties',
      {
        android: {
          kotlinVersion: '1.7.22', // this is for softinput package
          minSdkVersion: 27,
          targetSdkVersion: 34,
          newArchEnabled: true
        },
        ios: {
          newArchEnabled: true,
        },
      },
    ],
kbqdev commented 1 month ago
FaggioniHQ commented 1 week ago

Hello There,

Any workaround for this????

Thanks in advance :)

matuskropuch commented 8 hours ago

hi @FaggioniHQ, I am a little reckless so I did this (until we get the new version published). It runs, but I cannot vouch for all the consequences this can cause:

  1. replace node_modules/react-native-worklets-core/react-native-worklets-core.podspec with the new code from #217 that fixes this issue https://github.com/margelo/react-native-worklets-core/blob/e348ecfaff81e531cb616904df7d927823bef618/package/react-native-worklets-core.podspec
  2. install and setup patch-package to auto-apply this patch after you reinstall node_modules https://www.npmjs.com/package/patch-package
  3. npx patch-package react-native-worklets-core
  4. rm -rf ios
  5. npx expo run ios --device
  6. voila, it works 🥳

I don't know if the changes to podspec file cause any side effects, so proceed with caution.

FaggioniHQ commented 5 hours ago

Hey @matuskropuch

I did the same as you, seems to work 🤞🏽

Thanks for your reply