Gatsby - Build - WebpackError : Invariant failed - reactjs

I'm having troubles building my gatsby project.
Development is working fine, but when i try to build, I get an error :
ERROR #95313
Building static HTML failed for path "/Components/Layout/Footer/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
7 |
8 | if (isProduction) {
9 | throw new Error(prefix);
| ^
10 | } else {
11 | throw new Error(prefix + ": " + (message || ''));
12 | }
WebpackError: Invariant failed
- tiny-invariant.esm.js:9 invariant
[front-gatsby]/[tiny-invariant]/dist/tiny-invariant.esm.js:9:1
- react-router-dom.js:172 Object.children
[front-gatsby]/[react-router-dom]/esm/react-router-dom.js:172:132
- static-entry.js:240 Module.../../../../../front-gatsby/.cache/static-entry.js.__webpack_exports__.default
/front-gatsby/.cache/static-entry.js:240:18
- api-runner-ssr.js:19 MappingPromiseArray.PromiseArray._iterate
/front-gatsby/.cache/api-runner-ssr.js:19:1
I have no idea where to start debugging this. My website is pretty simple with some static pages and redux.
Below is my code.
I have basically a static website using redux and react router dom to navigate.
I had previously an error when building : "couldn't find the store" which is why I had to create both gatsby-browser and gatsby-ssr to enclose the Provider :
index.js:
import React, { Component } from 'react';
import './App.css';
import Navigation from './Components/Navigation'
import { library } from '#fortawesome/fontawesome-svg-core'
import { faStroopwafel, faStar, faCircle, faCheckCircle,faTimesCircle} from '#fortawesome/free-solid-svg-icons'
import 'bootstrap/dist/css/bootstrap.min.css';
class App extends Component {
render() {
library.add(faStroopwafel, faStar, faCircle, faCheckCircle, faTimesCircle)
return (
<div className="App">
<Navigation/>
</div>
);
}
}
export default App;
ReduxWrapper :
import React, { Component } from 'react';
import shop from './reducers/shop.reducer'; // importation du shop
import erreur from './reducers/erreur.reducer'; // importation du erreur
import panier from './reducers/panier.reducer'; // importation du erreur
import {Provider} from 'react-redux'; // importation du provider
import createEngine from 'redux-storage-engine-localstorage';
import {createStore, combineReducers, applyMiddleware} from 'redux'; // importation du reduceur
import * as storage from 'redux-storage'; // storage
const reducer = storage.reducer(combineReducers({shop, erreur,panier}));
const engine = createEngine('my-save-key');
const middleware = storage.createMiddleware(engine);
const createStoreWithMiddleware = applyMiddleware(middleware)(createStore);
const store = createStoreWithMiddleware(reducer);
const load = storage.createLoader(engine);
load(store);
export default ({ element }) => (
<Provider store={store}>{element}</Provider>
);
gatsby-browser & gatsby-ssr (identicals)
export { default as wrapRootElement } from './src/pages/ReduxWrapper';
My Package.json :
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing \""
},
"dependencies": {
"#feathersjs/feathers": "^4.3.0-pre.1",
"#feathersjs/rest-client": "^4.3.0-pre.1",
"#fortawesome/fontawesome-svg-core": "^1.2.18",
"#fortawesome/free-solid-svg-icons": "^5.8.2",
"#fortawesome/react-fontawesome": "^0.1.4",
"bootstrap": "^4.3.1",
"emailjs-com": "^2.4.0",
"express": "^4.17.0",
"express-favicon": "^2.0.1",
"fs": "0.0.1-security",
"gatsby": "^2.15.28",
"gatsby-plugin-mailchimp": "^5.1.2",
"gatsby-plugin-react-helmet": "^3.1.10",
"gatsby-plugin-stripe": "^1.2.3",
"react": "^16.10.1",
"react-bootstrap": "^1.0.0-beta.10",
"react-dom": "^16.10.1",
"react-helmet": "^5.2.1",
"react-redux": "^7.0.3",
"react-responsive-carousel": "^3.1.49",
"react-router-dom": "^5.0.0",
"react-router-hash-link": "^1.2.1",
"react-router-hash-link-offset": "^1.0.1",
"react-scripts": "2.1.8",
"react-scroll-to-component": "^1.0.2",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^4.0.0",
"reactstrap": "^7.1.0",
"redux": "^4.0.1",
"redux-storage": "^4.1.2",
"redux-storage-engine-localstorage": "^1.1.4",
"uuid": "^3.3.3"
},
"devDependencies": {
"prettier": "^1.18.2"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
This doesn't work when running "gatsby build", it stops at the step "Building static HTML for pages" and the error above is shown

I'd bet the problem is your use of redux-storage. Gatsby can't access any browser APIs during build, so you'll need to wrap a conditional check to make sure localstorage is available (per the html debugging page that has already been suggested).
I'm not familiar with redux usage in gatsby, but I would rewrite your redux wrapper to be closer to the official example, and put the redux-storage setup in a if (typeof window !== 'undefined') block

Related

React - Google SpreadSheet failing to import

Trying to import { GoogleSpreadsheet } from 'google-spreadsheet' in my React App but getting this nasty error
Uncaught ReferenceError: process is not defined
at loadProxy (gaxios.ts:66:5)
at node_modules/gaxios/build/src/gaxios.js (gaxios.ts:75:1)
at __require (chunk-RSJERJUL.js?v=0db569af:3:50)
at node_modules/gaxios/build/src/index.js (index.ts:15:1)
at __require (chunk-RSJERJUL.js?v=0db569af:3:50)
at node_modules/gcp-metadata/build/src/index.js (index.ts:8:1)
at __require (chunk-RSJERJUL.js?v=0db569af:3:50)
at node_modules/google-auth-library/build/src/auth/googleauth.js (googleauth.js:19:21)
at __require (chunk-RSJERJUL.js?v=0db569af:3:50)
at node_modules/google-auth-library/build/src/index.js (index.js:17:22)
here below is a screenshot of my current app structure that I have started using Vite (which maybe is why this is not working?)
package.json
{
"name": "tinder-triage",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"google-spreadsheet": "^3.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"#types/react": "^18.0.27",
"#types/react-dom": "^18.0.10",
"#vitejs/plugin-react": "^3.1.0",
"vite": "^4.1.0"
}
}
vite.config.js
import { defineConfig } from 'vite'
import react from '#vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})

