Correcting dependencies
continuous-integration/drone/push Build was killed Details

master
Arthur VALIN 2 years ago
parent 8327ed64b7
commit 5b92ecf2fd

Binary file not shown.

@ -2,15 +2,15 @@
"ExpandedNodes": [ "ExpandedNodes": [
"", "",
"\\src", "\\src",
"\\src\\assets",
"\\src\\components",
"\\src\\navigation", "\\src\\navigation",
"\\src\\pages",
"\\src\\redux", "\\src\\redux",
"\\src\\redux\\actions", "\\src\\redux\\actions",
"\\src\\redux\\reducers", "\\src\\redux\\reducers",
"\\src\\redux\\thunks", "\\src\\redux\\thunks",
"\\src\\storage" "\\src\\storage",
"\\src\\test"
], ],
"SelectedNode": "\\src\\navigation\\TabBar.tsx", "SelectedNode": "\\src\\components\\KanjiListCell.tsx",
"PreviewInSolutionExplorer": false "PreviewInSolutionExplorer": false
} }

Binary file not shown.

@ -2,5 +2,6 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component> </component>
</project> </project>

@ -1,163 +0,0 @@
import Slider from '@react-native-community/slider';
import React, { useEffect, useRef, useState } from 'react';
import { Button, StyleSheet, TouchableOpacity, useColorScheme, View } from 'react-native';
import { SvgXml } from 'react-native-svg';
import { SketchCanvas, SketchCanvasRef } from 'rn-perfect-sketch-canvas';
import { useSelector } from 'react-redux';
import { Kanji } from '../model/kanji';
import { KanjiMapper } from '../model/kanjiMapper';
import { Eye, EyeOff } from "react-native-feather";
import { learnihonColors } from '../assets/colors';
const DrawingCanva = () => {
const style = useColorScheme() == 'light' ? style_light : style_dark;
const canvasRef = useRef<SketchCanvasRef>(null);
const [strokeWidth, setStroke] = useState(5);
const [isCanvasReady, setIsCanvasReady] = useState(false);
const [imgXml, setImgXml] = useState('<svg></svg>');
const selectedKanji = KanjiMapper.SerializedObjectToKanji(useSelector(state => state.kanjiReducer.selectedKanji));
const [isVisible, setIsVisible] = useState(true);
useEffect(() => {
fetchXml();
if (canvasRef.current) {
setIsCanvasReady(true);
}
}, [canvasRef.current, selectedKanji]);
const fetchXml = async () => {
if (selectedKanji instanceof Kanji) {
const xml = await (await fetch(selectedKanji.image)).text();
setImgXml(xml);
}
}
return (
<View style={style.container}>
<TouchableOpacity style={style.visibility} onPress={() => setIsVisible(!isVisible)}>
{isVisible ? (<Eye stroke={style.svg.color} opacity={0.5} />) :
(<EyeOff stroke={style.svg.color} opacity={0.5} />)}
</TouchableOpacity>
{selectedKanji && isVisible && (
<SvgXml
xml={imgXml
.replace(/fill="#[0-9a-f]{6}"/g, `fill=${style.svg.color}`)}
width="75%"
height="75%"
opacity={0.1}
style={style.back}
/>)}
<SketchCanvas
ref={canvasRef}
strokeColor={style.canvas.strokeColor}
strokeWidth={strokeWidth}
containerStyle={style.canvas}
/>
<Slider
style={style.slider}
onValueChange={(val) => setStroke(val)}
minimumValue={5}
maximumValue={15}
minimumTrackTintColor={learnihonColors.main}
/>
{isCanvasReady && (<View style={style.menu}>
<Button color={learnihonColors.main} onPress={() => {
canvasRef.current?.reset();
setStroke(strokeWidth);
}} title="Reset" />
<Button color={learnihonColors.main}
onPress={() => {
canvasRef.current?.undo();
setStroke(strokeWidth);
}} title="Undo" />
</View>)}
</View>
);
};
const style_light = StyleSheet.create({
svg: {
color: "black"
},
container: {
flex: 1,
width: "100%",
},
back: {
alignSelf: "center",
width: "75%",
height: "75%",
position: "absolute"
},
canvas: {
alignSelf: "center",
height: "75%",
width: "75%",
borderWidth: 2,
borderColor: "black",
strokeColor: "black"
},
menu: {
flexDirection: "row",
justifyContent: "space-evenly",
},
slider: {
width: "75%",
alignSelf: "center",
},
visibility: {
position: "absolute",
right: 50,
top: -25
}
});
const style_dark = StyleSheet.create({
svg: {
color: "white"
},
container: {
flex: 1,
width: "100%",
},
back: {
alignSelf: "center",
width: "75%",
height: "75%",
position: "absolute"
},
canvas: {
alignSelf: "center",
height: "75%",
width: "75%",
borderWidth: 2,
borderColor: "white",
strokeColor: "white"
},
menu: {
flexDirection: "row",
justifyContent: "space-evenly",
},
slider: {
width: "75%",
alignSelf: "center",
},
visibility: {
position: "absolute",
right: 50,
top: -25
}
});
export default DrawingCanva;

