question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_reactNativeSound2.default.setCategory is not a function

See original GitHub issue

Hi -

I just installed React Native Sounds and it seems to work fine. Though, when I try to get the Background Mode working, I get the following error:

_reactNativeSound2.default.setCategory is not a function

My implementation is relatively standard:

import Sound from 'react-native-sound';

export default class playTrack extends Component {
  constructor(props) {
    super(props);
    Sound.setCategory('Ambient', true);
    
    this.play = new Sound(props.trackPath, Sound.MAIN_BUNDLE, (error) => {
      if (error) {
        console.log('failed to load the sound', error);
      } else { // loaded successfully
        console.log('duration in seconds: ' + this.play.getDuration() +
        'number of channels: ' + this.play.getNumberOfChannels());
      }
    });
  }

Can someone troubleshoot?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jwilbertcommented, Feb 16, 2017

@benvium You were right. For some reason npm updated the module only to 0.8.3. I installed now 0.9.0 from GitHub. I also changed the code according to your suggestion. Unfortunately, both did not fix my issue. The Error now changed to:

Unhandled JS Exception: RNSound.setCategory is not a function

0reactions
benviumcommented, Feb 16, 2017

Great stuff. Glad you got it going.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(0, _hoc.default) is not a function. Require cycles are allowed ...
Here is my error went create a HOC use function component instead of class ... ERROR TypeError: (0, _hoc.default) is not a function....
Read more >
TypeError Handling in React.js for Map Function | Pluralsight
Learn why this error occurs and how to fix it: Uncaught TypeError: this.props.data.map is not a function.
Read more >
Ravenous Part 4 TypeError: default.search is not a function
Deploying my final ravenous project yields this issue: TypeError: util_Yelp__WEBPACK_IMPORTED_MODULE_5_.default.search is not a function.
Read more >
'X' is not a function TypeError in React [Solved] | bobbyhadz
The React.js Uncaught TypeError: X is not a function occurs when we try to call a value ... export default function App() {...
Read more >
React Error: "this.setstate is not a function" - How to Fix
"this.setstate is not a function" is a common error message that comes up in React. In this article, we'll learn how to fix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found