-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue with "url.origin is not implemented" Error in React Native V6.4.4 #287
Comments
Confirmed fixed in v6.4.5: npm i @sanity/client@latest Here's how I tested it, using the official install instructions: npx create-expo-app AwesomeProject
cd AwesomeProject
npm i @sanity/client@6.4.5-canary.4 --save-exact
npx expo start The contents of my import { StatusBar } from 'expo-status-bar'
import { StyleSheet, Text, View } from 'react-native'
import { useEffect, useState } from 'react'
import { createClient } from '@sanity/client'
const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name' })
export default function App() {
const [error, setError] = useState(null)
if (error) {
throw error
}
const [count, setCount] = useState(null)
useEffect(() => {
client.fetch('count(*)').then(setCount).catch(setError)
}, [])
return (
<View style={styles.container}>
<Text>
{count === null ? 'Loading...' : `There are ${count} documents.`}
</Text>
<StatusBar style="auto" />
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
}) |
🎉 This issue has been resolved in version 6.4.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Problem Description
When using the encodeQueryString function in the React Native environment, we are encountering the error message: "url.origin is not implemented." It appears that this issue is related to the use of URLSearchParams, which is not fully supported in React Native.
Proposed Solution
To address this problem, I suggest refactoring the encodeQueryString function to manually construct the query string without relying on URLSearchParams. This will ensure compatibility with React Native as well as other JavaScript environments.
Here's a snippet of the proposed changes:
The text was updated successfully, but these errors were encountered: