@@ -5,14 +5,15 @@ import { Gap12 } from '@components/Gap'
55import RoundedIcon from '@components/RoundedIcon'
66import Search from '@components/Search'
77import { SettGroup , SettOption , SettText , SettWrapper } from '@components/Settings'
8+ import SingleSkeleton from '@components/SingleSkeleton'
89import { useIsFocused } from '@react-navigation/native'
910import { Colors } from '@utils/colors'
1011import { ls , secureLs , type StorageKeys } from '@utils/storage'
1112import type { NavProp } from '@utils/types'
12- import { screenDelay } from '@utils/utils'
13+ import { delayedFadeAnimationSearch , screenDelay } from '@utils/utils'
1314import React , { useEffect } from 'react'
14- import { ActivityIndicator , View } from 'react-native'
15- import Animated , { FadeIn } from 'react-native-reanimated'
15+ import { View } from 'react-native'
16+ import Animated from 'react-native-reanimated'
1617
1718export default function MMKVDataList ( { navigation } : NavProp ) {
1819 const state = useIsFocused ( )
@@ -21,7 +22,7 @@ export default function MMKVDataList({ navigation }: NavProp) {
2122 const [ searchResults , setSearchResults ] = React . useState < string [ ] > ( [ ] )
2223
2324 useEffect ( ( ) => {
24- if ( state ) screenDelay ( ( ) => setInitStorage ( [ ...ls . getAllKeys ( ) , ...secureLs . getAllKeys ( ) ] ) )
25+ if ( state ) screenDelay ( ( ) => setInitStorage ( [ ...ls . getAllKeys ( ) , ...secureLs . getAllKeys ( ) ] ) , 700 )
2526 // setInitStorage([])
2627 } , [ state ] )
2728
@@ -61,7 +62,7 @@ export default function MMKVDataList({ navigation }: NavProp) {
6162
6263 < SettGroup title = 'Stored keys' className = 'pb-4' >
6364 { searchResults ?. map ( ( item , i ) => (
64- < Animated . View key = { item } entering = { delayedFadeAnimation ( search , i ) } >
65+ < Animated . View key = { item } entering = { delayedFadeAnimationSearch ( search , i ) } >
6566 < SettOption
6667 title = { item }
6768 arrow
@@ -81,9 +82,7 @@ export default function MMKVDataList({ navigation }: NavProp) {
8182 />
8283 </ >
8384 ) }
84- { initStorage === null && (
85- < ActivityIndicator size = 'large' color = { Colors . accent } style = { { marginTop : 30 , marginBottom : 30 } } />
86- ) }
85+ { initStorage === null && < SingleSkeleton n = { 18 } /> }
8786 { searchResults . length === 0 && (
8887 < SettText className = 'mt-2 pl-6' > No data found. Try searching with another keyword.</ SettText >
8988 ) }
@@ -104,7 +103,3 @@ export default function MMKVDataList({ navigation }: NavProp) {
104103 </ >
105104 )
106105}
107-
108- function delayedFadeAnimation ( search : string , i : number ) {
109- return FadeIn . duration ( 250 ) . delay ( search . trim ( ) . length === 0 ? Math . min ( ( i + 1 ) * 25 , 500 ) : 20 )
110- }
0 commit comments