Dev #4
|
@ -23,10 +23,7 @@
|
|||
"react-native": "^0.62.0",
|
||||
"react-native-ankidroid": "^0.4.0",
|
||||
"react-native-material-textfield": "^0.16.1",
|
||||
<<<<<<< HEAD
|
||||
"react-native-svg": "^12.0.3",
|
||||
=======
|
||||
>>>>>>> fixed
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-redux": "^7.2.0",
|
||||
"redux": "^4.0.5",
|
||||
|
|
|
@ -14,31 +14,6 @@ import {
|
|||
} from '../actions/anki-get-actions';
|
||||
|
||||
const StartScreen = props => {
|
||||
<<<<<<< HEAD
|
||||
useEffect(() => {
|
||||
props.getDeckList();
|
||||
props.getModelList();
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
props.checkAnkiLanModelForExisting(props.modelName, props.modelList);
|
||||
});
|
||||
return (
|
||||
<ScrollView
|
||||
keyboardShouldPersistTaps='handled'
|
||||
>
|
||||
|
||||
{props.ankiAvailable ? (
|
||||
props.ankiLanModelExists ? (
|
||||
<AddWordForm />
|
||||
) : (
|
||||
<AnkiTemplate />
|
||||
)
|
||||
) : (
|
||||
<Permissions />
|
||||
)}
|
||||
</ScrollView>
|
||||
);
|
||||
=======
|
||||
useEffect(() => {
|
||||
props.getDeckList();
|
||||
props.getModelList();
|
||||
|
@ -62,7 +37,6 @@ const StartScreen = props => {
|
|||
)}
|
||||
</ScrollView>
|
||||
);
|
||||
>>>>>>> fixed
|
||||
};
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -5,45 +5,6 @@ import {Form, Container, Item} from 'native-base';
|
|||
import {checkAnkiLanModelForExisting} from '../actions/anki-get-actions';
|
||||
import InputWord from './view/translatable-word';
|
||||
import SubmitButton from './view/submit-button';
|
||||
<<<<<<< HEAD
|
||||
import {wordInfo} from "../actions/api/dictionary";
|
||||
import FieldEditor from './view/field-editor';
|
||||
|
||||
const AnkiForm = props => {
|
||||
const [target, setTarget] = useState('')
|
||||
const [fields, setFields] = useState({})
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
useEffect(() => {
|
||||
// props.wordInfo('Urge');
|
||||
// props.wordInfo('Maze');
|
||||
// props.wordInfo('Ramification');
|
||||
// props.wordInfo('Dare');
|
||||
// props.wordInfo('Entrepreneurship');
|
||||
// props.wordInfo('meagre');
|
||||
// props.wordInfo('meager');
|
||||
|
||||
}, []);
|
||||
const getWord = (word) => {
|
||||
setTarget(word)
|
||||
};
|
||||
const submit = () => {
|
||||
props.wordInfo(target);
|
||||
setSubmitted(true)
|
||||
};
|
||||
|
||||
return (
|
||||
<Container style={{padding: 20}}>
|
||||
<Form >
|
||||
<DeckPicker />
|
||||
<InputWord word={getWord} onSubmit={submit}/>
|
||||
{submitted ?
|
||||
<FieldEditor label={'leble'} variants={['hell','sdflaksdf;aslkdfsd;lafhwepofh','sdfasdfh;dsofihpsfposdh','']}/>
|
||||
: <SubmitButton onSubmit={submit} />
|
||||
}
|
||||
</Form>
|
||||
</Container>
|
||||
);
|
||||
=======
|
||||
import {wordInfo} from '../actions/api/dictionary';
|
||||
import FieldEditor from './view/field-editor';
|
||||
|
||||
|
@ -87,7 +48,6 @@ const AnkiForm = props => {
|
|||
</Form>
|
||||
</Container>
|
||||
);
|
||||
>>>>>>> fixed
|
||||
};
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -1,123 +1,5 @@
|
|||
import React, {useState, useEffect, useRef} from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
<<<<<<< HEAD
|
||||
import {Text, Button, Picker} from 'native-base';
|
||||
import TextField from 'react-native-material-textfield/src/components/field';
|
||||
import {View} from 'native-base';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import {StyleSheet} from 'react-native';
|
||||
/* Props
|
||||
* defaultText
|
||||
* variants
|
||||
* label
|
||||
* */
|
||||
const FieldEditor = props => {
|
||||
const input = useRef();
|
||||
const [edit, toggleEdit] = useState(false);
|
||||
const [variants, setVariants] = useState([]);
|
||||
const [label, setLabel] = useState('');
|
||||
const [value, setValue] = useState(props.variants[0] || '');
|
||||
const [editableText, setEditableText] = useState(props.defaultText);
|
||||
useEffect(() => {
|
||||
setVariants(props.variants);
|
||||
setLabel(props.label);
|
||||
setEditableText(props.variants[0]);
|
||||
}, []);
|
||||
|
||||
const toggle = () => {
|
||||
toggleEdit(!edit);
|
||||
setTimeout(() => {
|
||||
if (input.current) {
|
||||
input.current.focus();
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
const selectValue = value => {
|
||||
console.log(value);
|
||||
alert(value);
|
||||
|
||||
setEditableText(value);
|
||||
setValue(value);
|
||||
};
|
||||
return (
|
||||
<View style={styles.wrap}>
|
||||
<Text style={styles.label}>{label}</Text>
|
||||
<View style={styles.pickerWrap}>
|
||||
<View style={styles.inner}>
|
||||
{edit ? (
|
||||
<TextField
|
||||
value={editableText}
|
||||
style={styles.textField}
|
||||
ref={input}
|
||||
multiline={true}
|
||||
/>
|
||||
) : (
|
||||
<Picker
|
||||
style={styles.picker}
|
||||
onValueChange={value => selectValue(value)}
|
||||
selectedValue={value}>
|
||||
{variants.map((variant, index) => (
|
||||
<Picker.Item
|
||||
label={variant}
|
||||
value={variant}
|
||||
key={index}
|
||||
id={index}
|
||||
/>
|
||||
))}
|
||||
</Picker>
|
||||
)}
|
||||
</View>
|
||||
<Button style={styles.button} onPress={toggle}>
|
||||
{edit ? (
|
||||
<Icon name="caret-down" size={20} color={'white'} />
|
||||
) : (
|
||||
<Icon name="pen" size={20} color={'white'} />
|
||||
)}
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
pickerWrap: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-around',
|
||||
},
|
||||
button: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
marginLeft: 10,
|
||||
width: '12%',
|
||||
},
|
||||
picker: {
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
marginLeft: 4,
|
||||
// backgroundColor: '#00000010',
|
||||
},
|
||||
wrap: {
|
||||
margin: 0,
|
||||
},
|
||||
textField: {
|
||||
paddingLeft: 12,
|
||||
},
|
||||
inner: {
|
||||
width: '85%',
|
||||
height: 65,
|
||||
},
|
||||
label: {
|
||||
paddingLeft: 10,
|
||||
marginBottom: -10,
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(state => ({}), null)(FieldEditor);
|
||||
=======
|
||||
|
||||
import TextField from 'react-native-material-textfield/src/components/field';
|
||||
import {StyleSheet} from 'react-native';
|
||||
import {View, Text, Button, Picker} from 'native-base';
|
||||
|
@ -247,4 +129,3 @@ const FieldEditor = props => {
|
|||
);
|
||||
};
|
||||
export default connect()(FieldEditor);
|
||||
>>>>>>> fixed
|
||||
|
|
Loading…
Reference in a new issue