0

When I'm trying to run the server by run-android, this is the error I'm getting. I've been getting this error since I've installed this package: react-native-paper.

This is a screenshot of my android emulator.

I'm trying to add a search bar and to the page.

The code mentioned below is from App.js file

import React from "react";
import { SafeAreaView } from 'react-native-safe-area-context';
import { Searchbar } from "react-native-paper";
import { Text, View, StyleSheet } from "react-native";

export default function App() {
  return (
    <>
      <SafeAreaView style={styles.container}>
        <View style={styles.search}>
          <Searchbar />
        </View>
        <View style={styles.list}>
          <Text>List</Text>
        </View>
      </SafeAreaView>
    </>
  )
}

The dependencies file from Package.json

{
  "name": "restaurantapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-paper": "^5.1.2",
    "react-native-safe-area-context": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

I have tried uninstalling the package and then re-installing it again, but still it's not helping. I also did try --clean-cache cmd, but no use of it either.

FiddlingAway
  • 1,598
  • 3
  • 14
  • 30
Rohitt05
  • 1
  • 1
  • Does [this help](https://stackoverflow.com/questions/58080348/react-native-unable-to-resolve-module-indeed-none-of-these-files-exist) in resolving your issue? – FiddlingAway Jan 01 '23 at 15:19

1 Answers1

0

You have to wrap your App.js code into Provider from react-native-paper. In Usage Section.

Reference Link : https://callstack.github.io/react-native-paper/getting-started.html#:~:text=file_ext%3D.ios.js-,Usage,-Wrap%20your%20root