42712
src/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -9,7 +9,6 @@
"web": "expo start --web", "web": "expo start --web",
"test": "jest --coverage=true --coverageDirectory=./test/coverage" "test": "jest --coverage=true --coverageDirectory=./test/coverage"
}, },
"jest": { "jest": {
"preset": "jest-expo", "preset": "jest-expo",
"verbose": true, "verbose": true,
@ -18,7 +17,8 @@
], ],
"testMatch": [ "testMatch": [
"**.test.js", "**.test.js",
"**.test.ts" "**.test.ts",
"**.test.tsx"
], ],
"testEnvironment": "node", "testEnvironment": "node",
"testEnvironmentOptions": { "testEnvironmentOptions": {
@ -29,7 +29,6 @@
] ]
} }
}, },
"dependencies": { "dependencies": {
"@benjeau/react-native-draw": "^0.8.3", "@benjeau/react-native-draw": "^0.8.3",
"@jest/globals": "^29.5.0", "@jest/globals": "^29.5.0",
@ -40,15 +39,15 @@
"@react-navigation/stack": "^6.3.12", "@react-navigation/stack": "^6.3.12",
"@reduxjs/toolkit": "^1.9.2", "@reduxjs/toolkit": "^1.9.2",
"@shopify/react-native-skia": "0.1.157", "@shopify/react-native-skia": "0.1.157",
"@testing-library/jest-native": "^5.4.2",
"@testing-library/react-native": "^12.0.1",
"@types/jest": "^29.5.0", "@types/jest": "^29.5.0",
"expo": "~47.0.12", "expo": "~47.0.12",
"expo-2d-context": "^0.0.3", "expo-2d-context": "^0.0.3",
"expo-av": "~13.0.2", "expo-av": "~13.0.2",
"expo-cli": "^6.3.0", "expo-cli": "^6.3.0",
"expo-status-bar": "~1.4.2", "expo-status-bar": "~1.4.2",
"jest": "^26.6.3", "react": "^18.1.0",
"jest-expo": "^48.0.2",
"react": "18.1.0",
"react-dom": "18.1.0", "react-dom": "18.1.0",
"react-native": "0.70.5", "react-native": "0.70.5",
"react-native-canvas": "^0.1.38", "react-native-canvas": "^0.1.38",
@ -67,6 +66,10 @@
"@types/react-native": "~0.70.6", "@types/react-native": "~0.70.6",
"@types/react-native-canvas": "^0.1.9", "@types/react-native-canvas": "^0.1.9",
"@types/react-native-video": "^5.0.14", "@types/react-native-video": "^5.0.14",
"jest": "^29.5.0",
"jest-expo": "~47.0.1",
"react-test-renderer": "18.1.0",
"ts-jest": "^29.0.5",
"typescript": "^4.6.3" "typescript": "^4.6.3"
}, },
"private": true "private": true

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import DrawingCanva from '../components/DrawingCanva'; import DrawingCanvas from '../components/DrawingCanvas';
import KanjiPlaygroundList from '../components/KanjiPlaygroundList'; import KanjiPlaygroundList from '../components/KanjiPlaygroundList';
import LearnihonPage from './LearnihonPage'; import LearnihonPage from './LearnihonPage';
@ -8,7 +8,7 @@ const Playground = () => {
return ( return (
<LearnihonPage> <LearnihonPage>
<KanjiPlaygroundList/> <KanjiPlaygroundList/>
<DrawingCanva/> <DrawingCanvas/>
</LearnihonPage> </LearnihonPage>
); );
}; };

@ -1,4 +1,4 @@
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'; import { configureStore } from '@reduxjs/toolkit';
import { SET_KANJIS, SET_PLAYGROUND_LIST, SET_SELECTED_KANJI } from './constants'; import { SET_KANJIS, SET_PLAYGROUND_LIST, SET_SELECTED_KANJI } from './constants';
import kanjiReducer from './reducers/kanjiReducer'; import kanjiReducer from './reducers/kanjiReducer';

Loading…
Cancel
Save