UNPKG

house-middleware-sdk

Version:

58 hosue rn native sdk

25 lines (22 loc) 657 B
import {NativeModules, LayoutAnimation} from "react-native"; const {UIManager} = NativeModules; UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); export default function startLayoutAnimation(duration, type, callback) { if (!duration) { duration = 150; } if (!type) { type = LayoutAnimation.Types.linear; } LayoutAnimation.configureNext({ duration: duration, //持续时间 update: { // 视图更新 type: type, springDamping: 0.4 } }); callback && setTimeout(() => { callback(); }, duration); }