1

嘿伙计们,

我正在尝试在 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)

一些提示的人?

4

0 回答 0