parent
c9129c6bf9
commit
d1ea797292
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
import { Dimensions, Animated } from 'react-native';
|
||||
|
||||
export const animation = new Animated.Value(0);
|
||||
|
||||
|
||||
export const startAnimation = () => {
|
||||
Animated.timing(animation, {
|
||||
toValue: 1,
|
||||
duration: 400,
|
||||
useNativeDriver: true,
|
||||
}).start();
|
||||
};
|
||||
|
||||
export const stopAnimation = () => {
|
||||
Animated.timing(animation, {
|
||||
toValue: 0,
|
||||
duration: 400,
|
||||
useNativeDriver: true,
|
||||
}).start();
|
||||
};
|
||||
|
||||
export const animatedStyles = {
|
||||
transform: [
|
||||
{
|
||||
translateY: animation.interpolate({
|
||||
inputRange: [0, 1],
|
||||
outputRange: [0, -Dimensions.get('window').height / 1.9]
|
||||
}),
|
||||
},
|
||||
],
|
||||
};
|
@ -0,0 +1,41 @@
|
||||
import React from 'react';
|
||||
import { Animated, StyleSheet, TextInput } from 'react-native';
|
||||
import { startAnimation, stopAnimation, animatedStyles } from '../assets/answerAnimation'
|
||||
|
||||
const KanjiAnswerField = () => {
|
||||
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'X-RapidAPI-Key': '19516a9900mshce10de76f99976bp10f192jsn8c8d82222baa',
|
||||
'X-RapidAPI-Host': 'kanjialive-api.p.rapidapi.com'
|
||||
}
|
||||
}
|
||||
|
||||
const [answer, onChangeText] = React.useState("");
|
||||
|
||||
return (
|
||||
<Animated.View style={[animatedStyles]}>
|
||||
<TextInput
|
||||
style={answerFieldStyle.input}
|
||||
onChangeText={onChangeText}
|
||||
value={answer}
|
||||
onFocus={startAnimation}
|
||||
onBlur={stopAnimation}
|
||||
/>
|
||||
</Animated.View>
|
||||
);
|
||||
};
|
||||
|
||||
const answerFieldStyle = StyleSheet.create({
|
||||
input: {
|
||||
height: 40,
|
||||
margin: 12,
|
||||
borderWidth: 1,
|
||||
padding: 10,
|
||||
width: 200,
|
||||
backgroundColor: "white"
|
||||
},
|
||||
})
|
||||
|
||||
export default KanjiAnswerField;
|
@ -0,0 +1,54 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Text, SectionList, View, StyleSheet } from 'react-native';
|
||||
|
||||
|
||||
const KanjiList = () => {
|
||||
|
||||
return (
|
||||
<View style={kanjiListStyle.container}>
|
||||
<SectionList sections={[
|
||||
{
|
||||
title: "N5",
|
||||
data: ["aa", "aaa"]
|
||||
},
|
||||
{
|
||||
title: "N4",
|
||||
data: ["b", "bbb"]
|
||||
}
|
||||
]}
|
||||
renderItem={
|
||||
({item}) => <Text style={kanjiListStyle.item}>{item}</Text>
|
||||
}
|
||||
renderSectionHeader={({ section }) => (
|
||||
<Text style={kanjiListStyle.sectionHeader}>{section.title}</Text>
|
||||
)}
|
||||
keyExtractor={item => `basicListEntry-${item}`}
|
||||
>
|
||||
</SectionList>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const kanjiListStyle = StyleSheet.create({
|
||||
container: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
padding: 10
|
||||
},
|
||||
sectionHeader: {
|
||||
paddingTop: 2,
|
||||
paddingLeft: 10,
|
||||
paddingRight: 10,
|
||||
paddingBottom: 2,
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold',
|
||||
backgroundColor: '#e6e6e6',
|
||||
},
|
||||
item: {
|
||||
padding: 10,
|
||||
fontSize: 18,
|
||||
height: 44,
|
||||
},
|
||||
})
|
||||
|
||||
export default KanjiList;
|
Loading…
Reference in new issue