将本机组件与vue-native结合

时间:2019-04-07 22:50:41

标签: react-native vue-native

有什么办法可以将诸如https://github.com/archriss/react-native-snap-carousel/tree/master/example这样的反应本机组件与vue本机结合起来?

我有一个vue-native项目,并且想在其中使用react-native组件,但是我有一个我不明白的错误:控制台说:Invariant Violation: expected a string (for built-in components) or a class/function (for composite components) but got: undefined

<template>
  <nb-container>
    <nb-content>
              <carousel
                :data="similarEventsData"
                :renderItem="_renderItem"
                :sliderWidth="sliderWidth"
                :itemWidth="itemWidth"
                :inactiveSlideScale="0.95"
                :inactiveSlideOpacity="1"
                :enableMomentum="true"
                :activeSlideAlignment="'start'"
                :containerCustomStyle="stylesObj.slider"
                :contentContainerCustomStyle="stylesObj.sliderContentContainer"
                :activeAnimationType="'spring'"
                :activeAnimationOptions="{ friction: 4, tension: 40 }"
              />
    </nb-content>
  </nb-container>
</template>

<script>
import { Dimensions, Platform, Share } from "react-native";
import Carousel from 'react-native-snap-carousel';
import { scrollInterpolators, animatedStyles } from '../../utils/animations';

const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
const slideHeight = viewportHeight * 0.36;
const slideWidth = wp(75);
const itemHorizontalMargin = wp(2);

export default {
  components: { carousel: Carousel },
  computed: {
    similarEventsData () {
      return [1, 2, 3]
    }
  },
  data: function() {
    return {
      sliderWidth: viewportWidth,
      itemWidth: slideWidth + itemHorizontalMargin * 2,
      stylesObj: {
        slider: {
          marginTop: 15,
          overflow: 'visible'
        },
        sliderContentContainer: {
          paddingVertical: 10
        },
      }
    };
  },
  methods: {
    _renderItem ({item, index}) {
      return <Text>fsd</Text>;
    },
  },
};
</script>

我希望渲染一个组件但没有运气

0 个答案:

没有答案