[英]Error while importing react-navigation & native-base
I am new to react when I import stacknavigator from react-navigation
or listitem from native-base
. 当我
import stacknavigator from react-navigation
或native-base
listitem import stacknavigator from react-navigation
时,我是个新手。
enter code here
enter code here
I continuously get this error, tried the solution from GitHub repo issue number 4968 but that's not helpful, can you help, please? 我不断收到此错误,尝试从GitHub存储库发行号4968解决该问题,但这没有帮助,请您能帮忙吗? unable to resolve react-navigation, module doesn't exist in module map
无法解析反应导航,模块映射中不存在该模块
App.js {import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import {StackNavigator} from 'react-navigation' import LoginScreen from './Screens/LoginScreen' import HomeScreen from './Screens/HomeScreen' export default class App extends React.Component { render() { return ( <AppNavigator/> ); } } const AppNavigator = StackNavigator({ LoginScreen : {screen : LoginScreen}, HomeScreen : {screen : HomeScreen} }) const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, });` LoginScreen.js ` import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default class LoginScreen extends React.Component { render() { return ( <View> <Text> This is login Screen </Text> </View> ); } } export default LoginScreen;`
Using react-native, after you install a new package with npm install
, you must run react-native link
to update your node-modules folder. 使用react-native,在使用
npm install
新软件包之后,必须运行react-native link
来更新您的node-modules文件夹。 Then, if using android and if it is needed, you can run: 然后,如果使用android(如果需要),则可以运行:
cd android && gradlew clean
cd .. & react-native run-android
Also, your code presents some syntax errors in imports. 另外,您的代码在导入时也会出现一些语法错误。 Fix ;
解决; in end lines and the { at line 3 .
在最后一行, {在第3行。
Check NativeBase Docs. 检查NativeBase文档。 Installation for RN, Expo and web app are documented clearly.
RN,Expo和Web应用程序的安装已明确记录。
Also check https://reactnativeseed.com/ for working examples 另请查看https://reactnativeseed.com/以获取工作示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.