I am new to ClojureScript. I would like to embed video (Youtube) to the hybrid mobile app using ClojureScript and React Native. I have tried to implement react-native-video and react-native-youtube plugins in ClojureScript for achieving this. But, both of these end with a crash. I don't know whether there is something wrong with referring to the library or not.
Using react-native-video:
(def Video (js/require "react-native-video"))
(def video-view (r/adapt-react-class Video))
The component reference is:
[video-view {:style {:position "absolute"
:top 0
:bottom 0
:left 0
:right 0}
:source {:uri "https://www.youtube.com/watch?v=M8Fn8SfXw3M"}}]
Using react-native-youtube:
(def YouTube (js/require "react-native-youtube"))
(def video-view (r/adapt-react-class YouTube))
The component reference:
[video-view {:style {:flex 1
:margin-bottom 60
:padding-top 10
:padding-bottom 10}
:video-id "M8Fn8SfXw3M"
:play true
:fullscreen true
:loop true}]
Neither of these two options is working.
Below is the crash report:
> 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()
I am using lein for compiling ClojureScript Re-Natal for building this ClojureScript-based React Native app.
Is there anything wrong with the above code? Anyone, please help?
Reference:
react-native-video
react-native-youtube