小编Gos*_*dra的帖子

错误:找不到变量堆栈,反应导航

我正在尝试使用 react native 开发一个 todolist 应用程序,为此我对主屏幕进行了编码。我遵循了一些文档,但它给了我这个错误。请帮忙。我已按以下顺序执行了命令。

 expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

 npm install @react-navigation/native

 npm install @react-navigation/stack
Run Code Online (Sandbox Code Playgroud)

吨

这是我的代码。

import React from 'react';
import { StyleSheet, Text, View ,Button} from 'react-native';
import 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator} from '@react-navigation/stack';

class HomeScreen extends React.Component {
  constructor(props){
    super(props);
    this.state={}
  }
  render(){
    return(
      <View>
      <View style={{margin:50}}>
        <Button title="New Task"></Button>
      </View>
    </View>
    )
  }
}

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} /> …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

3
推荐指数
1
解决办法
3408
查看次数

标签 统计

react-native ×1

react-navigation ×1