#reactjs #react-native
Вопрос:
привет, у меня есть две проблемы, и я сыт этим по горло. Первая ошибка «reactotron-react-native#react-native-flipper#react-native@^0.62.0» не удовлетворяет найденному соответствию «react-native@0.63.2» получаю эту ошибку. Из-за того, что я не могу работать в Интернете.
ReactotronConfig.js файл
import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
import reactotronSaga from 'reactotron-redux-saga';
import { AsyncStorage } from 'react-native';
if (__DEV__) {
const tron = Reactotron.configure()
.useReactNative()
.use(reactotronRedux())
.use(reactotronSaga())
.setAsyncStorageHandler(AsyncStorage)
.connect();
console.tron = tron;
tron.clear();
}
App.js
import React from 'react';
import { Provider } from 'react-redux';
import { registerRootComponent } from 'expo';
import './config/ReactotronConfig';
import Routes from '~/routes';
import store from '~/store';
function App() {
return (
<>
<Provider store={store}>
<Routes />
</Provider>
</>
);
}
export default registerRootComponent(App);
Пакеты.json
{
"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",
"server": "json-server-relationship --watch db.json"
},
"dependencies": {
"@expo/vector-icons": "^10.0.0",
"axios": "^0.19.0",
"expo": "^39.0.0",
"expo-font": "~8.3.0",
"expo-linear-gradient": "~8.3.0",
"immer": "^5.0.1",
"intl": "^1.2.5",
"json-server-relationship": "^0.14.5",
"lottie-react-native": "~2.6.1",
"prop-types": "^15.7.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
"react-native-countdown-component": "^2.6.0",
"react-native-flipper": "^0.85.0",
"react-native-gesture-handler": "~1.7.0",
"react-native-paper": "^3.2.1",
"react-native-root-toast": "^3.2.0",
"react-native-snap-carousel": "^3.8.4",
"react-native-web": "~0.13.7",
"react-navigation": "^4.0.10",
"react-navigation-material-bottom-tabs": "^2.1.5",
"react-redux": "^7.1.3",
"reactotron-react-js": "^3.3.7",
"reactotron-react-native": "^4.0.2",
"reactotron-redux": "^3.1.2",
"reactotron-redux-saga": "^4.2.3",
"redux": "^4.0.4",
"redux-saga": "^1.1.3",
"styled-components": "^4.4.1"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"babel-plugin-root-import": "^5.1.0",
"babel-preset-expo": "^8.3.0",
"eslint": "^6.7.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.7.0",
"eslint-import-resolver-babel-plugin-root-import": "^1.1.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^1.7.0",
"prettier": "^1.19.1"
},
"private": true
}
Second issue:-
I am trying to run same application on mobile using expo go but can not able to my local host my android phone after calling json-server localhost. even if i am changing my local ip replace to localhost.
api.js
import axios from 'axios';
const api = axios.create({
baseURL: 'http://localhost:3000',
});
export default api;
error
[Unhandled promise rejection: Error: Network Error]
at node_modulesaxioslibcorecreateError.js:15:17 in createError
at node_modulesaxioslibadaptersxhr.js:80:22 in handleError
at node_modulesevent-target-shimdistevent-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modulesreact-nativeLibrariesNetworkXMLHttpRequest.js:600:10 in setReadyState
at node_modulesreact-nativeLibrariesNetworkXMLHttpRequest.js:395:6 in __didCompleteResponse
at node_modulesreact-nativeLibrariesvendoremitterEventEmitter.js:189:10 in emit
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:416:4 in __callFunction
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:109:6 in __guard$argument_0
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:364:10 in __guard
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:108:4 in callFunctionReturnFlushedQueue
at [native code]:null in callFunctionReturnFlushedQueue