小编Mos*_*emi的帖子

React-Native:如何添加全屏 Lottie 动画

我使用来自lottie的线性渐变,代码在ios上运行良好,但在android中它不适合全屏,渐变和视图之间有某种填充。在ios上它工作正常...我尝试了很多方法,包括购买padding到0甚至保证金到-20,但没有任何效果...有什么解决方案吗? 在此输入图像描述

import React, { Component } from 'react';
import {
  Text,
  StyleSheet,
  View,
  Platform,
  Dimensions
} from 'react-native';
import SignInScreen from './src/screens/auth/SignInScreen';
import Animation from 'lottie-react-native';

 import anim from './assets/gradient_animated_background.json';
const height = Dimensions.get('window').height + 20;
const width = Dimensions.get('window').width + 20;

export default class App extends Component {
  componentDidMount() {
    this.animation.play();
  }

  render() {
    return (
      <View style={styles.container}>
          <Animation
            ref={animation => {
              this.animation = animation;
            }}
            style={{
              backgroundColor: 'red',
              height: '100%',
              width: '100%'
            }}
            loop={true}
            source={Platform.OS === …
Run Code Online (Sandbox Code Playgroud)

react-native lottie

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

lottie ×1

react-native ×1