![](/img/trans.png)
[英]TypeError: undefined is not an object (evaluating '_this.props.navigation.openDrawer')
[英]TypeError: undefined is not an object(evaluation'_this.props.navigation.openDrawer')
我是編程新手,我遇到了一些我無法解決的問題。 我希望你們中的一些人可以提供幫助。
我收到錯誤消息:
類型錯誤:未定義不是對象(評估'_this.props.navigation.openDrawer')
當我試圖點擊我的導航器時。 我想從我的個人資料視圖導航到預訂視圖。
我測試了你的應用程序,我只有沒有抽屜的登錄頁面,所以你的 App 類的第二個 render() 方法似乎覆蓋了第一個。
然后我刪除了 App.js 上的第二個 render() 方法
然后我再次測試了您的源代碼:抽屜在 Android、iO、chrome 和 Firefox 上運行良好,只要用戶單擊 forwardburger 圖標,它就會打開。
所以我打賭你的問題是有兩個 render() 方法。
如果沒有,以下是讓我讓您的項目獨立工作的步驟:
expo init
-> 在 expo init 的交互式問題上,我將名稱設置為“openDrawer_problem”,然后將模板設置為“空白”
expo install firebase
expo install expo-constants
expo install react-navigation
expo install react-navigation-drawer
expo install @expo/vecto-icons
expo install react-native-paper
expo install react-native-screens
expo install react-native-gesture-handler
expo install react-native-reanimated
expo start
關於你的問題的旁注:
如果這能解決您的問題,請告訴我,我很好奇;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.