Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use this with react-native-image-progress #6

Open
isAlmogK opened this issue Sep 5, 2017 · 5 comments
Open

Use this with react-native-image-progress #6

isAlmogK opened this issue Sep 5, 2017 · 5 comments

Comments

@isAlmogK
Copy link

isAlmogK commented Sep 5, 2017

Is it possible to use this or add support with the following package, so there is a progress loader - https://github.com/oblador/react-native-image-progress

@vivaxy
Copy link
Owner

vivaxy commented Sep 5, 2017

Thanks for your suggestion.

The AutoHeightImage is not aware of the image size in the first place. How can I know the progress image size? If I display a progress image with a default height, then after image loaded, the content will layout again, that would be inappropriate.

Any thoughts?

@isAlmogK
Copy link
Author

isAlmogK commented Sep 5, 2017

I would say it just centers it, using flexbox this it doesn't need to know the height

@vivaxy
Copy link
Owner

vivaxy commented Sep 5, 2017

Currently theAutoHeightImage is used in a scrollView, and it is initialized with height = 0, so the center is making no sense.
If you are using a flexbox, then what is the flexbox height?

@isAlmogK
Copy link
Author

@vivaxy what about just having a preloader until the image of loads regardless of the height?

@vivaxy
Copy link
Owner

vivaxy commented Sep 18, 2017

@AlmogRnD It's a good idea to add a renderIndicator prop.

const renderIndicator = (progress, indeterminate) => {
     
};
// ...
<AutoHeightImage {...props} renderIndicator={renderIndicator} />

Implement as follows:

class AutoHeightImage extents Component {
    // ...
    render() {
        if (this.isLoading) {
            return renderIndicator(progress, indeterminate);
        } else {
            return <Image {...props} />;
        }
    }
}

PR is welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants