Skip to content

Commit

Permalink
fix: scroll to top
Browse files Browse the repository at this point in the history
  • Loading branch information
tangimds committed Jun 2, 2022
1 parent 22f23c7 commit 1a9b2cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/scenes/diary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ const Diary = ({ navigation, hideDeader = false }) => {
return (
<SafeAreaView style={styles.safe}>
<NPS forceView={NPSvisible} close={() => setNPSvisible(false)} />
{!hideDeader ? (
<View style={styles.headerContainer}>
<Header title="Mon journal" navigation={navigation} />
</View>
) : null}
<ScrollView
style={styles.container}
contentContainerStyle={styles.scrollContainer}
Expand Down Expand Up @@ -153,7 +148,7 @@ const styles = StyleSheet.create({
backgroundColor: "white",
},
scrollContainer: {
paddingBottom: screenHeight / 2,
paddingBottom: 100,
},
subtitle: {
color: colors.BLUE,
Expand Down
11 changes: 11 additions & 0 deletions src/scenes/status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ const Status = ({ navigation, startSurvey }) => {
const [page, setPage] = useState(1);
const [bannerProNPSVisible, setBannerProNPSVisible] = useState(true);
const [ongletActif, setOngletActif] = useState("all");
const scrollRef = React.useRef();

React.useEffect(() => {
scrollRef.current.scrollTo({
y: 0,
animated: false,
});
}, [ongletActif]);

// ****************
// BEGIN - MASQUAGE DU HEADER AU SCROLL
Expand Down Expand Up @@ -181,6 +189,9 @@ const Status = ({ navigation, startSurvey }) => {
) : (
<>
<Animated.ScrollView
alwaysBounceHorizontal={false}
alwaysBounceVertical={false}
ref={scrollRef}
bounces={false}
style={styles.scrollView}
contentContainerStyle={styles.scrollContainer}
Expand Down

0 comments on commit 1a9b2cd

Please sign in to comment.