diff --git a/.vs/LEARNIHON/FileContentIndex/d19c12f8-0243-4b00-868f-72f597eb5b04.vsidx b/.vs/LEARNIHON/FileContentIndex/d19c12f8-0243-4b00-868f-72f597eb5b04.vsidx
deleted file mode 100644
index 6674bf8..0000000
Binary files a/.vs/LEARNIHON/FileContentIndex/d19c12f8-0243-4b00-868f-72f597eb5b04.vsidx and /dev/null differ
diff --git a/components/KanjiCard.tsx b/components/KanjiCard.tsx
index 7f1f6a9..2eefe90 100644
--- a/components/KanjiCard.tsx
+++ b/components/KanjiCard.tsx
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
-import { Button, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, Text, useColorScheme, View } from 'react-native';
+import { ActivityIndicator, Button, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, Text, useColorScheme, View } from 'react-native';
import { SvgXml } from 'react-native-svg';
import { useSelector } from 'react-redux';
import { learnihonColors } from '../assets/colors';
@@ -19,7 +19,7 @@ const KanjiCard = () => {
fontSize: "20em"
}
})
-
+ const [loadingSvg, setLoadingSvg] = useState(false);
const [selectedItems, setSelectedItems] = useState<{ title: string, data: Kanji[] }[]>([]);
const updateSelectedItems = (item: string, isSelected: Boolean) => {
if (!isSelected) {
@@ -51,8 +51,10 @@ const KanjiCard = () => {
const fetchXml = async () => {
if (kanji) {
+ setLoadingSvg(true);
const xml = await (await fetch(kanji?.image!)).text();
setImgXml(xml);
+ setLoadingSvg(false);
}
}
@@ -95,12 +97,18 @@ const KanjiCard = () => {
{kanji?.onyomi}
{kanji?.kunyomi}
-
+
+
+ )
+ : (
+ />)}
{!hasAnswered && (
<>
@@ -132,6 +140,12 @@ const kanjiCardStyle_light = StyleSheet.create({
width: "100%",
height: "100%"
},
+ loader: {
+ justifyContent: 'center',
+ alignItems: 'center',
+ width: 200,
+ height: 200
+ },
text: {
color: "black"
}
@@ -148,6 +162,12 @@ const kanjiCardStyle_dark = StyleSheet.create({
width: "100%",
height: "100%"
},
+ loader: {
+ justifyContent: 'center',
+ alignItems: 'center',
+ width: 200,
+ height: 200
+ },
text: {
color: "white"
}
diff --git a/components/KanjiPlaygroundList.tsx b/components/KanjiPlaygroundList.tsx
index 4c7c684..3ba3552 100644
--- a/components/KanjiPlaygroundList.tsx
+++ b/components/KanjiPlaygroundList.tsx
@@ -1,5 +1,5 @@
-import React, { useEffect } from 'react';
-import { FlatList, StyleSheet, Text, TextInput, TouchableOpacity, useColorScheme, View } from 'react-native';
+import React, { useEffect, useState } from 'react';
+import { ActivityIndicator, FlatList, StyleSheet, Text, TextInput, TouchableOpacity, useColorScheme, View } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { learnihonColors } from '../assets/colors';
import { Kanji } from '../model/kanji';
@@ -14,7 +14,7 @@ const KanjiPlaygroundList = () => {
const kanjiPlaygroundListStyle = useColorScheme() == 'light' ? kanjiPlaygroundListStyle_light : kanjiPlaygroundListStyle_dark;
const [search, setSearch] = React.useState("");
-
+ const [loadingList, setLoadingList] = useState(false);
const searchResult: Kanji[] = useSelector(state => state.kanjiReducer.playgroundList);
const dispatch = useDispatch();
@@ -29,20 +29,28 @@ const KanjiPlaygroundList = () => {
placeholderTextColor="gray"
value={search}
onChangeText={setSearch}
- onBlur={async () => await (await searchKanjis(search.toLowerCase()))(dispatch)}
+ onBlur={async () => {
+ setLoadingList(true);
+ await (await searchKanjis(search.toLowerCase()))(dispatch);
+ setLoadingList(false);
+ }}
>
- (
- { dispatch(setSelectedKanji(item))}} style={kanjiPlaygroundListStyle.entry}>
- {item.character}
-
- )
- }
- keyExtractor={item => `basicListEntry-${item.character}`}>
-
+ {loadingList ? (
+
+ ) : (
+ (
+ { dispatch(setSelectedKanji(item)) }} style={kanjiPlaygroundListStyle.entry}>
+ {item.character}
+
+ )
+ }
+ keyExtractor={item => `basicListEntry-${item.character}`}>
+
+ )}
);
};
diff --git a/package.json b/package.json
index dd187e4..4d9608f 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"@shopify/react-native-skia": "0.1.157",
"expo": "~47.0.12",
"expo-2d-context": "^0.0.3",
+ "expo-av": "~13.0.2",
"expo-cli": "^6.3.0",
"expo-status-bar": "~1.4.2",
"react": "18.1.0",
@@ -31,8 +32,7 @@
"react-native-web": "~0.18.9",
"react-redux": "^8.0.5",
"redux": "^4.2.1",
- "rn-perfect-sketch-canvas": "^0.3.0",
- "expo-av": "~13.0.2"
+ "rn-perfect-sketch-canvas": "^0.3.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",