update
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import { View, Text, ScrollView, Dimensions } from "react-native";
|
||||
import React, { useRef, useState } from "react";
|
||||
import Page from "../../layouts/Page";
|
||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
||||
import CreateLyricsHeader from "./components/CreateLyricsHeader";
|
||||
import GradientButton from "../../components/GradientButton";
|
||||
import { gutters } from "../../styles";
|
||||
import { SwiperFlatList } from "react-native-swiper-flatlist";
|
||||
import Goals from "./Goals";
|
||||
import { goBack } from "../../navigation/NavigationService";
|
||||
import SpecificityContext from "./SpecificityContext";
|
||||
import EmotionConvey from "./EmotionConvey";
|
||||
|
||||
const { width } = Dimensions.get("window");
|
||||
|
||||
const CreateLyricsWithAi = () => {
|
||||
const scrollRef = useRef(null);
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
const [progress, setProgress] = useState(8);
|
||||
|
||||
const onPressNext = () => {
|
||||
setSelectedIndex(selectedIndex + 1);
|
||||
setProgress(progress + 8);
|
||||
scrollRef.current.scrollToIndex({
|
||||
index: selectedIndex + 1,
|
||||
animated: true,
|
||||
});
|
||||
};
|
||||
|
||||
const onPressBack = () => {
|
||||
if (selectedIndex > 0) {
|
||||
setSelectedIndex(selectedIndex - 1);
|
||||
setProgress(progress - 8);
|
||||
scrollRef.current.scrollToIndex({
|
||||
index: selectedIndex - 1,
|
||||
animated: true,
|
||||
});
|
||||
} else {
|
||||
goBack();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Page headerType="NONE">
|
||||
<MusicLandHeader onPressBack={onPressBack} progress={progress} />
|
||||
<View style={{ flex: 1, marginTop: 16, paddingBottom: gutters, gap: 48 }}>
|
||||
<View style={{ flex: 1 }}>
|
||||
<SwiperFlatList
|
||||
style={{ width, left: -gutters }}
|
||||
ref={scrollRef}
|
||||
disableGesture
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
width: width,
|
||||
height: "100%",
|
||||
paddingHorizontal: gutters,
|
||||
}}
|
||||
>
|
||||
<Goals />
|
||||
</View>
|
||||
<View
|
||||
style={{
|
||||
width: width,
|
||||
height: "100%",
|
||||
paddingHorizontal: gutters,
|
||||
}}
|
||||
>
|
||||
<SpecificityContext />
|
||||
</View>
|
||||
<View
|
||||
style={{
|
||||
width: width,
|
||||
height: "100%",
|
||||
paddingHorizontal: gutters,
|
||||
}}
|
||||
>
|
||||
<EmotionConvey />
|
||||
</View>
|
||||
</SwiperFlatList>
|
||||
</View>
|
||||
<GradientButton title="Suivant" onPress={onPressNext} />
|
||||
</View>
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateLyricsWithAi;
|
||||
Reference in New Issue
Block a user