You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am getting "TypeError: Cannot set property userAgent of # which has only a getter" on line 15 of index.js file.
Below line is from the \node_modules\react-native-signalr\src\index.js file where i am getting the error.
window.navigator.userAgent = window.navigator.userAgent || "react-native";
I am trying to create an android app using expo. I get this error when testing in the browser. Below is code from my App.js file:
`
import React from "react"
import { StyleSheet, View, Text } from "react-native"
import signalr from "react-native-signalr"
let isConnected = "no"
export default class App extends React.Component {
async componentDidMount() {
try {
const connection = signalr.hubConnection("replace with signalr URL")
connection.logging = true
connection.start().done(function () {
isConnected = "connected"
})
connection.error((error) => {
const errorMessage = error.message;
let detailedError = "";
if (error.source && error.source._response) {
detailedError = error.source._response;
}
if (detailedError === "An SSL error has occurred and a secure connection to the server cannot be made.") {
console.log("When using react-native-signalr on ios with http remember to enable http in App Transport Security https://github.com/olofd/react-native-signalr/issues/14")
}
console.debug("SignalR error: " + errorMessage, detailedError)
});
} catch (e) {
console.log(e)
}
}
render() {
return (
<View style={styles.container}>
<Text style={[styles.trackInfoText, styles.largeText]}>
SignalR status: {isConnected}
</Text>
</View>
)
}
Hi,
I am getting "TypeError: Cannot set property userAgent of # which has only a getter" on line 15 of index.js file.
Below line is from the \node_modules\react-native-signalr\src\index.js file where i am getting the error.
window.navigator.userAgent = window.navigator.userAgent || "react-native";
I am trying to create an android app using expo. I get this error when testing in the browser.
Below is code from my App.js file:
`
import React from "react"
import { StyleSheet, View, Text } from "react-native"
import signalr from "react-native-signalr"
let isConnected = "no"
export default class App extends React.Component {
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center"
},
albumCover: {
width: 250,
height: 250
},
trackInfo: {
padding: 40,
backgroundColor: "#fff"
},
})
`
Thanks,
Ahmed
The text was updated successfully, but these errors were encountered: