|
@@ -3,14 +3,15 @@
|
|
|
* @邠心vbe on 2023/10/24
|
|
* @邠心vbe on 2023/10/24
|
|
|
*/
|
|
*/
|
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
|
-import { View, StyleSheet, Image, ScrollView, Linking } from 'react-native';
|
|
|
|
|
|
|
+import { View, StyleSheet, Image, ScrollView, Linking, Animated } from 'react-native';
|
|
|
import Swiper from 'react-native-swiper';
|
|
import Swiper from 'react-native-swiper';
|
|
|
import apiArticle from '../../api/apiArticle';
|
|
import apiArticle from '../../api/apiArticle';
|
|
|
-import HeaderTitle from '../../components/HeaderTitle';
|
|
|
|
|
import TextView from '../../components/TextView';
|
|
import TextView from '../../components/TextView';
|
|
|
import VbeSkeleton from '../../components/VbeSkeleton';
|
|
import VbeSkeleton from '../../components/VbeSkeleton';
|
|
|
import utils from '../../utils/utils';
|
|
import utils from '../../utils/utils';
|
|
|
import { PagerView } from './ViewUtil';
|
|
import { PagerView } from './ViewUtil';
|
|
|
|
|
+import MyStatusBar from '../../components/MyStatusBar';
|
|
|
|
|
+import Toolbar, { BackButton } from '../../components/Toolbar';
|
|
|
|
|
|
|
|
export default class ViewArticle extends Component {
|
|
export default class ViewArticle extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -18,11 +19,13 @@ export default class ViewArticle extends Component {
|
|
|
this.state = {
|
|
this.state = {
|
|
|
id: "",
|
|
id: "",
|
|
|
loading: true,
|
|
loading: true,
|
|
|
|
|
+ showTitleBar: false,
|
|
|
messageInfo: {
|
|
messageInfo: {
|
|
|
articleTypeName: "",
|
|
articleTypeName: "",
|
|
|
articleTitle: "",
|
|
articleTitle: "",
|
|
|
articleContent: ""
|
|
articleContent: ""
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ opacity: 1
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -34,6 +37,10 @@ export default class ViewArticle extends Component {
|
|
|
this.readMessage();
|
|
this.readMessage();
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ MyStatusBar.setStatusBarTheme(MyStatusBar.LIGHT_STYLE);
|
|
|
|
|
+ this.props.navigation.addListener('beforeRemove', (e) => {
|
|
|
|
|
+ MyStatusBar.setStatusBarTheme(MyStatusBar.DEFAULT_STYLE);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
readMessage() {
|
|
readMessage() {
|
|
@@ -51,9 +58,9 @@ export default class ViewArticle extends Component {
|
|
|
|
|
|
|
|
setPageTitle() {
|
|
setPageTitle() {
|
|
|
if (this.state.messageInfo.articleTitle) {
|
|
if (this.state.messageInfo.articleTitle) {
|
|
|
- this.props.navigation.setOptions({
|
|
|
|
|
|
|
+ /*this.props.navigation.setOptions({
|
|
|
headerTitle: () => (<HeaderTitle title={this.state.messageInfo.articleTitle}/>)
|
|
headerTitle: () => (<HeaderTitle title={this.state.messageInfo.articleTitle}/>)
|
|
|
- });
|
|
|
|
|
|
|
+ })*/
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
loading: false
|
|
loading: false
|
|
@@ -66,6 +73,32 @@ export default class ViewArticle extends Component {
|
|
|
Linking.openURL(utils.getImageUrl(url))
|
|
Linking.openURL(utils.getImageUrl(url))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ onScrollView(e) {
|
|
|
|
|
+ if (e.nativeEvent.contentOffset) {
|
|
|
|
|
+ const isR = e.nativeEvent.contentOffset.y >= $vw(91);
|
|
|
|
|
+ if (isR != this.state.showTitleBar) {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ opacity: new Animated.Value(0),
|
|
|
|
|
+ showTitleBar: isR
|
|
|
|
|
+ }, () => {
|
|
|
|
|
+ this.startTitleAnimate();
|
|
|
|
|
+ });
|
|
|
|
|
+ MyStatusBar.setStatusBarTheme(isR ? MyStatusBar.DEFAULT_STYLE : MyStatusBar.LIGHT_STYLE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ startTitleAnimate() {
|
|
|
|
|
+ Animated.timing(this.state.opacity, {
|
|
|
|
|
+ toValue: 1,
|
|
|
|
|
+ duration: 200,
|
|
|
|
|
+ easing: Easing.linear,
|
|
|
|
|
+ useNativeDriver: true
|
|
|
|
|
+ }).start(() => {
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
if (this.state.loading) {
|
|
if (this.state.loading) {
|
|
|
return (
|
|
return (
|
|
@@ -92,6 +125,7 @@ export default class ViewArticle extends Component {
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
return (
|
|
return (
|
|
|
|
|
+ <>
|
|
|
<ScrollView
|
|
<ScrollView
|
|
|
style={styles.container}
|
|
style={styles.container}
|
|
|
contentContainerStyle={$padding(0,0,32)}
|
|
contentContainerStyle={$padding(0,0,32)}
|
|
@@ -128,17 +162,17 @@ export default class ViewArticle extends Component {
|
|
|
numberOfLines={1}>
|
|
numberOfLines={1}>
|
|
|
{this.state.messageInfo.createTime}
|
|
{this.state.messageInfo.createTime}
|
|
|
</TextView>
|
|
</TextView>
|
|
|
- </View>
|
|
|
|
|
- <View style={ui.flexc}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="eye-check-outline"
|
|
|
|
|
- size={12}
|
|
|
|
|
- color={textPrimary}/>
|
|
|
|
|
- <TextView
|
|
|
|
|
- style={styles.textView}
|
|
|
|
|
- numberOfLines={1}>
|
|
|
|
|
- {this.state.messageInfo.articleViews}
|
|
|
|
|
- </TextView>
|
|
|
|
|
|
|
+ <View style={ui.flexc}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="eye-check-outline"
|
|
|
|
|
+ size={12}
|
|
|
|
|
+ color={textPrimary}/>
|
|
|
|
|
+ <TextView
|
|
|
|
|
+ style={styles.textView}
|
|
|
|
|
+ numberOfLines={1}>
|
|
|
|
|
+ {this.state.messageInfo.articleViews}
|
|
|
|
|
+ </TextView>
|
|
|
|
|
+ </View>
|
|
|
</View>
|
|
</View>
|
|
|
<View style={ui.flex}>
|
|
<View style={ui.flex}>
|
|
|
<TextView
|
|
<TextView
|
|
@@ -159,7 +193,7 @@ export default class ViewArticle extends Component {
|
|
|
{ this.state.messageInfo.articleLinks.map((item, index) =>
|
|
{ this.state.messageInfo.articleLinks.map((item, index) =>
|
|
|
<View style={styles.itemLink} key={index}>
|
|
<View style={styles.itemLink} key={index}>
|
|
|
<TextView style={styles.linkIndex}>{index + 1}.</TextView>
|
|
<TextView style={styles.linkIndex}>{index + 1}.</TextView>
|
|
|
- <TextView
|
|
|
|
|
|
|
+ <TextView
|
|
|
style={styles.linkHyper}
|
|
style={styles.linkHyper}
|
|
|
onPress={() => this.accessLink(item.articleLink)}>{item.articleLinkName}</TextView>
|
|
onPress={() => this.accessLink(item.articleLink)}>{item.articleLinkName}</TextView>
|
|
|
</View>
|
|
</View>
|
|
@@ -168,6 +202,13 @@ export default class ViewArticle extends Component {
|
|
|
}
|
|
}
|
|
|
<EndView/>
|
|
<EndView/>
|
|
|
</ScrollView>
|
|
</ScrollView>
|
|
|
|
|
+ <Animated.View style={[styles.toolbar, {opacity: this.state.opacity}]}>
|
|
|
|
|
+ { this.state.showTitleBar
|
|
|
|
|
+ ? <Toolbar title={this.state.messageInfo.articleTitle}/>
|
|
|
|
|
+ : <BackButton style={styles.backIcon} color={"#F0F0F0"}/>
|
|
|
|
|
+ }
|
|
|
|
|
+ </Animated.View>
|
|
|
|
|
+ </>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -178,6 +219,21 @@ const styles = StyleSheet.create({
|
|
|
flex: 1,
|
|
flex: 1,
|
|
|
backgroundColor: pageBackground
|
|
backgroundColor: pageBackground
|
|
|
},
|
|
},
|
|
|
|
|
+ toolbar: {
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ position: 'absolute'
|
|
|
|
|
+ },
|
|
|
|
|
+ backIcon: {
|
|
|
|
|
+ width: 48,
|
|
|
|
|
+ height: 48,
|
|
|
|
|
+ zIndex: 2,
|
|
|
|
|
+ marginTop: statusHeight + 4,
|
|
|
|
|
+ marginLeft: 4,
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ justifyContent: 'center'
|
|
|
|
|
+ },
|
|
|
loadingView: {
|
|
loadingView: {
|
|
|
flex: 1,
|
|
flex: 1,
|
|
|
padding: 16,
|
|
padding: 16,
|
|
@@ -186,24 +242,23 @@ const styles = StyleSheet.create({
|
|
|
},
|
|
},
|
|
|
textTitle: {
|
|
textTitle: {
|
|
|
color: textPrimary,
|
|
color: textPrimary,
|
|
|
- fontSize: 14,
|
|
|
|
|
|
|
+ fontSize: 18,
|
|
|
fontWeight: 'bold',
|
|
fontWeight: 'bold',
|
|
|
paddingBottom: 2
|
|
paddingBottom: 2
|
|
|
},
|
|
},
|
|
|
textDate: {
|
|
textDate: {
|
|
|
flex: 1,
|
|
flex: 1,
|
|
|
color: textSecondary,
|
|
color: textSecondary,
|
|
|
- fontSize: 12,
|
|
|
|
|
|
|
+ fontSize: 10,
|
|
|
paddingLeft: 2
|
|
paddingLeft: 2
|
|
|
},
|
|
},
|
|
|
textView: {
|
|
textView: {
|
|
|
color: textSecondary,
|
|
color: textSecondary,
|
|
|
- fontSize: 14,
|
|
|
|
|
|
|
+ fontSize: 10,
|
|
|
padding: 4
|
|
padding: 4
|
|
|
},
|
|
},
|
|
|
header: {
|
|
header: {
|
|
|
padding: 16,
|
|
padding: 16,
|
|
|
- //...ElevationObject(1),
|
|
|
|
|
backgroundColor: pageBackground
|
|
backgroundColor: pageBackground
|
|
|
},
|
|
},
|
|
|
textMessage: {
|
|
textMessage: {
|