cjam / cjam/react-native-spotify-remote
TypeError: null is not an object (evaluating 'react_native_1.NativeModules.RNSpotifyRemoteAuth.authorize')
- Dominant language
- Objective-C
- Stars
- 283
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I tried to install and use this package as it seems to be perfect for my usecase. I did everything described in the docs and I also tried the manual linking steps for android but I still get this error. It's probably important to know that I use expo but a bare workflow. I saw [this issue](https://github.com/cjam/react-native-spotify-remote/issues/52), but he used an expo managed workflow. My React Native version is 0.69.3. My code looks exactly the same as described in the docs:
```
import React, { useContext, useEffect } from "react";
import { Button, Text, View, StyleSheet } from "react-native";
import { ThemeContext } from "../context/context";
import { lightTheme, darkTheme } from "../styles/themes";
import {
auth as SpotifyAuth,
remote as SpotifyRemote,
ApiScope,
} from "react-native-spotify-remote";
// Api Config object, replace with your own applications client id and urls
const spotifyConfig = {
clientID: "0f080...",
redirectURL: "exp://192.168.10.35:19000/--/callback",
tokenRefreshURL: "SPOTIFY_TOKEN_REFRESH_URL",
tokenSwapURL: "SPOTIFY_TOKEN_SWAP_URL",
scopes: [ApiScope.AppRemoteControlScope, ApiScope.UserFollowReadScope],
};
export default function MusicScreen({ navigation }) {
const { getTheme } = useContext(ThemeContext);
const theme = getTheme();
async function playEpicSong() {
try {
const session = await SpotifyAuth.authorize(spotifyConfig);
await SpotifyRemote.connect(session.accessToken);
await SpotifyRemote.playUri("spotify:track:6IA8E2Q5ttcpbuahIejO74");
await SpotifyRemote.seek(58000);
} catch (err) {
console.error("Couldn't authorize with or connect to Spotify", err);
}
}
return (
playEpicSong()} />
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
```
I hope you can help me!
Contributor guide
Assessment
This issue has not been assessed yet.