Skip to content

Commit

Permalink
Revert "chore: transaction list home screen adaptive to screen size (G…
Browse files Browse the repository at this point in the history
…aloyMoney#3241)" (GaloyMoney#3242)

This reverts commit 7e8deb5.
  • Loading branch information
sandipndev authored May 1, 2024
1 parent 7e8deb5 commit 62c5d3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
23 changes: 5 additions & 18 deletions app/screens/home-screen/home-screen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react"
import { useMemo } from "react"
import { RefreshControl, View, Alert, Dimensions, LayoutChangeEvent } from "react-native"
import { RefreshControl, View, Alert } from "react-native"
import {
ScrollView,
TouchableOpacity,
Expand Down Expand Up @@ -239,27 +239,15 @@ export const HomeScreen: React.FC = () => {
}
| undefined = undefined

const [noOfTransactionsToShow, setTransactionsToShow] = React.useState(1)

const onLayoutTransactionDataWrapper = (e: LayoutChangeEvent) => {
if (loading) return
const layout = e.nativeEvent.layout
const txItemsToShow = Math.floor(
(Dimensions.get("screen").height -
(layout.y + layout.height) -
180) /* Bottom Tab Navigation */ /
80 /* Per Transaction Item */,
)
if (noOfTransactionsToShow < txItemsToShow) setTransactionsToShow(txItemsToShow)
}
const TRANSACTIONS_TO_SHOW = 1

if (isAuthed && transactions.length > 0) {
recentTransactionsData = {
title: LL.TransactionScreen.title(),
details: (
<>
{transactions
.slice(0, noOfTransactionsToShow)
.slice(0, TRANSACTIONS_TO_SHOW)
.map(
(tx, index, array) =>
tx && (
Expand Down Expand Up @@ -395,9 +383,7 @@ export const HomeScreen: React.FC = () => {
))}
</View>
<NotificationCard />
<AppUpdate />

<View onLayout={onLayoutTransactionDataWrapper}>
<View>
{recentTransactionsData && (
<>
<TouchableOpacity
Expand All @@ -419,6 +405,7 @@ export const HomeScreen: React.FC = () => {
)}
</View>

<AppUpdate />
<SetDefaultAccountModal
isVisible={setDefaultAccountModalVisible}
toggleModal={() => {
Expand Down
6 changes: 1 addition & 5 deletions app/screens/notification-history-screen/notification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
StatefulNotification,
StatefulNotificationsDocument,
UnacknowledgedNotificationCountDocument,
useStatefulNotificationAcknowledgeMutation,
} from "@app/graphql/generated"
import { Text, makeStyles } from "@rneui/themed"
Expand Down Expand Up @@ -37,10 +36,7 @@ export const Notification: React.FC<StatefulNotification> = ({

const [ack, _] = useStatefulNotificationAcknowledgeMutation({
variables: { input: { notificationId: id } },
refetchQueries: [
StatefulNotificationsDocument,
UnacknowledgedNotificationCountDocument,
],
refetchQueries: [StatefulNotificationsDocument],
})

const linkTo = useLinkTo()
Expand Down

0 comments on commit 62c5d3d

Please sign in to comment.