2

Using react native expo.

Once performing action in one of the pages, if the action is success, it will forward to another page that will only contain a view with an image, the image inside the url can change all the time(by another user regardless to the app). I had an issue that when image is being changed, the previous image is still in the cache so it is loading the previous image. the solution is to add "?xxx" at the end of the url and it will refresh to the current image all the time.

The problem now, is that it takes around 2-3 seconds for the image to load, and i cant have that. Is there a way to load the image from the url in a faster way?

Here is the code that shows the image in the final page:

return (
    <SafeAreaView style={[{ flex: 1 }]}>
      <View style={[{ height: "8%", backgroundColor: "#EE7629" }]}>
        <TouchableOpacity style={styles.backStyle} onPress={navToTakeCart}>
          <Text style={styles.backText}>Go Back</Text>
        </TouchableOpacity>
      </View>
      <View style={[{ height: "92%", backgroundColor: "#EE7629" }]}>
        <Image
          source={{
            uri:
              "https://click2lock.azurewebsites.net/Images/AdvertiseImg/Image" +
              compId +
              ".jpeg?1",
          }}
          style={{ width: "100%", height: "100%", resizeMode: "stretch" }}
        />
      </View>
    </SafeAreaView>
  );

Thank you

1 Answer 1

0

Same issue for me, I'm looking for a solution of this network related issue with expo, while searching I saw some post advicing to use FastImage, Also saw that there is an implementation for Expo, but had no sucess implementing it on my app.

Sign up to request clarification or add additional context in comments.

1 Comment

answer seems like a question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.