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

fix(android): return size after loading gif #3001

Merged
merged 17 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ protected void handleGetImageSuccess() {
imageSize.pushInt("width", bitmap.getWidth());
imageSize.pushInt("height", bitmap.getHeight());
map.pushMap("image", imageSize);
} else if (mSourceDrawable instanceof HippyDrawable) {
zoomchan-cxj marked this conversation as resolved.
Show resolved Hide resolved
HippyDrawable hippyTarget = (HippyDrawable) mSourceDrawable;
HippyMap imageSize = new HippyMap();
imageSize.pushInt("width", hippyTarget.getWidth());
imageSize.pushInt("height", hippyTarget.getHeight());
map.pushMap("image", imageSize);
}
}
getOnLoadEndEvent().send(this, map);
Expand Down
7 changes: 5 additions & 2 deletions examples/hippy-react-demo/src/components/Image/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ export default function ImageExpo() {
resizeMode={Image.resizeMode.cover}
defaultSource={defaultSource}
source={{ uri: 'https://user-images.githubusercontent.com/12878546/148736255-7193f89e-9caf-49c0-86b0-548209506bd6.gif' }}
onLoadEnd={() => {
console.log('gif onLoadEnd');
onLoadEnd={(result) => {
console.log(`gif onLoadEnd success: ${result.success}`);
if (result.success === 1) {
console.log(`gif size: ${result.image.width} * ${result.image.height}`);
}
}}
/>
</ScrollView>
Expand Down