i cant use hooks in react,advice?

I'm building a react app and when i started with my first hook function I got this error
react-dom.development.js:16227
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
at Object.throwInvalidHookError (react-dom.development.js:16227:1)
at useState (react.development.js:1622:1)
at MenuWrapper (menuWrapper.jsx:16:1)
at MenuList.jsx:12:1
at Array.map (<anonymous>)
at MenuList (MenuList.jsx:8:1)
at Menu.render (menu.jsx:108:1)
at finishClassComponent (react-dom.development.js:19752:1)
at updateClassComponent (react-dom.development.js:19698:1)
at beginWork (react-dom.development.js:21611:1)
react-dom.development.js:18687
The above error occurred in the <Menu> component:
at Menu (http://localhost:3000/static/js/bundle.js:385:5)
at div
at div
at App (http://localhost:3000/static/js/bundle.js:62087:78)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
logCapturedError # react-dom.development.js:18687
react-dom.development.js:26923
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
at Object.throwInvalidHookError (react-dom.development.js:16227:1)
at useState (react.development.js:1622:1)
at MenuWrapper (menuWrapper.jsx:16:1)
at MenuList.jsx:12:1
at Array.map (<anonymous>)
at MenuList (MenuList.jsx:8:1)
at Menu.render (menu.jsx:108:1)
at finishClassComponent (react-dom.development.js:19752:1)
at updateClassComponent (react-dom.development.js:19698:1)
at beginWork (react-dom.development.js:21611:1)
this is my package.json
{
"name": "jonathan",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"#babel/runtime": "^7.5.0",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^14.4.3",
"airbnb-prop-types": "^2.16.0",
"axios": "^1.1.3",
"bootstrap": "^5.2.2",
"create-webpack-config": "^0.2.1",
"html-webpack-plugin": "^5.5.0",
"jquery": "^3.6.1",
"mdb-react-ui-kit": "^4.2.0",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
"react-bootstrap-accordion": "^1.0.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-onclickout": "^2.0.8",
"react-outside-click-handler": "^1.3.0",
"react-router": "^6.4.2",
"react-router-dom": "^6.4.2",
"react-script-tag": "^1.1.2",
"react-scripts": "^5.0.1",
"type-fest": "^3.1.0",
"webpack-dev-server": "^4.11.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.19.6",
"#babel/node": "^7.20.0",
"#babel/preset-env": "^7.19.4",
"#babel/preset-react": "^7.18.6",
"web-vitals": "^3.0.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
}
}
Finally, the .jsx page that I used the usestate.
import React, { useState }from "react";
import Area from "../ReadFolder/geographicMainComponents/areaMainComponent.jsx";
import City from "../ReadFolder/geographicMainComponents/cityMainComponent.jsx";
import Country from "../ReadFolder/geographicMainComponents/countryMainComponent.jsx";
import Neighborhood from "../ReadFolder/geographicMainComponents/neighborhoodMainComponent.jsx";
import Region from "../ReadFolder/geographicMainComponents/regionMainComponent.jsx";
import { default as AreaW} from "../WriteFolder/geographicMainComponents/areaMainComponent.jsx";
import { default as CityW} from "../WriteFolder/geographicMainComponents/cityMainComponent.jsx";
import { default as CountryW} from "../WriteFolder/geographicMainComponents/countryMainComponent.jsx";
import { default as NeighborhoodW} from "../WriteFolder/geographicMainComponents/neighborhoodMainComponent.jsx";
import { default as RegionW} from "../WriteFolder/geographicMainComponents/regionMainComponent.jsx";
export function MenuWrapper(type,id,isEdit){
let [edit,setEdit] = useState(isEdit);
if(isEdit){
if(type==='country'){
return(
<div>
<div className={edit ? 'd-block' :'d-none'}><CountryW id={id}/><button onclick={() => setEdit=false}>read</button></div>
<div className={edit ? 'd-none' : 'd-block'}><Country id={id} /><button onclick={() => setEdit=true}>edit</button></div>
</div>
);
}
else{return(<div></div>)}
}
else{return(<div></div>)}
}
sorry, this is so long. please note I tried deleting the package_lock,json and node modules. then I tried npm start and even added a --force.that didn't resolve the issue.
For where I called it
import React,{Component} from "react";
import { MenuWrapper } from "./menuWrapper.jsx";
export function MenuList(Items,kind){
if(Items===null){
return(<div></div>)
}
return(
<div>
{
Items.map((item)=>{
return(
MenuWrapper(kind,item.id,false)
)
})
}
</div>
);
}
hooks can be called only within react components. MenuWrapper is not a react component (you are not invoking it as <MenuWrapper />).
You should use it as a component:
return (
<MenuWrapper kind={kind} id={item.id} ...otherProps />
);
and then:
export function MenuWrapper({ kind, id, isEdit }) {
// do stuff
}

with expo after Web Bundling complete , showing blank page

i followed a tutorial for adding web support using to a expo project **. using typescript, react-native-web and webpack. looks like it works for everyone. but for me, i get a blank web page after Web Bundling complete.
Started Metro Bundler
Web Bundling complete
even though it works just fine on the emulator. i get no error in the console.
package.json:
{
"name": "imibonano",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll",
"deploy": "gh-pages -d web-build",
"predeploy": "expo build:web",
"commit": "node scripts/github.js"
},
"dependencies": {
"#expo-google-fonts/poppins": "^0.2.2",
"#expo/webpack-config": "^0.16.24",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/slider": "4.2.1",
"#react-native-firebase/app": "^14.2.3",
"#react-native-picker/picker": "2.4.0",
"#react-navigation/bottom-tabs": "^6.0.9",
"#react-navigation/material-bottom-tabs": "^5.3.15",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"#react-navigation/stack": "^6.0.11",
"dotenv": "^14.2.0",
"expo": "~45.0.0",
"expo-app-loading": "^2.0.0",
"expo-cli": "^5.4.8",
"expo-font": "~10.1.0",
"expo-google-app-auth": "^8.1.7",
"expo-linear-gradient": "~11.3.0",
"expo-modules-core": "~0.9.2",
"expo-splash-screen": "^0.15.1",
"expo-status-bar": "~1.3.0",
"firebase": "^9.6.4",
"jest": "^28.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-custom-swiper": "^1.0.16",
"react-native-flipper": "^0.146.1",
"react-native-gesture-handler": " ~2.2.1",
"react-native-pager-view": "5.4.15",
"react-native-paper": "^4.7.2",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-swiper-flatlist": "^3.0.16",
"react-native-vector-icons": "^8.1.0",
"react-native-web": "0.17.7",
"react-native-web-swiper": "^2.2.2",
"react-query": "^3.39.1",
"react-query-native-devtools": "^4.0.0",
"react-redux": "^8.0.2"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react": "~17.0.21",
"#types/react-native": "~0.66.13",
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"private": true
}
app.tsx:
import { StatusBar } from "expo-status-bar";
import React from "react";
import NavigationStack from "./navigation/NavigationStack";
import Providers from "./navigation/index";
import useCachedResources from './hooks/useCachedResources';
import useColorScheme from './hooks/useColorScheme';
import AppLoading from 'expo-app-loading';
import { AuthProvider } from "./navigation/AuthProvider";
import { SafeAreaView, StyleSheet, Text } from "react-native";
import AppNavigation from './navigation';
import {
useFonts,
// Poppins_100Thin,
// Poppins_100Thin_Italic,
// Poppins_200ExtraLight,
// Poppins_200ExtraLight_Italic,
// Poppins_300Light,
// Poppins_300Light_Italic,
Poppins_400Regular,
// Poppins_400Regular_Italic,
Poppins_500Medium,
// Poppins_500Medium_Italic,
Poppins_600SemiBold,
// Poppins_600SemiBold_Italic,
// Poppins_700Bold,
// Poppins_700Bold_Italic,
// Poppins_800ExtraBold,
// Poppins_800ExtraBold_Italic,
// Poppins_900Black,
// Poppins_900Black_Italic
} from '#expo-google-fonts/poppins';
export default function App() {
const isLoadingComplete = useCachedResources();
const colorScheme = useColorScheme();
const [loaded] = useFonts({
title: require('./assets/fonts/klarissa.regular.ttf'),
Poppins_400Regular,
Poppins_600SemiBold,
Poppins_500Medium
});
if (!isLoadingComplete || !loaded) {
return <AppLoading />;
} else {
return <Providers />;
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0a0a0a",
alignItems: "center",
justifyContent: "center",
}
})
index.js:
import React from "react";
import { SafeAreaView, StyleSheet, Text } from "react-native";
import { AuthProvider } from "./AuthProvider";
import NavigationStack from "./NavigationStack";
export default function Providers() {
return (
<AuthProvider>
<SafeAreaView style={styles.container}>
<NavigationStack />
</SafeAreaView>
</AuthProvider>
);
}

