728x90
React Native는 webp를 지원하지만 , 애니메이션이 있는 webp는 지원하지 않는다.
라이브러리의 힘을 빌리자.
1. react-native-webp-format 설치
Add the following dependencies to android/app/build.gradle:
dependencies {
...
implementation 'com.facebook.fresco:webpsupport:2.5.0'
// Optionally, to display animated WebP images, you have to add:
implementation 'com.facebook.fresco:animated-webp:2.5.0'
...
}
3. iOS 추가 설정
- 라이브러리에 설명되어 있지 않다. 추가로 설정해주자!
Go to your ios -> [App name folder] -> Edit AppDelegate.m
#import "SDImageCodersManager.h"
#import <SDWebImageWebPCoder/SDImageWebPCoder.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// . . .
[SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];
// . . .
}
4. 결과
잘 띄워진다 유후!
'Solve Problem > React Native' 카테고리의 다른 글
React Native에서 설정된 언어를 Next.js에 전달하기 (0) | 2023.08.01 |
---|---|
[React Native] 기기에 맞게 폰트 사이즈 대응하는 방법! (0) | 2023.07.20 |
[React Native] react native typescript 환경에서 env 파일 사용하기 (0) | 2023.07.16 |
[React Native] Dimension height 뿌시기 (안드로이드) (0) | 2023.07.08 |
[React Native] 채팅화면을 구성하는 2가지 방법 (FlatList) (2) | 2023.03.27 |