|
|
@@ -3,7 +3,7 @@
|
|
|
* @邠心vbe on 2023/10/24
|
|
|
*/
|
|
|
import React, { Component } from 'react';
|
|
|
-import { View, StyleSheet, Image, ScrollView, Linking, Animated } from 'react-native';
|
|
|
+import { View, StyleSheet, Image, ScrollView, Linking, Animated, Easing } from 'react-native';
|
|
|
import Swiper from 'react-native-swiper';
|
|
|
import apiArticle from '../../api/apiArticle';
|
|
|
import TextView from '../../components/TextView';
|
|
|
@@ -25,7 +25,7 @@ export default class ViewArticle extends Component {
|
|
|
articleTitle: "",
|
|
|
articleContent: ""
|
|
|
},
|
|
|
- opacity: 1
|
|
|
+ opacity: new Animated.Value(0)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -75,14 +75,16 @@ export default class ViewArticle extends Component {
|
|
|
|
|
|
onScrollView(e) {
|
|
|
if (e.nativeEvent.contentOffset) {
|
|
|
- const isR = e.nativeEvent.contentOffset.y >= $vw(91);
|
|
|
+ const isR = e.nativeEvent.contentOffset.y >= $vw(95);
|
|
|
if (isR != this.state.showTitleBar) {
|
|
|
this.setState({
|
|
|
- opacity: new Animated.Value(0),
|
|
|
showTitleBar: isR
|
|
|
- }, () => {
|
|
|
- this.startTitleAnimate();
|
|
|
});
|
|
|
+ if (isR) {
|
|
|
+ this.startTitleAnimate();
|
|
|
+ } else {
|
|
|
+ this.hideTitleAnimate();
|
|
|
+ }
|
|
|
MyStatusBar.setStatusBarTheme(isR ? MyStatusBar.DEFAULT_STYLE : MyStatusBar.LIGHT_STYLE);
|
|
|
}
|
|
|
}
|
|
|
@@ -91,7 +93,18 @@ export default class ViewArticle extends Component {
|
|
|
startTitleAnimate() {
|
|
|
Animated.timing(this.state.opacity, {
|
|
|
toValue: 1,
|
|
|
- duration: 200,
|
|
|
+ duration: 250,
|
|
|
+ easing: Easing.linear,
|
|
|
+ useNativeDriver: true
|
|
|
+ }).start(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ hideTitleAnimate() {
|
|
|
+ Animated.timing(this.state.opacity, {
|
|
|
+ toValue: 0,
|
|
|
+ duration: 250,
|
|
|
easing: Easing.linear,
|
|
|
useNativeDriver: true
|
|
|
}).start(() => {
|
|
|
@@ -118,6 +131,11 @@ export default class ViewArticle extends Component {
|
|
|
{width: '100%', height: 15, marginTop: 8},
|
|
|
{width: '100%', height: 15, marginTop: 8},
|
|
|
{width: '100%', height: 15, marginTop: 8},
|
|
|
+ {width: '30%', height: 15, marginTop: 8},
|
|
|
+ {width: '100%', height: 15, marginTop: 24},
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
{width: '30%', height: 15, marginTop: 8}
|
|
|
]}
|
|
|
animationDirection={"horizontalRight"}/>
|
|
|
@@ -128,8 +146,8 @@ export default class ViewArticle extends Component {
|
|
|
<>
|
|
|
<ScrollView
|
|
|
style={styles.container}
|
|
|
- contentContainerStyle={$padding(0,0,32)}
|
|
|
- stickyHeaderIndices={[utils.isNotEmpty(this.state.messageInfo.articleImages) ? 1 : 0]}>
|
|
|
+ onScroll={e => this.onScrollView(e)}
|
|
|
+ contentContainerStyle={$padding(0,0,32)}>
|
|
|
{ utils.isNotEmpty(this.state.messageInfo.articleImages) &&
|
|
|
<Swiper
|
|
|
style={{height: $width}}
|
|
|
@@ -202,11 +220,13 @@ export default class ViewArticle extends Component {
|
|
|
}
|
|
|
<EndView/>
|
|
|
</ScrollView>
|
|
|
+ { !this.state.showTitleBar &&
|
|
|
+ <View style={styles.toolbar}>
|
|
|
+ <BackButton style={styles.backIcon} color={"#F0F0F0"}/>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<Animated.View style={[styles.toolbar, {opacity: this.state.opacity}]}>
|
|
|
- { this.state.showTitleBar
|
|
|
- ? <Toolbar title={this.state.messageInfo.articleTitle}/>
|
|
|
- : <BackButton style={styles.backIcon} color={"#F0F0F0"}/>
|
|
|
- }
|
|
|
+ <Toolbar title={this.state.messageInfo.articleTitle}/>
|
|
|
</Animated.View>
|
|
|
</>
|
|
|
);
|
|
|
@@ -223,6 +243,7 @@ const styles = StyleSheet.create({
|
|
|
top: 0,
|
|
|
left: 0,
|
|
|
right: 0,
|
|
|
+ zIndex: 2,
|
|
|
position: 'absolute'
|
|
|
},
|
|
|
backIcon: {
|