A few years ago i created an expo app. Added a few extra things on top of the default created app. Now I am trying to update this app to the latest expo version, after installing expo and all the dependecies i needed i get the following error after my app is built.
ERROR SyntaxError: E:\Reactnative-apps\ExceptionTransport - saveguard\App.js: Unexpected token, expected "," (51:12)
49 | } else {
50 | return (
> 51 | <View style={styles.container}>
| ^
52 |
53 | <NavigationContainer ref={containerRef} initialState={initialNavigationState}>
54 | <Stack.Navigator>
This is the full code of the file where the error happens
import * as React from 'react';
import { Platform, StatusBar, StyleSheet, View, Button } from 'react-native';
import * as SplashScreen from 'expo-splash-screen';
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import BottomTabNavigator from './navigation/BottomTabNavigator';
import useLinking from './navigation/useLinking';
import PreviewScreen from './screens/PreviewScreen'
const Stack = createStackNavigator();
export default function App(props) {
const [isLoadingComplete, setLoadingComplete] = React.useState(false);
const [initialNavigationState, setInitialNavigationState] = React.useState();
const containerRef = React.useRef();
const { getInitialState } = useLinking(containerRef);
// Load any resources or data that we need prior to rendering the app
React.useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
SplashScreen.preventAutoHideAsync();
// Load our initial navigation state
setInitialNavigationState(await getInitialState());
// Load fonts
await Font.loadAsync({
...Ionicons.font,
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
});
} catch (e) {
// We might want to provide this error information to an error reporting service
console.warn(e);
} finally {
setLoadingComplete(true);
SplashScreen.hideAsync();
}
}
loadResourcesAndDataAsync();
}, []);
if (!isLoadingComplete && !props.skipLoadingScreen) {
return null;
} else {
return (
<View style={styles.container}>
<NavigationContainer ref={containerRef} initialState={initialNavigationState}>
<Stack.Navigator>
<Stack.Screen name="Root" component={BottomTabNavigator} />
<Stack.Screen name="Preview" component={PreviewScreen} />
</Stack.Navigator>
</NavigationContainer>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
});
And this is the list of installed npm packages:
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-community/datetimepicker": "8.4.4",
"@react-navigation/bottom-tabs": "^7.8.6",
"@react-navigation/native": "^7.1.21",
"@react-navigation/stack": "^7.6.7",
"babel-preset-expo": "~54.0.0",
"expo": "~54.0.25",
"expo-asset": "~12.0.10",
"expo-checkbox": "~5.0.7",
"expo-file-system": "~19.0.19",
"expo-font": "~14.0.9",
"expo-linking": "~8.0.9",
"expo-mail-composer": "~15.0.7",
"expo-print": "~15.0.7",
"expo-splash-screen": "~31.0.11",
"expo-web-browser": "~15.0.9",
"moment": "^2.30.1",
"react": "19.1.0",
"react-native": "0.81.5",
"react-native-elements": "^3.4.3",
"react-native-modal": "^14.0.0-rc.1",
"react-native-signature-canvas": "^5.0.1",
"react-native-webview": "13.15.0",
"styled-components": "^6.1.19"