Skip to content

Commit

Permalink
perf(navigation): replace InteractionManager with dismissTo for room …
Browse files Browse the repository at this point in the history
…navigation
  • Loading branch information
Robert27 committed Nov 19, 2024
1 parent 57c0b92 commit 7ce4c2a
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 80 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ android {
applicationId 'app.neuland'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 219
versionCode 220
versionName "0.11.0"
}
signingConfigs {
Expand Down
2 changes: 1 addition & 1 deletion app.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"android": {
"package": "app.neuland",
"userInterfaceStyle": "automatic",
"versionCode": 219
"versionCode": 220
},
"sdkVersion": "52.0.0",
"experiments": {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
30 changes: 15 additions & 15 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ PODS:
- EXJSONUtils (0.14.0)
- EXManifests (0.15.3):
- ExpoModulesCore
- Expo (52.0.7):
- Expo (52.0.8):
- ExpoModulesCore
- expo-dev-client (5.0.2):
- expo-dev-client (5.0.3):
- EXManifests
- expo-dev-launcher
- expo-dev-menu
- expo-dev-menu-interface
- EXUpdatesInterface
- expo-dev-launcher (5.0.14):
- expo-dev-launcher (5.0.15):
- DoubleConversion
- EXManifests
- expo-dev-launcher/Main (= 5.0.14)
- expo-dev-launcher/Main (= 5.0.15)
- expo-dev-menu
- expo-dev-menu-interface
- ExpoModulesCore
Expand All @@ -51,7 +51,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-launcher/Main (5.0.14):
- expo-dev-launcher/Main (5.0.15):
- DoubleConversion
- EXManifests
- expo-dev-launcher/Unsafe
Expand Down Expand Up @@ -80,7 +80,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-launcher/Unsafe (5.0.14):
- expo-dev-launcher/Unsafe (5.0.15):
- DoubleConversion
- EXManifests
- expo-dev-menu
Expand Down Expand Up @@ -231,13 +231,13 @@ PODS:
- ExpoModulesCore
- ExpoClipboard (7.0.0):
- ExpoModulesCore
- ExpoFileSystem (18.0.3):
- ExpoFileSystem (18.0.4):
- ExpoModulesCore
- ExpoFont (13.0.1):
- ExpoModulesCore
- ExpoHaptics (14.0.0):
- ExpoModulesCore
- ExpoHead (4.0.6):
- ExpoHead (4.0.7):
- ExpoModulesCore
- ExpoKeepAwake (14.0.1):
- ExpoModulesCore
Expand All @@ -247,7 +247,7 @@ PODS:
- ExpoModulesCore
- ExpoLocalization (16.0.0):
- ExpoModulesCore
- ExpoModulesCore (2.0.3):
- ExpoModulesCore (2.0.4):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -2478,24 +2478,24 @@ SPEC CHECKSUMS:
EXConstants: dd2fe64c6cdb1383b694c309a63028a8e9f2be6d
EXJSONUtils: 01fc7492b66c234e395dcffdd5f53439c5c29c93
EXManifests: a883468e03b0234d4787e2c0ae4a65726f13cb05
Expo: 46cbe74ce0d0f4a4d7b726e90693eb8dfcec6de0
expo-dev-client: 7eb2bb228895757364d5650b3744db4694ee0bf7
expo-dev-launcher: 3b0d62ad3fa17ddaaa84ae42c1ed59896dc12fc5
Expo: c3e32beff4379726ad2e94068563fa03ae7109b0
expo-dev-client: 84a7f4a302387b57388d053900b56611b28b65ee
expo-dev-launcher: a94e0934c1c8e607af7596ac659928b8a3d8d2b0
expo-dev-menu: 3c09f402ac39257bf6cd4ed4f48478020b56838e
expo-dev-menu-interface: 1495ca112a4961f9fbaf586ae952faaafdbd967b
ExpoAsset: 8138f2a9ec55ae1ad7c3871448379f7d97692d15
ExpoBlur: 562b3da84d3cd79016c411671eaf71a404266415
ExpoBrightness: ce777f6a365592f745428cb0acc9066b400182e8
ExpoClipboard: 166ca8c13ca1041f5ba619a211f59427ab5da8a7
ExpoFileSystem: cc31b7a48031ab565f9eb5c2b61aa08d774a271a
ExpoFileSystem: dc2679a2b5d4c465ca881129074da95faee943d5
ExpoFont: 7522d869d84ee2ee8093ee997fef5b86f85d856b
ExpoHaptics: e636188d1d5f7ccb79f3c1bfab47aaf5a1768c73
ExpoHead: e18c3b28f8e22de7e1f26c085c346a91ea7f459b
ExpoHead: 43187036da62330d381a79a34fc37aeaca9530f8
ExpoKeepAwake: 783e68647b969b210a786047c3daa7b753dcac1f
ExpoLinearGradient: 7ca3b1d1625a1ab85c129abce4a3cdc78a9500a3
ExpoLocalAuthentication: fb519b5d39df0cc216e43fef3cc8e2db1930a01e
ExpoLocalization: 8e37268a715b82b36fbb5e361efd5fe65a39c208
ExpoModulesCore: 2d1df04dc27f91d8b383c0ec7f1d121e3d9b7f68
ExpoModulesCore: 371193c6b17285837f56807f7cac568f07dc4060
ExpoScreenOrientation: 21f691bc804e35e19e3a2113f7b02393d5bdb5db
ExpoSecureStore: 06c3192d58ed167f619af3d53797c055f5ada785
ExpoSplashScreen: 26cee50e9e95572baf87cd3a8ccaf2ffc3856422
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@th3rdwave/react-navigation-bottom-sheet": "0.3.2",
"burnt": "^0.12.2",
"color": "^4.2.3",
"expo": "~52.0.7",
"expo": "~52.0.8",
"expo-application": "~6.0.1",
"expo-blur": "~14.0.1",
"expo-brightness": "~13.0.2",
Expand All @@ -50,14 +50,14 @@
"expo-local-authentication": "~15.0.1",
"expo-localization": "~16.0.0",
"expo-navigation-bar": "~4.0.3",
"expo-router": "~4.0.6",
"expo-router": "~4.0.7",
"expo-screen-orientation": "~8.0.0",
"expo-secure-store": "~14.0.0",
"expo-splash-screen": "~0.29.11",
"fuse.js": "^7.0.0",
"graphql": "^16.9.0",
"graphql-request": "^6.1.0",
"i18next": "^23.16.5",
"i18next": "^23.16.6",
"metro": "^0.81.0",
"moment": "^2.30.1",
"moment-timezone": "^0.5.46",
Expand Down Expand Up @@ -123,7 +123,7 @@
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-react-native-unistyles": "^0.2.9",
"expo-atlas": "^0.3.27",
"expo-dev-client": "~5.0.2",
"expo-dev-client": "~5.0.3",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "3.3.3",
Expand Down
30 changes: 8 additions & 22 deletions src/app/(screens)/lecture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,7 @@ import {
import moment from 'moment'
import React, { useCallback, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import {
InteractionManager,
Pressable,
ScrollView,
Share,
Text,
View,
} from 'react-native'
import { Pressable, ScrollView, Share, Text, View } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'
import ViewShot, { captureRef } from 'react-native-view-shot'

Expand Down Expand Up @@ -254,20 +247,13 @@ export default function TimetableDetails(): JSX.Element {
<React.Fragment key={i}>
<Pressable
onPress={() => {
router.dismissAll()
void InteractionManager.runAfterInteractions(
() => {
router.navigate(
{
pathname:
'(tabs)/map',
params: {
room,
},
}
)
}
)
router.dismissTo({
pathname:
'(tabs)/map',
params: {
room,
},
})
}}
disabled={!isValid}
>
Expand Down
18 changes: 4 additions & 14 deletions src/app/(screens)/lecturer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import { Buffer } from 'buffer/'
import { router, useLocalSearchParams } from 'expo-router'
import React from 'react'
import { useTranslation } from 'react-i18next'
import {
InteractionManager,
Linking,
ScrollView,
Text,
View,
} from 'react-native'
import { Linking, ScrollView, Text, View } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'

export default function LecturerDetail(): JSX.Element {
Expand Down Expand Up @@ -74,13 +68,9 @@ export default function LecturerDetail(): JSX.Element {
disabled: lecturer?.room_short === '',
textColor: theme.colors.primary,
onPress: () => {
router.dismissAll()
// Wait for the screen to dismiss before navigating
void InteractionManager.runAfterInteractions(() => {
router.navigate({
pathname: '(tabs)/map',
params: { room: lecturer?.room_short ?? '' },
})
router.dismissTo({
pathname: '(tabs)/map',
params: { room: lecturer?.room_short ?? '' },
})
},
},
Expand Down
20 changes: 4 additions & 16 deletions src/app/(screens)/meal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,7 @@ import {
import { type i18n } from 'i18next'
import React, { useCallback, useContext } from 'react'
import { useTranslation } from 'react-i18next'
import {
Alert,
InteractionManager,
Linking,
ScrollView,
Share,
Text,
View,
} from 'react-native'
import { Alert, Linking, ScrollView, Share, Text, View } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'

export const humanLocations = {
Expand Down Expand Up @@ -309,13 +301,9 @@ export default function FoodDetail(): JSX.Element {
const location = locations[restaurant as keyof typeof locations]

if (restaurant != null && location !== undefined) {
router.dismissAll()
// Wait for the screen to dismiss before navigating
void InteractionManager.runAfterInteractions(() => {
router.navigate({
pathname: '(tabs)/map',
params: { room: location },
})
router.dismissTo({
pathname: '(tabs)/map',
params: { room: location },
})
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/components/Rows/LecturerRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Buffer } from 'buffer/'
import { router } from 'expo-router'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { InteractionManager, Text, View } from 'react-native'
import { Text, View } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'

import RowEntry from '../Universal/RowEntry'
Expand All @@ -12,12 +12,9 @@ const LecturerRow = ({ item }: { item: NormalizedLecturer }): JSX.Element => {
const { styles } = useStyles(stylesheet)

const onPressRoom = (): void => {
router.dismissAll()
void InteractionManager.runAfterInteractions(() => {
router.navigate({
pathname: '(tabs)/map',
params: { room: item.room_short ?? '' },
})
router.dismissTo({
pathname: '(tabs)/map',
params: { room: item.room_short ?? '' },
})
}
const onPressRow = (): void => {
Expand Down

0 comments on commit 7ce4c2a

Please sign in to comment.