Skip to content

Commit

Permalink
Fix expo@52
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Dec 14, 2024
1 parent 4230cbb commit a64a746
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 50 deletions.
52 changes: 52 additions & 0 deletions .yarn/patches/react-native-paper-npm-5.12.5-c595c2e788.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/src/components/BottomNavigation/BottomNavigationBar.tsx b/src/components/BottomNavigation/BottomNavigationBar.tsx
index 0bfe303bfb443396ede776726faa0f8ba32752cd..73269f93fe03cd6b07aa54acf2849a638055b07a 100644
--- a/src/components/BottomNavigation/BottomNavigationBar.tsx
+++ b/src/components/BottomNavigation/BottomNavigationBar.tsx
@@ -4,9 +4,9 @@ import {
ColorValue,
EasingFunction,
Platform,
+ Pressable,
StyleProp,
StyleSheet,
- Pressable,
View,
ViewStyle,
} from 'react-native';
@@ -14,11 +14,6 @@ import {
import color from 'color';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

-import {
- getActiveTintColor,
- getInactiveTintColor,
- getLabelColor,
-} from './utils';
import { useInternalTheme } from '../../core/theming';
import overlay from '../../styles/overlay';
import { black, white } from '../../styles/themes/v2/colors';
@@ -30,9 +25,13 @@ import useLayout from '../../utils/useLayout';
import Badge from '../Badge';
import Icon, { IconSource } from '../Icon';
import Surface from '../Surface';
-import TouchableRipple from '../TouchableRipple/TouchableRipple';
-import { Props as TouchableRippleProps } from '../TouchableRipple/TouchableRipple';
+import TouchableRipple, { Props as TouchableRippleProps } from '../TouchableRipple/TouchableRipple';
import Text from '../Typography/Text';
+import {
+ getActiveTintColor,
+ getInactiveTintColor,
+ getLabelColor,
+} from './utils';

type BaseRoute = {
key: string;
@@ -360,7 +359,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
navigationState,
renderIcon,
renderLabel,
- renderTouchable = (props: TouchableProps<Route>) => <Touchable {...props} />,
+ renderTouchable = (props: TouchableProps<Route>) => <Touchable {...props} key={props.key} />,
getLabelText = ({ route }: { route: Route }) => route.title,
getBadge = ({ route }: { route: Route }) => route.badge,
getColor = ({ route }: { route: Route }) => route.color,
6 changes: 5 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { makeAutoObservable, toJS } from 'mobx'
import { observer } from 'mobx-react-lite'
import { useRef } from 'react'
import { View } from 'react-native'
import { Icon, PaperProvider } from 'react-native-paper'
import { Icon, PaperProvider, TouchableRipple } from 'react-native-paper'
import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation'
import { SafeAreaProvider } from 'react-native-safe-area-context'

Expand Down Expand Up @@ -171,6 +171,10 @@ const Navigation = observer(function Navigation() {
<Icon source={ScreenIcons[route.name]} color={color} size={23} />
),
})}
// https://github.com/callstack/react-native-paper/issues/4401
renderTouchable={({ key, ...props }) => (
<TouchableRipple {...props} key={key} />
)}
>
{!API.session && (
<Tab.Screen name={LANG['s_log_in']} component={LoginScreen} />
Expand Down
14 changes: 14 additions & 0 deletions docs/logcat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
while :; do
adb $@ logcat | sed \
-e 's/ V /\x00\x1b[0;35m V /g' \
-e 's/ D /\x00\x1b[0;36m D /g' \
-e 's/ I /\x00\x1b[0;32m I /g' \
-e 's/ W /\x00\x1b[0;33m W /g' \
-e 's/ E /\x00\x1b[0;31m E /g' \
-e 's/ F /\x00\x1b[0;31m F /g' \
-e '/Unexpected value from nativeGetEnabledTags/d' \
-e '/The application may be/d' \
-e '/onBiometricErrorln_/d'
sleep 1
done
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
"expo-system-ui": "~4.0.6",
"expo-task-manager": "~12.0.3",
"expo-updates": "~0.26.10",
"mobx": "^6.12.0",
"mobx": "^6.13.5",
"mobx-persist-store": "^1.1.3",
"mobx-react-lite": "^4.0.5",
"mobx-react-lite": "^4.1.0",
"react": "18.3.1",
"react-native": "0.76.5",
"react-native-gesture-handler": "~2.20.2",
"react-native-logs": "^5.0.1",
"react-native-mmkv": "^2.11.0",
"react-native-paper": "^5.12.3",
"react-native-paper": "patch:react-native-paper@npm%3A5.12.5#~/.yarn/patches/react-native-paper-npm-5.12.5-c595c2e788.patch",
"react-native-reanimated": "~3.16.1",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/models/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as NavigationBar from 'expo-navigation-bar'
import * as SystemUI from 'expo-system-ui'

import { captureException } from '@sentry/react-native'
import { makeAutoObservable, runInAction } from 'mobx'
import { makeAutoObservable, runInAction, toJS } from 'mobx'
import { Appearance } from 'react-native'
import { MD3DarkTheme, MD3LightTheme } from 'react-native-paper'
import type { MD3Colors } from 'react-native-paper/lib/typescript/types'
Expand Down Expand Up @@ -65,7 +65,7 @@ export class ThemeStore {
}

get fonts() {
return this.theme.fonts
return toJS(this.theme.fonts)
}

constructor() {
Expand Down
33 changes: 12 additions & 21 deletions src/services/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,34 @@ import * as Sentry from '@sentry/react-native'
import * as updates from 'expo-updates'

// Construct a new instrumentation instance. This is needed to communicate between the integration and React
export const SENTRY_ROUTING = new Sentry.ReactNavigationInstrumentation()
export const SENTRY_ROUTING = Sentry.reactNavigationIntegration({
enableTimeToInitialDisplay: true,
})

const manifest = updates.manifest
const metadata =
manifest && 'metadata' in manifest ? manifest.metadata : undefined
const extra = manifest && 'metadata' in manifest ? manifest.extra : undefined
const updateGroup =
metadata && 'updateGroup' in metadata ? metadata.updateGroup : undefined
const owner = extra?.expoClient?.owner ?? '[account]'
const slug = extra?.expoClient?.slug ?? '[project]'

Sentry.configureScope(scope => {
scope.setTag('expo-update-id', updates.updateId)
scope.setTag('expo-is-embedded-update', updates.isEmbeddedLaunch)

if (typeof updateGroup === 'string') {
scope.setTag('expo-update-group-id', updateGroup)
Sentry.setContext('expo', {
'update-id': updates.updateId,
'is-embeded-update': updates.isEmbeddedLaunch,
'update-group': updateGroup,
'debug-url': `https://expo.dev/accounts/${owner}/projects/${slug}/updates/${updateGroup}`
})

const owner = extra?.expoClient?.owner ?? '[account]'
const slug = extra?.expoClient?.slug ?? '[project]'
scope.setTag(
'expo-update-debug-url',
`https://expo.dev/accounts/${owner}/projects/${slug}/updates/${updateGroup}`,
)
} else if (updates.isEmbeddedLaunch) {
// This will be `true` if the update is the one embedded in the build, and not one downloaded from the updates server.
scope.setTag('expo-update-debug-url', 'not applicable for embedded updates')
}
})

Sentry.init({
dsn: 'https://9f602cf540f26a8de9d5d708df4558b3@o4506601427369984.ingest.sentry.io/4506601430122496',
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
tracesSampleRate: 0.9,
ignoreErrors: [/Unable activate keep awake/g],
integrations: [
new Sentry.ReactNativeTracing({
routingInstrumentation: SENTRY_ROUTING,
}),
SENTRY_ROUTING,
],

enabled: !__DEV__,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"jsx": "react-native",
"jsx": "preserve",
"lib": ["DOM", "ESNext"],
"target": "ESNext",
"module": "ESNext",
Expand Down
60 changes: 38 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10120,27 +10120,27 @@ __metadata:
languageName: node
linkType: hard

"mobx-react-lite@npm:^4.0.5":
version: 4.0.5
resolution: "mobx-react-lite@npm:4.0.5"
"mobx-react-lite@npm:^4.1.0":
version: 4.1.0
resolution: "mobx-react-lite@npm:4.1.0"
dependencies:
use-sync-external-store: "npm:^1.2.0"
use-sync-external-store: "npm:^1.4.0"
peerDependencies:
mobx: ^6.9.0
react: ^16.8.0 || ^17 || ^18
react: ^16.8.0 || ^17 || ^18 || ^19
peerDependenciesMeta:
react-dom:
optional: true
react-native:
optional: true
checksum: 10c0/6c8f69646ee9fb50155062c8a43e6d222a7b9dbd28f139648dcbb2a097d9ea660d643dd94529355e7f6926561e37c0206ca9e477f01784aedafbed607daceda6
checksum: 10c0/72300665cc64d73a58d650bdf5131878376a865ae708cabc2940ee22cf6b762aeed239a83ea104ea3742a0b1563a81a19acc02f162e19f524a9b5b0f0a86668e
languageName: node
linkType: hard

"mobx@npm:^6.12.0":
version: 6.12.0
resolution: "mobx@npm:6.12.0"
checksum: 10c0/18226d1120b0b21faf142c812f5e9dc670b03a3ad3fb868b9aeb9dffb72b7f0866591e50c3d07b79b01bdd4ca264b9843fb996a980b8bcb59f5a53597a8a2b90
"mobx@npm:^6.13.5":
version: 6.13.5
resolution: "mobx@npm:6.13.5"
checksum: 10c0/43691c836363aa1f13c44e43c86ab89fc8f4b83ef408bc6c68d799260e74b4ff08ebba2ef16bda447c6b7bca3558768e15927c0b21ffbb10e99b610783f28859
languageName: node
linkType: hard

Expand Down Expand Up @@ -11385,9 +11385,25 @@ __metadata:
languageName: node
linkType: hard

"react-native-paper@npm:^5.12.3":
version: 5.12.3
resolution: "react-native-paper@npm:5.12.3"
"react-native-paper@npm:5.12.5":
version: 5.12.5
resolution: "react-native-paper@npm:5.12.5"
dependencies:
"@callstack/react-theme-provider": "npm:^3.0.9"
color: "npm:^3.1.2"
use-latest-callback: "npm:^0.1.5"
peerDependencies:
react: "*"
react-native: "*"
react-native-safe-area-context: "*"
react-native-vector-icons: "*"
checksum: 10c0/feeeedae6fcd9684be04a8a9e9f568776d1680efa190cf0594d72fd91724985bbef2847e06e474ee6221dd1e236701e69c28f1e47f41cc0be8c99656ecf3f58c
languageName: node
linkType: hard

"react-native-paper@patch:react-native-paper@npm%3A5.12.5#~/.yarn/patches/react-native-paper-npm-5.12.5-c595c2e788.patch":
version: 5.12.5
resolution: "react-native-paper@patch:react-native-paper@npm%3A5.12.5#~/.yarn/patches/react-native-paper-npm-5.12.5-c595c2e788.patch::version=5.12.5&hash=f8b8d6"
dependencies:
"@callstack/react-theme-provider": "npm:^3.0.9"
color: "npm:^3.1.2"
Expand All @@ -11397,7 +11413,7 @@ __metadata:
react-native: "*"
react-native-safe-area-context: "*"
react-native-vector-icons: "*"
checksum: 10c0/0adc7c5dd3e47af357b9e0b700e9663d32d9e6e47cba10b26af76a4a63197bda47e5295d6bdc031904039aaa12b875a135fa512c323ea44d4c1ae97d68e1d356
checksum: 10c0/2f4b59bf8f82636de5f146440fd53c0564148cd3e9df5986aaaa905798599f81c2706f4be4c36445e03de2a0fc951b40bbe0c7e326694d70f3af47fd7fd2e2dd
languageName: node
linkType: hard

Expand Down Expand Up @@ -13528,12 +13544,12 @@ __metadata:
languageName: node
linkType: hard

"use-sync-external-store@npm:^1.2.0":
version: 1.2.0
resolution: "use-sync-external-store@npm:1.2.0"
"use-sync-external-store@npm:^1.4.0":
version: 1.4.0
resolution: "use-sync-external-store@npm:1.4.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
checksum: 10c0/ac4814e5592524f242921157e791b022efe36e451fe0d4fd4d204322d5433a4fc300d63b0ade5185f8e0735ded044c70bcf6d2352db0f74d097a238cebd2da02
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
checksum: 10c0/ec011a5055962c0f6b509d6e78c0b143f8cd069890ae370528753053c55e3b360d3648e76cfaa854faa7a59eb08d6c5fb1015e60ffde9046d32f5b2a295acea5
languageName: node
linkType: hard

Expand Down Expand Up @@ -14137,15 +14153,15 @@ __metadata:
expo-system-ui: "npm:~4.0.6"
expo-task-manager: "npm:~12.0.3"
expo-updates: "npm:~0.26.10"
mobx: "npm:^6.12.0"
mobx: "npm:^6.13.5"
mobx-persist-store: "npm:^1.1.3"
mobx-react-lite: "npm:^4.0.5"
mobx-react-lite: "npm:^4.1.0"
react: "npm:18.3.1"
react-native: "npm:0.76.5"
react-native-gesture-handler: "npm:~2.20.2"
react-native-logs: "npm:^5.0.1"
react-native-mmkv: "npm:^2.11.0"
react-native-paper: "npm:^5.12.3"
react-native-paper: "patch:react-native-paper@npm%3A5.12.5#~/.yarn/patches/react-native-paper-npm-5.12.5-c595c2e788.patch"
react-native-reanimated: "npm:~3.16.1"
react-native-safe-area-context: "npm:4.12.0"
react-native-screens: "npm:~4.1.0"
Expand Down

0 comments on commit a64a746

Please sign in to comment.