Commit 882bd88b authored by Dherik Jenitan Devakumar's avatar Dherik Jenitan Devakumar
Browse files

Merge branch '14-fix-infinite-scroll-not-working'

parents c5a01f3e 0cbe945a
......@@ -18,10 +18,15 @@ import { TouchableOpacity, TouchableWithoutFeedback } from 'react-native';
*/
interface IMovieObject {
item: searchMovies_getMoviesBySearch;
item: searchMovies_getMoviesBySearch;
}
const MovieTable: React.FC = () => {
interface MovieTableProps {
fetchMore: () => void;
}
const MovieTable: React.FC<MovieTableProps> = ({fetchMore}) => {
const movies = useSelector(selectMovies);
const isLoggedIn = useSelector(selectUserIsLoggedIn);
const userName = useSelector(selectUserName)
......@@ -83,8 +88,7 @@ const MovieTable: React.FC = () => {
contentContainerStyle={{
paddingBottom:350,
}}
onEndReachedThreshold={0.5}
onEndReached={() => {console.log("test")}}
onEndReached={fetchMore}
/>
<MovieModal isModalVisible={modalVisible} setIsModalVisible={setModalVisible} movie={modalMovie}/>
</SafeAreaView>
......
import { ApolloClient, InMemoryCache } from "@apollo/client";
import {DB_URL} from "@env";
//import "dotenv/config"
//console.log(process.env.DB_URL)
console.log(DB_URL)
export const apolloClient = new ApolloClient({
uri: process.env.DB_URL ? process.env.DB_URL : "http://localhost:4000/graphql",
cache: new InMemoryCache(),
......
......@@ -115,7 +115,8 @@ export const MainPage: FunctionComponent = () => {
<SortDropDown />
</View>
<View>
<MovieTable />
{/* <BottomScrollListener onBottom={fetchMovies} debounce={0}/> */}
<MovieTable fetchMore={fetchMovies}/>
</View>
</View>
</MenuDrawer>
......
......@@ -17,14 +17,12 @@ const MainPageSlice = createSlice({
initialState,
reducers: {
setMovies(state, action) {
console.log("next page", state.nextPage);
state.nextPage += 1;
if (state.movies !== null) {
state.movies = state.movies.concat(action.payload);
}
},
setSortByCriteria(state, action) {
console.log("Payload", action.payload);
state.nextPage = 0;
state.movies = [];
state.sortByCriteria = action.payload;
......@@ -41,7 +39,6 @@ const MainPageSlice = createSlice({
state.filterSearch = action.payload;
},
setFilterGenres(state, action) {
console.log("Payload", action.payload);
state.nextPage = 0;
state.movies = [];
if (state.filterGenre === [""]) {
......
......@@ -4,7 +4,6 @@ export function convertDateToUnixDate(date: Date) {
export function convertUnixDateToDate(unixNumber: number) {
const date = new Date(unixNumber * 1000);
//console.log(date.getFullYear());
return date;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment