Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve animations (and more) #2193

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,12 @@ export default class App extends React.PureComponent {
}}
>
<Stack.Navigator
screenOptions={{
headerShown: false
}}
screenOptions={({ route }) => ({
headerShown: false,
animation: (
route.params as any
)?.animation
})}
screenListeners={({
navigation
}) => ({
Expand Down Expand Up @@ -299,10 +302,6 @@ export default class App extends React.PureComponent {
<Stack.Screen
name="Nodes"
component={Nodes}
options={{
animation:
'slide_from_left'
}}
/>
<Stack.Screen
name="Privacy"
Expand Down Expand Up @@ -457,10 +456,6 @@ export default class App extends React.PureComponent {
<Stack.Screen
name="Activity"
component={Activity}
options={{
animation:
'slide_from_bottom'
}}
/>
<Stack.Screen
name="ActivityFilter"
Expand Down
7 changes: 4 additions & 3 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { themeColor } from '../utils/ThemeUtils';

import ArrowLeft from '../assets/images/SVG/Arrow_left.svg';
import Close from '../assets/images/SVG/Close.svg';
import { StackNavigationProp } from '@react-navigation/stack';

interface HeaderIcon extends IconObject {
icon?: string;
Expand All @@ -32,7 +33,7 @@ interface HeaderProps {
rightComponent?: React.ReactElement<{}> | TextProps | HeaderIcon;
containerStyle?: ViewStyle;
placement?: 'left' | 'center' | 'right' | undefined;
navigation?: any;
navigation?: StackNavigationProp<any, any>;
onBack?: () => void;
navigateBackOnBackPress?: boolean;
}
Expand All @@ -46,7 +47,7 @@ function ZeusHeader(props: HeaderProps) {
onPress={() => {
if (onBack) onBack();
if (navigateBackOnBackPress) {
props.navigation.goBack();
props.navigation!.goBack();
}
}}
accessibilityLabel={localeString('general.goBack')}
Expand All @@ -64,7 +65,7 @@ function ZeusHeader(props: HeaderProps) {
<TouchableOpacity
onPress={() => {
if (onBack) onBack();
props.navigation.goBack();
props.navigation!.goBack();
}}
accessibilityLabel={localeString('general.close')}
>
Expand Down
14 changes: 10 additions & 4 deletions components/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ const SettingsBadge = ({
navigation: StackNavigationProp<any, any>;
}) => (
<TouchableOpacity
onPress={() => navigation.navigate('Settings')}
onPress={() =>
navigation.navigate('Settings', { animation: 'slide_from_left' })
}
accessibilityLabel={localeString('views.Settings.title')}
>
<Gear fill={themeColor('text')} width={33} height={33} />
Expand Down Expand Up @@ -252,7 +254,11 @@ export default class WalletHeader extends React.Component<

const NodeButton = () => (
<TouchableOpacity
onPress={() => protectedNavigation(navigation, 'Nodes')}
onPress={() =>
protectedNavigation(navigation, 'Nodes', undefined, {
animation: 'slide_from_right'
})
}
accessibilityLabel={localeString('views.Settings.title')}
>
{selectedNode && selectedNode.photo ? (
Expand Down Expand Up @@ -442,7 +448,7 @@ export default class WalletHeader extends React.Component<
leftComponent={
loading ? undefined : (
<Row>
<NodeButton />
<SettingsBadge navigation={navigation} />
{paid && paid.length > 0 && (
<TouchableOpacity
onPress={() =>
Expand Down Expand Up @@ -564,7 +570,7 @@ export default class WalletHeader extends React.Component<
</View>
)}
<View>
<SettingsBadge navigation={navigation} />
<NodeButton />
</View>
{posEnabled !== PosEnabled.Disabled && (
<View
Expand Down
5 changes: 3 additions & 2 deletions utils/NavigationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import stores from '../stores/Stores';
const protectedNavigation = async (
navigation: StackNavigationProp<any, any>,
route: string,
disactivatePOS?: boolean
disactivatePOS?: boolean,
routeParams?: any
) => {
const { posStatus, settings, setPosStatus } = stores.settingsStore;
const loginRequired = settings && (settings.passphrase || settings.pin);
Expand All @@ -17,7 +18,7 @@ const protectedNavigation = async (
});
} else {
if (disactivatePOS) setPosStatus('inactive');
navigation.navigate(route);
navigation.navigate(route, routeParams);
}
};

Expand Down
6 changes: 5 additions & 1 deletion views/Activity/Activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ export default class Activity extends React.PureComponent<

const FilterButton = () => (
<TouchableOpacity
onPress={() => navigation.navigate('ActivityFilter')}
onPress={() =>
navigation.navigate('ActivityFilter', {
animation: 'slide_from_right'
})
}
accessibilityLabel={localeString('views.ActivityFilter.title')}
>
<Filter fill={themeColor('text')} />
Expand Down
15 changes: 8 additions & 7 deletions views/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
}
}

if (connecting) {
if (connecting && start != null) {
console.log(
'connect time: ' + (new Date().getTime() - start) / 1000 + 's'
);
Expand Down Expand Up @@ -490,7 +490,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
const Tab = createBottomTabNavigator();
const {
NodeInfoStore,
UnitsStore,
BalanceStore,
SettingsStore,
SyncStore,
Expand Down Expand Up @@ -551,8 +550,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
<>
<LayerBalances
navigation={navigation}
BalanceStore={BalanceStore}
UnitsStore={UnitsStore}
onRefresh={() => this.getSettingsAndNavigate()}
locked={isSyncing}
consolidated
Expand All @@ -576,7 +573,8 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
<TouchableOpacity
onPress={() =>
this.props.navigation.navigate(
'Activity'
'Activity',
{ animation: 'slide_from_bottom' }
)
}
accessibilityLabel={localeString(
Expand Down Expand Up @@ -635,6 +633,7 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: themeColor('background'),
card: error ? themeColor('error') : themeColor('background'),
border: error ? themeColor('error') : themeColor('background')
}
Expand All @@ -648,7 +647,6 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
<NavigationContainer
theme={Theme}
ref={this.tabNavigationRef}
independent={true}
>
<Tab.Navigator
initialRouteName={
Expand Down Expand Up @@ -711,7 +709,10 @@ export default class Wallet extends React.Component<WalletProps, WalletState> {
? themeColor('error')
: 'gray',
tabBarShowLabel: false,
tabBarStyle: { display: 'flex' }
tabBarStyle: {
paddingBottom: 12
},
animation: 'shift'
})}
>
{posEnabled !== PosEnabled.Disabled &&
Expand Down
Loading