HarmonyOS RN三方库react-native-oh-tpl-lottie-react-native-6.4.1-0.1.8.tgz加载lottie动画无效?

如题:HarmonyOS RN三方库react-native-oh-tpl-lottie-react-native-6.4.1-0.1.8.tgz加载lottie动画无效?

阅读 442
1 个回答

需要设置flex为1,可以参考以下demo:

import React from 'react';
import { Text, View, StyleSheet } from "react-native";
import LottieView from "lottie-react-native";
const TestPhone = () => {
    const source = require("./assets/sx_rn_loading.json");
    return (
        <View style={{ flex: 1 }}>
            <LottieView style={{ flex: 1 }}
                source={source} autoPlay loop />
        </View>
    );
};
export default TestPhone;
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进