Skip to content

Commit

Permalink
Merge pull request zingolabs#728 from juanky201271/dev_basic_mode_sen…
Browse files Browse the repository at this point in the history
…d_bottom_tab_refresh_icon

Basic Mode - send bottom icon refresh
  • Loading branch information
juanky201271 authored Oct 16, 2024
2 parents 8ab5ade + 97afd1f commit f1441cb
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions app/LoadedApp/LoadedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from 'react-native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { faList, faUpload, faDownload, faCog, faComments } from '@fortawesome/free-solid-svg-icons';
import { faList, faUpload, faDownload, faCog, faComments, faRefresh } from '@fortawesome/free-solid-svg-icons';
import { useTheme } from '@react-navigation/native';
import SideMenu from 'react-native-side-menu-updated';
import { I18n } from 'i18n-js';
Expand Down Expand Up @@ -855,7 +855,14 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
);
}
});
this.setState({ valueTransfers, somePending: pending > 0 });
// if some tx is confirmed the UI needs some time to
// acomodate the bottom tabs.
setTimeout(
() => {
this.setState({ valueTransfers, somePending: pending > 0 });
},
pending === 0 ? 250 : 0,
);
}
};

Expand Down Expand Up @@ -1519,6 +1526,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
scrollToTop,
scrollToBottom,
addresses,
somePending,
} = this.state;
const { colors } = this.props.theme;

Expand Down Expand Up @@ -1574,7 +1582,16 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
if (route.name === translate('loadedapp.history-menu')) {
iconName = faList;
} else if (route.name === translate('loadedapp.send-menu')) {
iconName = faUpload;
if (
mode === ModeEnum.basic &&
!!totalBalance &&
totalBalance.spendableOrchard + totalBalance.spendablePrivate === 0 &&
somePending
) {
iconName = faRefresh;
} else {
iconName = faUpload;
}
} else if (route.name === translate('loadedapp.receive-menu')) {
iconName = faDownload;
} else if (route.name === translate('loadedapp.messages-menu')) {
Expand Down Expand Up @@ -1894,8 +1911,24 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
</Tab.Screen>
{!readOnly &&
(mode === ModeEnum.advanced ||
(!!totalBalance && totalBalance.spendableOrchard + totalBalance.spendablePrivate > 0)) && (
<Tab.Screen name={translate('loadedapp.send-menu') as string}>
(!!totalBalance && totalBalance.spendableOrchard + totalBalance.spendablePrivate > 0) ||
(!!totalBalance &&
totalBalance.spendableOrchard + totalBalance.spendablePrivate === 0 &&
somePending)) && (
<Tab.Screen
name={translate('loadedapp.send-menu') as string}
listeners={{
tabPress: e => {
if (
mode === ModeEnum.basic &&
!!totalBalance &&
totalBalance.spendableOrchard + totalBalance.spendablePrivate === 0 &&
somePending
) {
e.preventDefault();
}
},
}}>
{() => (
<Send
setSendPageState={this.setSendPageState}
Expand Down

0 comments on commit f1441cb

Please sign in to comment.