Merge commit '75952f4edea5d59554322a5c611483a0052e4e97'
This commit is contained in:
commit
0148c12e08
@ -1,5 +1,5 @@
|
|||||||
import { ScrollView, View, Animated, Platform } from "react-native";
|
import { ScrollView, View, Animated, LayoutAnimation } from "react-native";
|
||||||
import React, { useRef } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
export const DynamicHeaderScrollView = (props) => {
|
export const DynamicHeaderScrollView = (props) => {
|
||||||
const {
|
const {
|
||||||
@ -13,43 +13,51 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
topStickyContent,
|
topStickyContent,
|
||||||
styles,
|
styles,
|
||||||
} = props;
|
} = props;
|
||||||
const scrollOffsetY = useRef(new Animated.Value(0)).current;
|
|
||||||
|
|
||||||
const Scroll_Distance = Max_Header_Height - Min_Header_Height;
|
const Scroll_Distance = Max_Header_Height - Min_Header_Height;
|
||||||
|
|
||||||
const animatedHeaderHeight = scrollOffsetY.interpolate({
|
const [headerVisible, setHeaderVisible] = useState(false);
|
||||||
inputRange: [Scroll_Distance, Scroll_Distance + 30],
|
const shotHeaderStyle = {
|
||||||
outputRange: [Max_Header_Height, 0],
|
on: {
|
||||||
extrapolate: "clamp",
|
height: Min_Header_Height,
|
||||||
});
|
backgroundColor: "#0099CC",
|
||||||
const animatedHeaderHeight2 = scrollOffsetY.interpolate({
|
margin: 0,
|
||||||
inputRange: [Scroll_Distance, Scroll_Distance + 30],
|
top: 0,
|
||||||
outputRange: [Max_Header_Height, Min_Header_Height],
|
opacity: 1,
|
||||||
extrapolate: "clamp",
|
},
|
||||||
});
|
off: {
|
||||||
const animatedHeaderVisible = scrollOffsetY.interpolate({
|
height: Max_Header_Height,
|
||||||
inputRange: [Scroll_Distance - 30, Scroll_Distance],
|
backgroundColor: "#0099CC",
|
||||||
outputRange: [1, 0],
|
margin: 0,
|
||||||
extrapolate: "clamp",
|
top: 0,
|
||||||
});
|
opacity: 0,
|
||||||
const animatedHeaderVisible2 = scrollOffsetY.interpolate({
|
},
|
||||||
inputRange: [Scroll_Distance - 30, Scroll_Distance + 30],
|
};
|
||||||
outputRange: [0, 1],
|
|
||||||
extrapolate: "clamp",
|
const longHeaderStyle = {
|
||||||
});
|
on: {
|
||||||
|
height: Max_Header_Height,
|
||||||
|
backgroundColor: "#0099CC",
|
||||||
|
margin: 0,
|
||||||
|
top: 0,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
off: {
|
||||||
|
height: 0,
|
||||||
|
backgroundColor: "#0099CC",
|
||||||
|
margin: 0,
|
||||||
|
top: 0,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View {...containerProps}>
|
<View {...containerProps}>
|
||||||
<View style={{ zIndex: 1 }}>
|
<View style={{ zIndex: 1 }}>
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.header,
|
styles.header,
|
||||||
{
|
headerVisible ? shotHeaderStyle.on : shotHeaderStyle.off,
|
||||||
height: animatedHeaderHeight2,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
margin: 0,
|
|
||||||
top: 0,
|
|
||||||
opacity: animatedHeaderVisible2,
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{shortHeader}
|
{shortHeader}
|
||||||
@ -57,13 +65,7 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.header,
|
styles.header,
|
||||||
{
|
headerVisible ? longHeaderStyle.off : longHeaderStyle.on,
|
||||||
height: animatedHeaderHeight,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
opacity: animatedHeaderVisible,
|
|
||||||
|
|
||||||
top: 0,
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{longHeader}
|
{longHeader}
|
||||||
@ -77,10 +79,14 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
}}
|
}}
|
||||||
stickyHeaderIndices={[1]}
|
stickyHeaderIndices={[1]}
|
||||||
scrollEventThrottle={16}
|
scrollEventThrottle={16}
|
||||||
onScroll={Animated.event(
|
onScroll={(event) => {
|
||||||
[{ nativeEvent: { contentOffset: { y: scrollOffsetY } } }],
|
const scrollY = event.nativeEvent.contentOffset.y;
|
||||||
{ useNativeDriver: false }
|
LayoutAnimation.configureNext({
|
||||||
)}
|
duration: 100,
|
||||||
|
update: { type: "easeOut" },
|
||||||
|
});
|
||||||
|
setHeaderVisible(Scroll_Distance < scrollY);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
@ -174,7 +174,7 @@ export default function Setting(props) {
|
|||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
内部バージョン: 5.0
|
内部バージョン: 5.0.1
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
|
8
menu.js
8
menu.js
@ -100,8 +100,8 @@ export default function Menu(props) {
|
|||||||
|
|
||||||
const [currentStation, setCurrentStation] = useState(undefined); //第三要素
|
const [currentStation, setCurrentStation] = useState(undefined); //第三要素
|
||||||
|
|
||||||
const [originalStationList, setOriginalStationList] = useState(); // 第一要素
|
const [originalStationList, setOriginalStationList] = useState([]); // 第一要素
|
||||||
useLayoutEffect(() => getStationList().then(setOriginalStationList), []);
|
useEffect(() => getStationList().then(setOriginalStationList), []);
|
||||||
|
|
||||||
const carouselRef = useRef();
|
const carouselRef = useRef();
|
||||||
const [selectedCurrentStation, setSelectedCurrentStation] = useState(0);
|
const [selectedCurrentStation, setSelectedCurrentStation] = useState(0);
|
||||||
@ -184,7 +184,7 @@ export default function Menu(props) {
|
|||||||
<TitleBar />
|
<TitleBar />
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<FixedContentTop navigate={navigate} />
|
<FixedContentTop navigate={navigate} />
|
||||||
{originalStationList && allStationData.length != 0 && (
|
{originalStationList.length != 0 && allStationData.length != 0 && (
|
||||||
<Carousel
|
<Carousel
|
||||||
ref={carouselRef}
|
ref={carouselRef}
|
||||||
layout={"default"}
|
layout={"default"}
|
||||||
@ -234,7 +234,7 @@ export default function Menu(props) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{allStationData.length != 0 &&
|
{allStationData.length != 0 &&
|
||||||
originalStationList &&
|
originalStationList.length != 0 &&
|
||||||
allStationData[selectedCurrentStation] && (
|
allStationData[selectedCurrentStation] && (
|
||||||
<LED_vision
|
<LED_vision
|
||||||
station={
|
station={
|
||||||
|
Loading…
Reference in New Issue
Block a user