Animation not showing on iOs
AngelRmrz opened this issue · comments
Angel Ramirez commented
The output of react-native info
System:
OS: macOS 14.4
CPU: (8) arm64 Apple M2
Memory: 85.13 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.18.2
path: ~/.nvm/versions/node/v18.18.2/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v18.18.2/bin/yarn
npm:
version: 9.8.1
path: ~/.nvm/versions/node/v18.18.2/bin/npm
Watchman:
version: 2023.10.09.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.14.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- visionOS 1.0
- watchOS 10.2
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 15.2/15C500b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.21
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Version of react-native-splash screen: ^1.1.2
Here is the AppDelegate
code
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import "RNSplashScreen.h"
#import "App-Swift.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"App";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
BOOL success = [super application:application didFinishLaunchingWithOptions:launchOptions];
if (success) {
UIView *rootView = self.window.rootViewController.view;
rootView.backgroundColor = [UIColor whiteColor];
Dynamic *t = [Dynamic new];
UIView *animationUIView = (UIView *)[t createAnimationViewWithRootView:rootView lottieName:@"splash_screen"];
[RNSplashScreen showLottieSplash:animationUIView inRootView:rootView];
LottieAnimationView *animationView = (LottieAnimationView *) animationUIView;
[t playWithAnimationView:animationView];
[RNSplashScreen setAnimationFinished:true];
}
return success;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
Here is the Dynamic.swift
archive
import UIKit
import Foundation
import Lottie
@objc class Dynamic: NSObject {
@objc func createAnimationView(rootView: UIView, lottieName: String) -> LottieAnimationView {
let animationView = LottieAnimationView(name: lottieName)
animationView.frame = rootView.frame
animationView.center = rootView.center
animationView.backgroundColor = UIColor.white;
return animationView;
}
@objc func play(animationView: LottieAnimationView) {
animationView.play(
completion: { (success) in
RNSplashScreen.setAnimationFinished(true)
}
);
}
}
I can't provide more reproducible code because, it works on android, but on iOs, keeps throwing the default splash screen.
Simulator.Screen.Recording.-.iPhone.Xs.-.2024-03-26.at.16.31.48.mp4
Ashish Verma commented
In AppDeligate.m file comment the line:
// self.initialProps = @{};
Cesar Candia commented
Hola Angel.
Una duda, tu archivo "splash_screen", ¿en donde lo ubicaste o colocaste dentro del proyecto para que tu AppDelegate lo identifique?
¿Ya lograste correr Lottie en iOS?
Saludos.
Angel Ramirez commented
Still with no response, maybe the animation layer on ios is not reading the lottie file.