react-native-fast-image icon indicating copy to clipboard operation
react-native-fast-image copied to clipboard

Support for defaultSource

Open danielgindi opened this issue 6 years ago • 51 comments

Both iOS and Android. No support for URIs due to library limitations. It also does not make any sense. (As defaultSource should be available immediately, not for going to fetch from a remote location)

danielgindi avatar Aug 29 '19 12:08 danielgindi

Codecov Report

Merging #550 into master will decrease coverage by 11.97%. The diff coverage is 63.63%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #550       +/-   ##
===========================================
- Coverage   94.11%   82.14%   -11.98%     
===========================================
  Files           1        1               
  Lines          17       28       +11     
===========================================
+ Hits           16       23        +7     
- Misses          1        5        +4
Impacted Files Coverage Δ
src/index.js 82.14% <63.63%> (-11.98%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 56c8eff...8451cce. Read the comment docs.

codecov[bot] avatar Sep 06 '19 08:09 codecov[bot]

Codecov Report

Merging #550 (1cbcb8b) into main (a7a8643) will increase coverage by 0.57%. The diff coverage is 100.00%.

:exclamation: Current head 1cbcb8b differs from pull request most recent head 821ed0d. Consider uploading reports for the commit 821ed0d to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main     #550      +/-   ##
==========================================
+ Coverage   96.29%   96.87%   +0.57%     
==========================================
  Files           1        2       +1     
  Lines          27       32       +5     
  Branches        2        0       -2     
==========================================
+ Hits           26       31       +5     
  Misses          1        1              
Impacted Files Coverage Δ
src/index.js 96.42% <100.00%> (ø)
src/test_util/android_platform.js 100.00% <100.00%> (ø)
src/index.tsx

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4d8c749...821ed0d. Read the comment docs.

codecov[bot] avatar Sep 06 '19 08:09 codecov[bot]

Does this act as fallback image as well In case of error loading image ?

qalqi avatar Sep 18 '19 18:09 qalqi

Does this act as fallback image as well In case of error loading image ?

Yes

danielgindi avatar Sep 18 '19 19:09 danielgindi

Codecov fails on code specific to Android. Seems like the tests are not running on Android.

danielgindi avatar Sep 18 '19 19:09 danielgindi

@DylanVann This solves the one big issue with this library, would be helpful to review. Thanks 👍

danielgindi avatar Oct 07 '19 04:10 danielgindi

Hello! Thank you so much for this feature: it is very important also for me and my team, as well as for the overall project. Is it possible to fix or merge it in the master? @DylanVann

geroale avatar Oct 13 '19 20:10 geroale

Any news on this? Thanks.

itsam avatar Nov 18 '19 13:11 itsam

having defaultSource makes fastImage the best plugin :(

gvsakhil avatar Dec 12 '19 03:12 gvsakhil

I kind of really need this, any chance this can get merged/released in the near future? Would be really thankful!

ramonvermeulen avatar Jan 02 '20 09:01 ramonvermeulen

@DylanVann Any chance to get some attention here?

danielgindi avatar Feb 16 '20 08:02 danielgindi

I've added more tests to satisfy codecov. Hope it's silenced now.

danielgindi avatar Feb 16 '20 08:02 danielgindi

@danielgindi don't you think defaultSource should also support network images? I can easily see this as a way to load a thumbnail (small kb) while the full image is being downloaded

enahum avatar Feb 27 '20 01:02 enahum

@enahum Well theoretically you would be correct, but practically no.
If you have such a need - you are most probably doing something wrong:

  • In most cases, such a feature is used in order to have something visible immediately, which means you have to be able to load the image synchronously, and have the dimensions available upfront, and ideally the image should be in the exact dimensions for display to avoid a costly resize operation.

  • If you have the same default image for all images (most common case), then the image should just be local in your app.

  • If you generate the default on the fly (like letters avatar) - it's still local, in memory or cached on disk.

  • Some native libraries have an option to supply separate source for error image. In that case - you probably have a common error image to show for every error. This should be local in your app.

  • If you are showing an image in a list view - then you want it to load fast and be available immediately, for smooth scrolling and to avoid visual glitches.

Now if we care about conforming to the built-in RN Image - then the Image docs say the image should be local or a static image resource. https://reactnative.dev/docs/image.

danielgindi avatar Feb 27 '20 07:02 danielgindi

Can this be merged with the master, please? @danielgindi @DylanVann

marf avatar Apr 10 '20 15:04 marf

Is it possible to finally merge this into master? Thank you in advance @danielgindi @DylanVann

geroale avatar Apr 13 '20 17:04 geroale

defaultSource up!

SauloDesenvolvedor avatar Apr 17 '20 09:04 SauloDesenvolvedor

+1

julioxavierr avatar Apr 29 '20 14:04 julioxavierr

@DylanVann I've rebased on master to resolve conflicts. The CI has an issue that's not related to the code (fails on master too).

danielgindi avatar Apr 29 '20 17:04 danielgindi

@danielgindi Does it support v6.1.1? I can't upgrade RN to 0.60+ in a short time but would like to use defaultSource :(

tarouboy avatar May 28 '20 04:05 tarouboy

Any chance to merge this? @DylanVann @danielgindi Seems there was no any other issues in this branch?

neuneed avatar Jun 08 '20 06:06 neuneed

@neuneed Yes it had some work done on it, seems stable even after latest changes in master. But there's no response from @DylanVann. I also emailed him, but again not response.

danielgindi avatar Jun 08 '20 06:06 danielgindi

Hope this will be merged soon on the master @DylanVann Thank you!

marf avatar Jun 08 '20 08:06 marf

Waiting for this merge too

archansel avatar Jun 18 '20 11:06 archansel

Waiting for this

vineethvijayan avatar Jul 22 '20 11:07 vineethvijayan

eagerly waiting for the feature

varunkv2019 avatar Jul 22 '20 11:07 varunkv2019

@danielgindi could you rebase again, please 🙏

rpavlovs avatar Jul 31 '20 03:07 rpavlovs

Installing from this PR directly I get the following error from bundler:

error: Error: While trying to resolve module `react-native-fast-image` from file `.../TabNavigator.tsx`, the package `.../node_modules/react-native-fast-image/package.json` was successfully found. 
However, this package itself specifies a `main` module field that could not be resolved (`.../node_modules/react-native-fast-image/dist/index.js`. 
Indeed, none of these files exist:
  * .../node_modules/react-native-fast-image/dist/index.js(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
  * .../node_modules/react-native-fast-image/dist/index.js/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)

rpavlovs avatar Jul 31 '20 03:07 rpavlovs

@rpavlovs I've rebased. Please anyone test this as I haven't tested it with the latest master changes.

Also, @DylanVann I'm getting tired of this. Could you please take a look and merge? Every month you have breaking structural changes which make it difficult to rebase.

danielgindi avatar Aug 02 '20 07:08 danielgindi

I've published this as react-native-fast-image2, as the package is now structure in a way that it cannot be directly installed from git.

danielgindi avatar Sep 26 '20 19:09 danielgindi