Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- app.post
- supabase 페이지네이션
- 글또10기x코드트리
- 슬라이딩윈도우
- async
- set
- 안드로이드빌드에러
- 글또10기
- xlsx-js-style
- generic
- interface
- meatadata
- extends
- react
- 상속
- reactnative
- supabase auth
- Spring
- map
- 배열중복요소제거
- 타입스크립트
- Filter
- TS
- 페이지네이션
- Next.js
- array
- 스크롤이벤트
- javascript
- 이진탐색
- supabase authentication
Archives
- Today
- Total
rhanziy
React Native - useAnimatedRef scrollToOffset 사용하기(타입스크립트) 본문
그냥 flatList ref는 보통 이렇게 사용했을거다.
ref = useRef(null);
ref.current?.scrollToOffset({offset: 0, animated: true})
그런데 useAnimatedRef를 쓰면 ref.current에 scrollToOffset이 없다고 타입에러가 뜰것임.
const ref = useAnimatedRef<Animated.FlatList<any>>();
ref.current?.scrollToOffset({offset: 0, animated: true});
원래 쓰던대로 쓰는방법은 바로~ react-native-reanimated.d.ts 파일에 가서 수정해주면댐.
export interface FlatList<T> extends ReactNativeView<T> {}
-> export interface FlatList<T> extends ReactNativeFlatList<T> {}
어째 FlatList<T> 가 ReactNativeView<T> 타입을 확장받고있어서,, FlatList로 고쳐주면된다.
스택오버플로우에서 삽질함.
대신 pod install을 하게되면 다시 이전으로 돌아가므로,, Merge를 기다리며 그냥 코드한줄만 수정하고있따.
까먹을가봐 기록
'React Native' 카테고리의 다른 글
React Native - 안드로이드 애뮬레이터에서 localhost 접속(webview) (1) | 2024.05.02 |
---|---|
React Native - useDeferredValue로 추천 검색 리스트 노출하기(feat.debounce) (1) | 2024.04.25 |
React Native - input hidden 처럼 setValue하기(react-hook-form) (1) | 2023.12.01 |
React Native - react hook form의 onsubmit에 파라미터로 입력값 넘기기!!! (1) | 2023.12.01 |
React Native - 아래로 끌어내려서 새로고침 RefreshControl (1) | 2023.11.23 |
Comments