44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
// Metro module 15421 (f15422).
|
|
import { useRef, useEffect, useMemo } from "react";
|
|
import { ScrollView } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
|
|
const useStyles = createStyles({
|
|
guildFeedBackground: {
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
}
|
|
});
|
|
export default function OnboardingHomeScrollView(props) {
|
|
const { guildId, headerOffset = 0 } = props;
|
|
let ref3;
|
|
const marginTop = headerOffset;
|
|
const { scrollValue, children } = props;
|
|
ref3 = void 0;
|
|
const styles = useStyles();
|
|
const ref = useRef(false);
|
|
const ref2 = useRef(null);
|
|
const bottom = useSafeAreaInsets_native().bottom;
|
|
useEffect(() => {
|
|
ref.current = false;
|
|
}, [guildId]);
|
|
ref3 = useRef(true);
|
|
useEffect(() => {
|
|
if (!(ref2.current == null || ref3.current)) {
|
|
ref2.current.scrollTo({
|
|
animated: false,
|
|
y: 0
|
|
});
|
|
}
|
|
ref3.current = false;
|
|
}, [guildId]);
|
|
return <ScrollView ref={ref2} scrollIndicatorInsets={{
|
|
right: 1
|
|
}} onScroll={function onScroll(event) {
|
|
scrollValue.set(event.nativeEvent.contentOffset.y);
|
|
}} scrollEventThrottle={16} style={styles.guildFeedBackground} contentContainerStyle={useMemo(() => ({
|
|
paddingBottom: 16 + bottom,
|
|
marginTop
|
|
}), [bottom, marginTop])}>{children}</ScrollView>;
|
|
};
|