react-native-lottie-splash-screen ios 에러 해결 : Cannot initialize a variable of type 'UIView

Darcy Daeseok YU ·2022년 6월 22일
0

라이브러리가 정말 mf다

에러 내용

Cannot initialize a variable of type 'UIView __strong' with an rvalue of type 'AnimationView '

Cannot initialize a parameter of type 'AnimationView _Nonnull' with an lvalue of type 'UIView __strong'

AppDelegate.m에서 발생하는 오류

아래를

Dynamic *t = [Dynamic new];
UIView *animationView = [t createAnimationViewWithRootView:rootView lottieName:@"loading"];
  
  
   animationView.backgroundColor = [UIColor whiteColor];
  // change backgroundColor

    // register LottieSplashScreen to RNSplashScreen
    [RNSplashScreen showLottieSplash:animationView inRootView:rootView];

    // 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];

다음과 같이 수정한다.

Dynamic *t = [Dynamic new];
  
  UIView *animationView = (UIView *)[t createAnimationViewWithRootView:rootView lottieName:@"loading"];
  
  
   animationView.backgroundColor = [UIColor whiteColor];
  // change backgroundColor

    // register LottieSplashScreen to RNSplashScreen
    [RNSplashScreen showLottieSplash:animationView inRootView:rootView];

    // play
    [t playWithAnimationView:(AnimationView *)animationView];

    // If you want the animation layout to be forced to remove when hide is called, use this code
    [RNSplashScreen setAnimationFinished:true];
profile
React, React-Native https://darcyu83.netlify.app/

0개의 댓글