Skip to content

react-native-worklets only supports bridgeless mode #8366

@Zunaira-Haroon

Description

@Zunaira-Haroon

Description

"react-native": "0.81.4",
"react-native-reanimated": "^4.1.0",
"react-native-worklets": "^0.6.1",

on android it working fine but on ios when i run the app it succesfully build but after running instantly it give error:

auto isBridgeless = ![self.bridge isKindOfClass:[RCTCxxBridge class]];
  react_native_assert(isBridgeless && "[Worklets] react-native-worklets only supports bridgeless mode");

AppDelegate.swift file is

// AppDelegate.swift
import UIKit
import FBSDKCoreKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import AppAuth
import GoogleSignIn

@main
class AppDelegate: UIResponder, UIApplicationDelegate, RNAppAuthAuthorizationFlowManager {
    var window: UIWindow?
    var reactNativeDelegate: ReactNativeDelegate?
    var reactNativeFactory: RCTReactNativeFactory?
    
    // FIXED: Add required protocol property with proper access control
    @objc public weak var authorizationFlowManagerDelegate: RNAppAuthAuthorizationFlowManagerDelegate?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        // Facebook SDK initialization
        ApplicationDelegate.shared.application(
            application,
            didFinishLaunchingWithOptions: launchOptions
        )
        
        // Google Sign-In initialization
        GIDSignIn.sharedInstance.restorePreviousSignIn { user, error in
            if error != nil || user == nil {
                // No saved credentials or error
            } else {
                // User was signed in automatically
            }
        }

        // React Native initialization
        let delegate = ReactNativeDelegate()
        let factory = RCTReactNativeFactory(delegate: delegate)
        delegate.dependencyProvider = RCTAppDependencyProvider()

        reactNativeDelegate = delegate
        reactNativeFactory = factory

        window = UIWindow(frame: UIScreen.main.bounds)
        factory.startReactNative(
            withModuleName: "Arvo",
            in: window,
            launchOptions: launchOptions
        )

        return true
    }

    // Handle all redirect URLs
    func application(
        _ app: UIApplication,
        open url: URL,
        options: [UIApplication.OpenURLOptionsKey : Any] = [:]
    ) -> Bool {
        // 1. Handle Google Sign-In
        if GIDSignIn.sharedInstance.handle(url) {
            return true
        }
        
        // 2. Handle Microsoft/OAuth redirect
        if let authorizationFlowManagerDelegate = self.authorizationFlowManagerDelegate {
            if authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with: url) {
                return true
            }
        }
        
        // 3. Facebook Login URL handling
        return ApplicationDelegate.shared.application(
            app,
            open: url,
            sourceApplication: options[.sourceApplication] as? String,
            annotation: options[.annotation]
        )
    }
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
    override func sourceURL(for bridge: RCTBridge) -> URL? {
        // self.bundleURL()
    }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
}
//     override func bundleURL() -> URL? {
// #if DEBUG
//         return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
// #else
//         return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
// #endif
//     }
// }

Steps to reproduce

run app through Xcode on real device/simulator

Snack or a link to a repository

Reanimated version

4.1.0

Worklets version

0.6.1

React Native version

0.81.4

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

No response

Device

Real device

Host machine

None

Device model

iphone 14

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing infoThe user didn't precise the problem enoughMissing reproThis issue need minimum repro scenarioPlatform: iOSThis issue is specific to iOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions