需要帮助React Native Image Header滚动视图



我想为我的项目添加一个图像标题滚动视图。我使用了下面的代码,这给了我错误"元素类型无效:应为字符串(用于内置组件(或类/函数(用于复合组件(,但实际为:未定义"我尽力了,但没有找到解决办法。此外,我完全不明白为什么会出现这个错误。

import React, {Component} from 'react';
import {
StyleSheet,
Text,
View,
Image,
Dimensions,
StatusBar,
} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {Header} from 'react-navigation-stack';
import HeaderImageScrollView, {
TriggeringView,
} from 'react-native-image-header-scroll-view';
const MIN_HEIGHT = Header.HEIGHT;
const MAX_HEIGHT = 250;
const styles = StyleSheet.create({
title: {
fontSize: 20,
},
section: {
padding: 20,
borderBottomWidth: 1,
borderBottomColor: '#cccccc',
backgroundColor: 'white',
},
sectionTitle: {
fontSize: 18,
fontWeight: 'bold',
},

titleContainer: {
flex: 1,
alignSelf: 'stretch',
justifyContent: 'center',
alignItems: 'center',
},
navTitleView: {
height: MIN_HEIGHT,
justifyContent: 'center',
alignItems: 'center',
paddingTop: 16,
opacity: 0,
},
navTitle: {
color: 'white',
fontSize: 18,
backgroundColor: 'transparent',
},
sectionLarge: {
height: 600,
},
});
class TvShow extends Component {
constructor() {
super();
this.state = {showNavTitle: false};
}
render() {
return (
<View style={{flex: 1}}>
<StatusBar barStyle="light-content" />
<HeaderImageScrollView
maxHeight={MAX_HEIGHT}
minHeight={MIN_HEIGHT}
maxOverlayOpacity={0.6}
minOverlayOpacity={0.3}
fadeOutForeground
renderHeader={() => (
<Text>Hiiii</Text>
)}
renderFixedForeground={() => (
<Animatable.View
style={styles.navTitleView}
ref={navTitleView => {
this.navTitleView = navTitleView;
}}>
<Text style={styles.navTitle}>
Hii
</Text>
</Animatable.View>
)}
renderForeground={() => (
<View style={styles.titleContainer}>
<Text>Hii</Text>
</View>
)}>
<TriggeringView
style={styles.section}
onHide={() => this.navTitleView.fadeInUp(200)}
onDisplay={() => this.navTitleView.fadeOut(100)}>
<Text style={styles.title}>
<Text>Hii</Text>, ( 1998)
</Text>
</TriggeringView>
<View style={styles.section}>
<Text style={styles.sectionTitle}>Overview</Text>
<Text>Hii</Text>
</View>
<View style={[styles.section, styles.sectionLarge]}>
</View>
</HeaderImageScrollView>
</View>
);
}
}
export default TvShow;

这是一个库问题,请使用0.10.3版本"react native image header scroll view":"0.10.3〃;

最新更新