我正在通过URL从我的服务器获得一个简介:
<Image
source={
profilePictureUrl !==
? {uri: API_URL + / + profilePictureUrl}
: PROFILE_DEFAULT
}
style={{width: 200, height: 200, borderRadius: 100}}
/>
在用户离线时,我如何能够在我的装置上挽救这一形象?
我正在通过URL从我的服务器获得一个简介:
<Image
source={
profilePictureUrl !==
? {uri: API_URL + / + profilePictureUrl}
: PROFILE_DEFAULT
}
style={{width: 200, height: 200, borderRadius: 100}}
/>
在用户离线时,我如何能够在我的装置上挽救这一形象?
您可使用prefetch图像部件方法,下载图像和储存,供日后使用。
电话:await 图像:prefetch(API_URL+/+profilePictureUrl);
,一俟用户在网上展示这种形象,如果你有照片。
that depends on the purpose of the usage of this image
do you want to cache it then you can go with FastImage
import FastImage from react-native-fast-image
const YourImage = () => (
<FastImage
style={{ width: 200, height: 200 }}
source={{
uri: https://unsplash.it/400/400?image=1 ,
priority: FastImage.priority.normal,
}}
resizeMode={FastImage.resizeMode.contain}
/>
)
but if you want to use it for offline purposes then you can go with the option of using @react-native-async-storage/async-storage
or any other storages that your
import AsyncStorage from @react-native-async-storage/async-storage ;
// Save the image to async storage
await AsyncStorage.setItem( profilePicture , uri);
Trying to get a restaurant name from Google Places API. First page displays the list of restaurants, and when user selects one, it passes place_id as an id value to a second page (that I m currently ...
I m trying to get my menu to show when I click the sidebar, but I m getting an error "react-dom.development.js:86 Warning: React does not recognize the handleClick prop on a DOM " import { ...
我曾尝试过,但我没有uck。
I d like to implement the equivalent to the javascript localStorage in my React Native app. But I m unsure how to set. To function how I want it to, I would like the localStorage to be stored every ...
I have a server where I store user images in base64 format. Im trying to fetch and render it, but I keep getting the same image. I understand that the problem is most likely in the particular work of ...
I am building a React Native Application using Expo and I want to integrate a 1:1 video calling functionality in the app. From what I have researched so far on the topic is that I can use SDKs of ...
I have installed the command line tools of android, correctly configured all environment variables. When I am creating a virtual device with this command: avdmanager create avd -n test -k "system-...
So I have been working on a react native application just like the meetups app. It has its own node.js backend which can be viewed here https://github.com/rahullakhaney/meetup/tree/master/meetup-...