Environment
[skip envinfo]
{
"private": true,
"main": "./app-entry.js",
"scripts": {
"dev": "expo start",
"prod": "expo start --no-dev"
},
"dependencies": {
"expo": "^31.0.2",
"react": "^16.7.0-alpha.2",
"react-cache": "^2.0.0-alpha.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-31-with-hooks-dangerzone.tar.gz"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"expo-cli": "^2.6.12"
}
}
Description
When trying to use Suspense on React Native, I am receiving a Not yet implemented issue, after the react-cache package has resolved the data.
Reproducible Demo
importReact,{useState,ConcurrentMode,Suspense}from"react";import{StyleSheet,SafeAreaView,Button,Text}from"react-native";import{unstable_createResourceascreateResource}from"react-cache";constmyPokemon=createResource(functionfetchPokemon(name){constpokemonQuery=` query ($name: String) { pokemon(name: $name) { id number name } } `;returnfetch("https://graphql-pokemon.now.sh",{method: "POST",headers: {"content-type": "application/json;charset=UTF-8"},body: JSON.stringify({query: pokemonQuery,variables: { name }})}).then(r=>r.json()).then(response=>response.data.pokemon);});functionPokemonInfo({ pokemonName }){constpokemon=myPokemon.read(pokemonName);console.log(pokemon);return<Text>{JSON.stringify(pokemon||"Unknown",null,2)}</Text>;}exportdefaultfunctionApp(){const[pokemonName,setPokemonName]=useState(null);const[search,setSearch]=useState(false);return(<SafeAreaViewstyle={styles.container}><Buttontitle="Get Pikachu"onPress={()=>setPokemonName("Pikachu")}/>{pokemonName ? (<Suspensefallback={<Text>loading...</Text>}><PokemonInfopokemonName={pokemonName}/></Suspense>) : null}</SafeAreaView>);}conststyles=StyleSheet.create({container: {backgroundColor: "#fff",flex: 1,margin: 20},textInput: {backgroundColor: "#eaeaea",borderColor: "#cccccc",borderWidth: 1,height: 40,padding: 10}});
Environment
[skip envinfo]
Description
When trying to use Suspense on React Native, I am receiving a
Not yet implementedissue, after thereact-cachepackage has resolved the data.Reproducible Demo