react-native - vue-native 中的 DrawerLayoutAndroid
问题描述
嘿伙计们,
我正在尝试在 vue-native 中使用 react-native 中的 DrawerLayoutAndroid,因为我正在使用 Vue.js 语言进行编码。问题是:有可能吗?
这是尝试的代码:
<template>
<DrawerLayoutAndroid
drawerWidth="300"
drawerPosition="left"
renderNavigationView="navigationView"
>
<view class="container">
<Navbar />
<text class="text-color-primary">My App</text>
</view>
</DrawerLayoutAndroid>
</template>
<script>
import Navbar from './src/Navbar/Navbar.vue'
import { TouchableWithoutFeedback, DrawerLayoutAndroid } from 'react-native-gesture-handler'
export default {
components: {
Navbar,
DrawerLayoutAndroid
},
methods: {
navigationView: () => {
return (<template>
<view>
<text> Texto do Menu </text>
</view>
</template> )
}
}
}
</script>
<style>
.container {
background-color: white;
}
.text-color-primary {
color: blue;
}
</style>
当我使用 expo 和 SDK 40 在我的 Android 中运行代码时,我看到了错误:
01-12 14:32:59.852 21634 24134 E ReactNativeJS: TypeError: renderNavigationView is not a function. (In 'renderNavigationView()', 'renderNavigationView' is "navigationView")
01-12 14:32:59.852 21634 24134 E ReactNativeJS:
01-12 14:32:59.852 21634 24134 E ReactNativeJS: This error is located at:
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in DrawerLayoutAndroid (at createNativeWrapper.js:47)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in NativeViewGestureHandler (at createNativeWrapper.js:46)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in ComponentWrapper (created by ReactVueComponent)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in ReactVueComponent (at renderApplication.js:45)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in RCTView (at View.js:34)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in View (at AppContainer.js:106)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in RCTView (at View.js:34)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in View (at AppContainer.js:132)
01-12 14:32:59.852 21634 24134 E ReactNativeJS: in AppContainer (at renderApplication.js:39)
一些提示的人?
解决方案
推荐阅读
- c# - 复制固定价值年金等式的代码,但未给出正确答案
- sockets - 如何获取蓝牙服务器设备的MAC地址?
- python - 有没有办法让我打印日期时间为 dd/mm/yyyy 的日期
- dbt - 如何使用 DBTCloud 执行存储过程
- c - 我怎样才能使这个蛮力算法多线程?
- flutter - 如何扩展底部菜单 - Flutter
- java - 将对象存储在 ArrayList 中并输出对象描述
- python - 调用函数导致 TypeError:缺少 1 个必需的位置参数:'self'
- git - 多个分支的合并顺序
- pine-script - 我可以在 Pinescript 的 IF condation 中保存变量吗?