Polyfill for native
This commit is contained in:
@@ -171,6 +171,7 @@
|
|||||||
"react-native-compressor": "^1.8.24",
|
"react-native-compressor": "^1.8.24",
|
||||||
"react-native-date-picker": "^4.4.2",
|
"react-native-date-picker": "^4.4.2",
|
||||||
"react-native-drawer-layout": "^4.0.0-alpha.3",
|
"react-native-drawer-layout": "^4.0.0-alpha.3",
|
||||||
|
"react-native-fetch-api": "^3.0.0",
|
||||||
"react-native-fs": "^2.20.0",
|
"react-native-fs": "^2.20.0",
|
||||||
"react-native-gesture-handler": "~2.16.2",
|
"react-native-gesture-handler": "~2.16.2",
|
||||||
"react-native-get-random-values": "~1.11.0",
|
"react-native-get-random-values": "~1.11.0",
|
||||||
@@ -202,6 +203,7 @@
|
|||||||
"statsig-react-native-expo": "^4.6.1",
|
"statsig-react-native-expo": "^4.6.1",
|
||||||
"tippy.js": "^6.3.7",
|
"tippy.js": "^6.3.7",
|
||||||
"tlds": "^1.234.0",
|
"tlds": "^1.234.0",
|
||||||
|
"web-streams-polyfill": "3.1.1",
|
||||||
"zeego": "^1.6.2",
|
"zeego": "^1.6.2",
|
||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {useQuery} from '@tanstack/react-query'
|
|||||||
import {createFromFetch} from 'react-server-dom-webpack/client'
|
import {createFromFetch} from 'react-server-dom-webpack/client'
|
||||||
|
|
||||||
import {STALE} from 'state/queries'
|
import {STALE} from 'state/queries'
|
||||||
|
import {fetch} from './fetch'
|
||||||
|
|
||||||
export function AppComponent({origin}: {origin: string}) {
|
export function AppComponent({origin}: {origin: string}) {
|
||||||
const {data} = useQuery({
|
const {data} = useQuery({
|
||||||
@@ -11,6 +12,8 @@ export function AppComponent({origin}: {origin: string}) {
|
|||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const {root} = await createFromFetch(
|
const {root} = await createFromFetch(
|
||||||
fetch(origin, {
|
fetch(origin, {
|
||||||
|
// @ts-ignore
|
||||||
|
reactNative: {textStreaming: true},
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'text/x-component',
|
Accept: 'text/x-component',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const fetch = window.fetch
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
export {fetch} from 'react-native-fetch-api'
|
||||||
@@ -53,3 +53,5 @@ globalThis.atob = (str: string): string => {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import 'web-streams-polyfill/dist/polyfill'
|
||||||
|
|||||||
@@ -17179,6 +17179,11 @@ osenv@^0.1.5:
|
|||||||
os-homedir "^1.0.0"
|
os-homedir "^1.0.0"
|
||||||
os-tmpdir "^1.0.0"
|
os-tmpdir "^1.0.0"
|
||||||
|
|
||||||
|
p-defer@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83"
|
||||||
|
integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw==
|
||||||
|
|
||||||
p-finally@^1.0.0:
|
p-finally@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
||||||
@@ -18895,6 +18900,13 @@ react-native-drawer-layout@^4.0.0-alpha.3:
|
|||||||
dependencies:
|
dependencies:
|
||||||
use-latest-callback "^0.1.9"
|
use-latest-callback "^0.1.9"
|
||||||
|
|
||||||
|
react-native-fetch-api@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz#81e1bb6562c292521bc4eca52fe1097f4c1ebab5"
|
||||||
|
integrity sha512-g2rtqPjdroaboDKTsJCTlcmtw54E25OjyaunUP0anOZn4Fuo2IKs8BVfe02zVggA/UysbmfSnRJIqtNkAgggNA==
|
||||||
|
dependencies:
|
||||||
|
p-defer "^3.0.0"
|
||||||
|
|
||||||
react-native-fs@^2.20.0:
|
react-native-fs@^2.20.0:
|
||||||
version "2.20.0"
|
version "2.20.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.20.0.tgz#05a9362b473bfc0910772c0acbb73a78dbc810f6"
|
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.20.0.tgz#05a9362b473bfc0910772c0acbb73a78dbc810f6"
|
||||||
@@ -21823,6 +21835,11 @@ wcwidth@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
defaults "^1.0.3"
|
defaults "^1.0.3"
|
||||||
|
|
||||||
|
web-streams-polyfill@3.1.1:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz#1516f2d4ea8f1bdbfed15eb65cb2df87098c8364"
|
||||||
|
integrity sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==
|
||||||
|
|
||||||
webidl-conversions@^3.0.0:
|
webidl-conversions@^3.0.0:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
||||||
|
|||||||
Reference in New Issue
Block a user