我尝试像在shoutem About 扩展中那样实现英雄动画。基本上,我将 animationName 添加到 NavigationBar 和扩展中的 Image 中。我还必须添加 ScrollDriver,否则它会出错。但似乎 NavigationBar 没有将驱动程序传递给它的子组件,所以我仍然收到此错误。是否可以像这里演示的那样实现英雄动画?https://medium.com/shoutem/declare-peace-with-react-native-animations-e947332fa9b1
谢谢,
import { ScrollDriver } from '@shoutem/animation';
getNavBarProps() {
const driver = new ScrollDriver();
return {
hasHistory: true,
driver: driver,
title: 'Title',
navigateBack: () => this.props.navigation.dispatch(NavigationActions.back()),
styleName: 'fade clear',
animationName: 'solidify',
};
}
render () {
const driver = new ScrollDriver();
return (
<Screen styleName=" paper">
<View style={{height:68}}>
<NavigationBar {...this.getNavBarProps()} />
</View>
<ScrollView style={styles.container}>
<Image
styleName="large"
source={require('../Images/spa2.jpg') }
defaultSource={require('../Images/image-fallback.png')}
driver={driver}
animationName="hero"
/>
...