前提・実現したいこと
現在下記の記事を参考にreact nativeでgoogle mapを表示しようと試みています。
https://dev-yakuza.github.io/react-native/react-native-maps/
https://dev-yakuza.github.io/react-native/react-native-maps/
ですが下記のようなerrorが出ています、、
// react-native run-iosをしました //ターミナル warning: the transform cache was reset. Loading dependency graph, done. Error: Unable to resolve module `./index` from ``:
//シュミレータ側 Could not connect to development server. Ensure the following: - Node server is running and available on the same network - run 'npm start' from react-native root - Node server URL is correctly set in AppDelegate - WiFi is enabled and connected to the same network as the Node Server URL: http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false RCTFatal __28-[RCTCxxBridge handleError:]_block_invoke _dispatch_call_block_and_release _dispatch_client_callout _dispatch_main_queue_callback_4CF __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal UIApplicationMain main start 0x0
該当のソースコード
// index.web.js import React from 'react'; import App from './src/App'; import {AppRegistry} from 'react-native'; AppRegistry.registerComponent('App', () => App); AppRegistry.runApplication('App', { rootTag: document.getElementById('root'), });
// ./src/App.js /** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow */ import React from 'react'; import { StyleSheet, } from 'react-native'; import { Container, } from 'react-native/Libraries/NewAppScreen'; import MapView, {PROVIDER_GOOGLE} from 'react-native-maps'; const App = () => { return ( <> <Container> <MapView style={styles.MapView} provider={PROVIDER_GOOGLE} /> </Container> </> ); }; const styles = StyleSheet.create({ MapView: { flex: 1, }, }); export default App;
// packge.json { "name": "AppMap", "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": "^16.12.0", "react-dom": "^16.12.0", "react-native": "0.61.5", "react-native-maps": "^0.26.1", "react-native-web": "^0.12.1" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^0.0.7", "babel-jest": "^25.1.0", "babel-plugin-react-native-web": "^0.12.1", "eslint": "^6.8.0", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.58.0", "react-test-renderer": "16.9.0" }, "jest": { "preset": "react-native" } }
試したこと
./node_modules/react-native/scripts/packager.sh --reset-cache
killall node
再起動
pod setup
errorからファイルが読み込めていないとういうことなのでしょうか、もしよろしければ教えてください!
私はpackage.jsonにmainがないのが気になります
補足情報(FW/ツールのバージョンなど)
expoは使用していません
回答1件
あなたの回答
tips
プレビュー