RN经验(二)

  • 此文全部以react-native0.60.x版本以上为基准。
1.从2020年4月开始,所有使⽤ iOS13 SDK的 App将必须提供 LaunchScreen,LaunchImage即将退出历史舞台。
  • 首先设置好LaunchScreen.xib后,使用react-native-splash-screen增加启动页动画 修改RNSplashScreen+ (void)hide方法
    注意: 将启动图放在项目文件的目录下面(如果放在Assets.xcassets中会出现短暂白屏,原因未知。)
+ (void)hide {
    if (waiting) {
        dispatch_async(dispatch_get_main_queue(), ^{
            waiting = false;
        });
    } else {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
              // 原方法
              //  [loadingView removeFromSuperview];
              // 改为淡出缩放动画
            [UIView animateWithDuration:1.0f delay:0.5f options:UIViewAnimationOptionBeginFromCurrentState animations:^{
                loadingView.alpha = 0.0f;
                loadingView.layer.transform = CATransform3DScale(CATransform3DIdentity, 2.0f, 2.0f, 1.0f);
            } completion:^(BOOL finished) {
                [loadingView removeFromSuperview];
            }];
        });
    }
}
2. pod install error: JSON::ParserError - 767: unexpected token at ''
gem list --local | grep cocoapods
sudo gem uninstall (all the items in the list)
sudo rm -rf ~/.cocoapods
sudo gem install cocoapods -v 1.9.1
cd (PROJECT DIRECTORY)
pod init
(put cocoapod in podfile)
pod install
rm -rf ~/.cocoapods/repos/trunk/
pod cache clean --all
pod install

你可能感兴趣的:(RN经验(二))