facebook / facebook/litho

FrescoImage cannot load animated gif image

Open
#767 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

- [x] I have searched [existing issues](https://github.com/facebook/litho/issues) and this is not a duplicate

## Version
The newest `develop` branch in litho repo.

## Issues and Steps to Reproduce
Paste the code below to `PlaygroundComponentSpec` and run the litho sample project.
Issue: the gif image is not animating as expected.

## Expected Behavior
The gif image can animated as it should be.

## Link to Code

```java
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.samples.litho.playground;

import android.graphics.Color;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.litho.Column;
import com.facebook.litho.Component;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.annotations.LayoutSpec;
import com.facebook.litho.annotations.OnCreateLayout;
import com.facebook.litho.fresco.FrescoImage;

@LayoutSpec
public class PlaygroundComponentSpec {

@OnCreateLayout
static Component onCreateLayout(ComponentContext c) {
final String url = "https://ops-1300522992.cos.ap-guangzhou.myqcloud.com/doc/YZ/images/index/%E5%B0%8F%E9%B9%85%E5%AF%BB%E5%AE%9D%E5%85%A5%E5%8F%A3.gif";
final DraweeController controller = Fresco.newDraweeControllerBuilder()
.setAutoPlayAnimations(true)
.setUri(url)
.build();
return Column.create(c)
.backgroundColor(Color.WHITE)
.child(FrescoImage.create(c)
.controller(controller)
.imageAspectRatio(2f))
.build();
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.