react-native-lottie-splash-screen
react-native-lottie-splash-screen copied to clipboard
Not compiling when using AppDelegate.mm
Issue is happening when changing the AppDelegate.m to AppDelegate.mm
It works fine with .m It does not compile with .mm with errors in the [project]-Swift file
Attempting to use the forward class 'INIntent' as superclass of 'ConfigurationIntent' && Attempting to use the forward class 'INIntentResponse' as superclass of 'ConfigurationIntentResponse'
Anyone else is having a similar issue?
@fbotalla I don't know well about this issue. Could you try this one? https://stackoverflow.com/questions/63425027/attempting-to-use-the-forward-class-nsmanagedobjectmodel-as-superclass-of-swif#:~:text=You%20should%20set%20Enable%20modules(c%20and%20objective%20c)%20in%20build%20setting.%20Add%20%2Dfmodules%20in%20Other%20C%20Flags%2C%20add%20%2Dfcxx%2Dmodules%20in%20Other%20C%2B%2B%20Flags
https://stackoverflow.com/questions/57914899/module-swift-h-file-not-found-in-mm-file-in-building-unity-swift-framework
Also running into this issue
Issue is happening when changing the AppDelegate.m to AppDelegate.mm
It works fine with .m It does not compile with .mm with errors in the [project]-Swift file
Attempting to use the forward class 'INIntent' as superclass of 'ConfigurationIntent' && Attempting to use the forward class 'INIntentResponse' as superclass of 'ConfigurationIntentResponse'
Anyone else is having a similar issue?
did you find a fix @fbotalla ?
@HwangTaehyun Sorry it took me so long to respond. I did try those fixes but still running into the same issue. @bradherman No, I haven't found a fix. I am currently using .mm without the lottie splash.
@fbotalla I will find ways to resolve this within a few weeks. Sorry for being late.
After some struggle i m able to compile AppDelegate.mm -- instead of AnimationView we have to use LottieAnimationView
AppDelegate.mm code
#import "AppDelegate.h"
#import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> #import <React/RCTRootView.h>
// #import <GoogleMaps/GoogleMaps.h> #import <React/RCTAppSetupUtils.h> #import <Firebase.h> #import "RNSplashScreen.h" // here #import "Leeway-Swift.h" // here, change project name to yours //#import <GoogleMaps/GoogleMaps.h>
#if RCT_NEW_ARCH_ENABLED #import <React/CoreModulesPlugins.h> #import <React/RCTCxxBridgeDelegate.h> #import "React/RCTBridgeModule.h" #import <React/RCTFabricSurfaceHostingProxyRootView.h> #import <React/RCTSurfacePresenter.h> #import <React/RCTSurfacePresenterBridgeAdapter.h> #import <ReactCommon/RCTTurboModuleManager.h> #import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> { RCTTurboModuleManager *_turboModuleManager; RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig; facebook::react::ContextContainer::Shared _contextContainer; } @end #endif
@implementation AppDelegate
-
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RCTAppSetupPrepareApp(application); RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; #if RCT_NEW_ARCH_ENABLED _contextContainer = std::make_shared<facebook::react::ContextContainer const>(); _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>(); _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; #endifNSDictionary *initProps = [self prepareInitialProps]; UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"Leeway", initProps);
if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; }
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible];
Dynamic *t = [Dynamic new]; UIView *animationUIView = (UIView *)[t createAnimationViewWithRootView:rootView lottieName:@"loading"]; // change lottieName to your lottie files name animationUIView.backgroundColor = [UIColor whiteColor]; // change backgroundColor
// register LottieSplashScreen to RNSplashScreen [RNSplashScreen showLottieSplash:animationUIView inRootView:rootView];
// casting UIView type to AnimationView type LottieAnimationView *animationView = (LottieAnimationView *) animationUIView; // play [t playWithAnimationView:animationView];
// If you want the animation layout to be forced to remove when hide is called, use this code [RNSplashScreen setAnimationFinished:true];
return YES; }
/// This method controls whether the concurrentRoot
feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: true
if the concurrentRoot
feture is enabled. Otherwise, it returns false
.
-
(BOOL)concurrentRootEnabled { // Switch this bool to turn on and off the concurrent root return true; }
-
(NSDictionary *)prepareInitialProps { NSMutableDictionary *initProps = [NSMutableDictionary new];
#ifdef RCT_NEW_ARCH_ENABLED initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); #endif
return initProps; }
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif }
#if RCT_NEW_ARCH_ENABLED
#pragma mark - RCTCxxBridgeDelegate
- (std::unique_ptrfacebook::react::JSExecutorFactory)jsExecutorFactoryForBridge:(RCTBridge *)bridge { _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge delegate:self jsInvoker:bridge.jsCallInvoker]; return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); }
#pragma mark RCTTurboModuleManagerDelegate
-
(Class)getModuleClassFromName:(const char *)name { return RCTCoreModulesClassProvider(name); }
-
(std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptrfacebook::react::CallInvoker)jsInvoker { return nullptr; }
-
(std::shared_ptrfacebook::react::TurboModule)getTurboModule:(const std::string &)name initParams: (const facebook::react::ObjCTurboModule::InitParams &)params { return nullptr; }
-
(id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass { return RCTAppSetupDefaultModuleFromClass(moduleClass); }
#endif
@end
@sofian-sunny Thank you for helping out. I am getting this error
Unknown type name 'LottieAnimationView'; did you mean 'AnimationView'?
and also
Attempting to use the forward class 'INIntent' as superclass of 'ConfigurationIntent'
Did you do anything else on your end?
@HwangTaehyun I don't want to rush or put pressure, just wanting to check in on the progress ?
Thank you for the awesome library btw.