gatsby, redux, Could not find "store" in the context of "Connect(CartContainer)"

The code was working fine in react-redux v5 but when I upgraded to v7 I obtained the following runtime error when navigating to the page with the CartContainer:
react-dom.development.js:11102 Uncaught Error: Could not find "store" in the context of
"Connect(CartContainer)". Either wrap the root component in a <Provider>, or pass a custom
React context provider to <Provider> and the corresponding React context consumer
to Connect(CartContainer) in connect options.
Now I do wrap the root-level component in a Provider, in the typical gatsby way,
Here is the ReduxWrapper.js file:
import React from 'react';
import { Provider } from 'react-redux';
import { getAllProducts } from './src/actions'
import { createStore, applyMiddleware } from 'redux'
import { createLogger } from 'redux-logger'
import thunk from 'redux-thunk'
import rootReducer from './src/reducers';
const middleware = [ thunk ];
if (process.env.NODE_ENV !== 'production') {
middleware.push(createLogger());
}
const store = createStore(rootReducer,applyMiddleware(...middleware))
store.dispatch(getAllProducts())
export default ({ element }) => (
<Provider store={store}>{element}</Provider>
);
The store instance should run downstream into any container that has connect() called on it.
additionally both gatsby-Browser.js and gatsby-ssr.js have the following:
export { default as wrapRootElement } from './ReduxWrapper';
the connected component in question, CartContainer.js is given below:
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { checkout } from '../actions'
import { getTotal, getCartProducts } from '../reducers'
import Cart from '../components/checkout/Cart'
const CartContainer = ({ products, total, checkout }) => (
<Cart
products={products}
total={total}
onCheckoutClicked={() => checkout(products)} />
)
CartContainer.propTypes = {
products: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
price: PropTypes.number.isRequired,
quantity: PropTypes.number.isRequired
})).isRequired,
total: PropTypes.string,
checkout: PropTypes.func.isRequired
}
const mapStateToProps = (state) => ({
products: getCartProducts(state),
total: getTotal(state)
})
export default connect(
mapStateToProps,
{ checkout }
)(CartContainer)
I am expecting CartContainer to have access to the store, and I suspect the problem lies with the fact I upgraded react-redux from v5 to v7, Since everything was working fine until that moment.
My dependencies:
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "1.0.0",
"author": "David W",
"dependencies": {
"#fortawesome/fontawesome": "^1.1.8",
"#fortawesome/fontawesome-free": "^5.12.1",
"#fortawesome/fontawesome-svg-core": "^1.2.27",
"#fortawesome/free-brands-svg-icons": "^5.12.1",
"#fortawesome/free-solid-svg-icons": "^5.12.1",
"#fortawesome/react-fontawesome": "^0.1.9",
"#reach/router": "^1.3.3",
"bootstrap": "^4.4.1",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"gatsby": "^2.19.45",
"gatsby-background-image": "^0.10.2",
"gatsby-image": "^2.2.43",
"gatsby-plugin-env-variables": "^1.0.1",
"gatsby-plugin-manifest": "^2.2.39",
"gatsby-plugin-offline": "^3.0.32",
"gatsby-plugin-react-helmet": "^3.1.23",
"gatsby-plugin-sass": "^2.1.29",
"gatsby-plugin-sharp": "^2.4.3",
"gatsby-source-filesystem": "^2.1.46",
"gatsby-transformer-sharp": "^2.3.13",
"google-map-react": "^1.1.6",
"jquery": "^3.4.1",
"node-sass": "^4.13.1",
"nodemailer": "^6.4.3",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-bootstrap": "^1.0.0-beta.17",
"react-dom": "^16.13.1",
"react-fontawesome": "^1.7.1",
"react-helmet": "^5.2.1",
"react-map-gl": "^5.2.3",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"prettier": "^1.19.1"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"heroku-postbuild": "gatsby build",
"start": "gatsby serve",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gatsbyjs/gatsby-starter-default.git"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"homepage": "https://github.com/gatsbyjs/gatsby-starter-default#readme",
"main": "gatsby-browser.js"
}

