我是 ClojureScript 的新手。我想使用 ClojureScript 和 React Native 将视频 (Youtube) 嵌入到混合移动应用程序中。我试图在 ClojureScript 中实现react-native-video和react-native-youtube插件来实现这一点。但是,这两者都以崩溃告终。我不知道引用图书馆是否有问题。
使用react-native-video:
(def Video (js/require "react-native-video"))
(def video-view (r/adapt-react-class Video))
组件参考是:
[video-view {:style {:position "absolute"
:top 0
:bottom 0
:left 0
:right 0}
:source {:uri "https://www.youtube.com/watch?v=M8Fn8SfXw3M"}}]
使用react-native-youtube:
(def YouTube (js/require "react-native-youtube"))
(def video-view (r/adapt-react-class YouTube))
组件参考:
[video-view {:style {:flex 1
:margin-bottom 60
:padding-top 10
:padding-bottom 10}
:video-id "M8Fn8SfXw3M"
:play true
:fullscreen true
:loop true}]
这两个选项都不起作用。
以下是崩溃报告:
> Invariant Violation: Element type is invalid: expected a string (for
> built-in components) or a class/function (for composite components)
> but got: object This error is located at:
> in RCTView
> in RCTView
> in RCTScrollView
> in ScrollView
> in t
> in RCTView
> in :page-art-single
> in RCTView
> in .a
> in RCTView
> in :main
> in py
> in RCTView
> in RCTView
> in t Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite
> components) but got: object. This error is located at:
> in RCTView
> in RCTView
> in RCTScrollView
> in ScrollView
> in t
> in RCTView
> in :page-art-single
> in RCTView
> in .a
> in RCTView
> in :main
> in py
> in RCTView
> in RCTView
> in t undefined is not an object (evaluating 'this.map.setNativeProps') D/ReactNative(15325):
> ReactInstanceManager.detachViewFromInstance()
我正在使用lein来编译 ClojureScript Re-Natal以构建这个基于 ClojureScript 的 React Native 应用程序。
上面的代码有什么问题吗?任何人,请帮忙?
参考: