Skip to content

Conversation

@inspmoore
Copy link

Added a feature, where by passing a prop called imageUrlAccessor you can customize the field name in the images array responsible for the image url.

Example:

const images = [ { image_uri: '...' }, { image_uri: '...' ), ... ] <ImageSlider images={images} imageUrlAccessor="image_uri" /> 

The prop defaults to "url" so this is not a breaking change.

Sorry for the screwed up linting. Couldn't get it to work exactly like yours config.

Copy link
Owner

@kimcoder kimcoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about map a images array?

images={this.images.map((item) => ({ url: item.uri }))} 
@inspmoore
Copy link
Author

I agree that this is how it's done usually, but it's a bit costly operation when you have a large images array. Especially when you run it on a low end android device. This simple feature allows to skip this step and is 100% backwards compatible with previous version.

@kimcoder
Copy link
Owner

Understood.
Unfortunatlely, Your PR has conflicted now. because I updated major version at yesterday.
( developed by typescript, add lint, prettier. )
Can you resolve this conflicts ?
Thanks

@inspmoore
Copy link
Author

Sure thing, will refactor the code for the new spec. Cool that the project is now on TS.

@kimcoder kimcoder closed this Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants