You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const startAnimation = () => {
setNum1(num1 + 1);
writer.animator.animateCharacter({
delayBetweenStrokes: 800,
strokeDuration: 600,
onComplete() {
console.log("Animation complete!");
},
});
};
// 开始书写汉字
const startWrite = () => {
if (quizActive) writer.quiz.stop();
else
writer.quiz.start({
/** Optional. Default: 1. This can be set to make stroke grading more or less lenient. Closer to 0 the more strictly strokes are graded.
*/
leniency: 1,
/** Optional. Default: 0. */
quizStartStrokeNum: 0,
/** Highlights correct stroke (uses <QuizMistakeHighlighter />) after incorrect attempts. Set to `false` to disable. */
showHintAfterMisses: 2,
onComplete({ totalMistakes }) {
console.log(`Quiz complete! You made a total of ${totalMistakes} mistakes`);
},
onCorrectStroke() {
console.log("onCorrectStroke");
},
onMistake(strokeData) {
console.log("onMistake", strokeData);
},
});
import React, { useEffect, useState } from "react";
import { SafeAreaView } from "react-native-safe-area-context";
import { Button, Text, View, ScrollView, TouchableOpacity } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { HanziWriter, useHanziWriter } from "@jamsch/react-native-hanzi-writer";
let num = 0;
let showOutline1 = true;
export default function ExamIndex(): React.JSX.Element {
const [showOutline, setShowOutline] = useState(true); //
const [num1, setNum1] = useState(1); //
const writer = useHanziWriter({ character: "好" });
const animatorState = writer.animator.useStore(s => s.state); //
const quizActive = writer.quiz.useStore(s => s.active); //
useEffect(() => {
console.log("animatorState :", animatorState);
}, [animatorState]);
const startAnimation = () => {
setNum1(num1 + 1);
writer.animator.animateCharacter({
delayBetweenStrokes: 800,
strokeDuration: 600,
onComplete() {
console.log("Animation complete!");
},
});
};
// 开始书写汉字
const startWrite = () => {
if (quizActive) writer.quiz.stop();
else
writer.quiz.start({
/** Optional. Default: 1. This can be set to make stroke grading more or less lenient. Closer to 0 the more strictly strokes are graded.
};
const showHideOutline = () => {
console.log("animatorState --:", animatorState, num, showOutline, new Date().valueOf());
};
return (
<SafeAreaView edges={["top"]}>
<GestureHandlerRootView style={{ flex: 1, backgroundColor: "#adf" }} key={num1}>
{/** Include all the HanziWriter.XXX components here /}
{/* Optional, grid lines to help draw the character */}
<HanziWriter.GridLines color="#ddd" />
);
}
The text was updated successfully, but these errors were encountered: