TypeError:未定义不是评估'new _reactNativeAudioToolkit.Player的构造函数

时间:2018-10-16 01:36:42

标签: javascript node.js react-native npm expo

我正在为iOS和Android创建一个用expo初始化并用expo编译的React Native应用程序。该应用程序需要react-native-audio-toolkit npm库。我已经使用npm install安装了该库。但是,尝试使用该库时出现以下错误:

TypeError: undefined is not a constructor (evaluating 'new 
_reactNativeAudioToolkit.Player('http://****:8000/')')
This error is located at:
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)

这是我的基本代码:

import { Player } from 'react-native-audio-toolkit';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
   render() {
       const player = new Player('http://boombox.middlebury.edu:8000/');
       return ();
   }
}

我只是试图加载一个播放器,并且当前在主应用程序屏幕上什么也不显示,但是上面的错误不断出现。我也导入的“ react”和“ react-native”库工作正常。我目前仅在iOS模拟器中运行该应用程序。

0 个答案:

没有答案