alexdwu3
alexdwu3

Reputation: 51

Issue with starting a new React-Native project

I'm starting a new project in React Native, and I'm running it with Expo Go on my phone. I only have two files, "App.js" and "SearchScreen.js". Every time I go to run the code I have in Expo Go, it successfully bundles, and then the app crashes (so I don't see an error, or know what my error is). I know it's not a problem with Expo Go because when I run the default code that comes with a blank react native app, it loads and functions correctly. The code in App.js and SearchScreen.js comes from a class that's a couple of years old, and I suspect that my problem may relate to that.

Because there's no error message, I'm not sure how to proceed. Does anyone know a solution to this?

Thanks in advance.

App.js:

import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import SearchScreen from './src/screens/SearchScreen';

const navigator = createStackNavigator(
  {
    Search: SearchScreen,
  },
  {
    initialRouteName: 'Search',
    defaultNavigationOptions: {
      title: 'Business Search',
    },
  }
);

export default createAppContainer(navigator);

SearchScreen.js:

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const SearchScreen = () => {
  return (
    <View>
      <Text>Search Screen</Text>
    </View>
  );
};

const styles = StyleSheet.create({});

export default SearchScreen;

Upvotes: 3

Views: 185

Answers (1)

alexdwu3
alexdwu3

Reputation: 51

I ran expo install react-native-gesture-handler and that fixed the problem for me.

When running my program on web, I was getting messages such as:

  • export 'ComposedGestureType' (reexported as 'ComposedGesture') was not found in './handlers/gestures/gestureComposition'
  • export 'ExclusiveGestureType' (reexported as 'ExclusiveGesture') was not found in './handlers/gestures/gestureComposition'

Now it's working on my phone again.

Upvotes: 1

Related Questions