Unexpected Token - After updating dependencies in react native to latest versions

I am trying to import a very old react-native project. I updated the expo version to 36 and updated almost the dependencies to the latest version. It was a working code but upon running now, I get the following error in the below line
Unexpected token (59:18)
57 | navigationOptions:{
58 | drawerLabel: "Change Format",
> 59 | drawerIcon: <Icon name="list" size={20} color={TXT_COLOR_PRIMARY} />,
| ^
60 | },
61 | },
62 | Stops :{
Failed building JavaScript bundle.
Please find my App.js file
{
"name": "AwesomeProject",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-env": "^1.7.0",
"flow-bin": "^0.41.0",
"jest-expo": "36.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest",
"flow": "flow"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"core-js": "^3.6.4",
"create-react-class": "^15.6.3",
"eslint-cli": "^1.1.1",
"expo": "^36.0.0",
"material-ui": "^0.20.0",
"native-base": "^2.13.12",
"react": "^16.8.3",
"react-dom": "^16.4.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-audio-player-recorder-no-linking": "^1.0.2",
"react-native-elements": "^1.2.7",
"react-native-fetch-blob": "^0.10.8",
"react-native-file-uploader": "0.0.2",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-material-buttons": "^0.6.0",
"react-native-material-ui": "^1.30.1",
"react-native-permissions": "^2.0.10",
"react-native-radio-button": "^2.0.1",
"react-native-simple-radio-button": "^2.7.4",
"react-native-sound": "^0.11.0",
"react-native-sound-player": "^0.10.4",
"react-native-sound-recorder": "^1.3.4",
"react-native-table-component": "^1.2.1",
"react-native-tts": "^3.1.1",
"react-native-upload-file": "^0.1.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.3.0",
"react-timer-mixin": "^0.13.4"
}
}
Import statements in App.js
import React from 'react';
import {View, Text, StyleSheet,Image, TouchableHighlight} from 'react-native';
import {Radio, Right, ListItem} from 'native-base';
import { Icon } from 'react-native-elements';
import { TextButton, RaisedTextButton } from 'react-native-material-buttons';
import { StackNavigator,DrawerNavigator } from 'react-navigation'; // Version can be specified in package.json
import { Button, ThemeProvider } from 'react-native-material-ui';
import HomeScreen from './Screens/HomeScreen';
import Screen2 from './Screens/Screen2';
import Screen3 from './Screens/Screen3';
import Screen4 from './Screens/Screen4';
import Settings from './Screens/Settings';
import Stop_Info_Screen from './Screens/Stop_Info_Screen';
import AboutUsScreen from './Screens/AboutUs';
import FeedbackScreen from './Screens/Feedback';
import DrawerContent from './Additional_Components/SideDrawer'
import styles from './Styles/commonStyles';
import {COLOR_PRIMARY,COLOR_SECONDARY,TXT_COLOR_PRIMARY,TXT_COLOR_SECONDARY,DARK_PRIMARY_COLOR} from './constants';
I started working on react native only from yesterday. I apologize if this is silly. I tried googling this but I believe it is a very generic error. Any help will be highly appreciated.

Resources