@nakamura-123/pages 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/Article/ArticleContentView.d.ts +5 -1
- package/dist/component/Article/ArticleContentView.js +208 -34
- package/dist/component/Article/ArticleImage.d.ts +9 -0
- package/dist/component/Article/ArticleImage.js +46 -0
- package/dist/component/Article/ArticleSectionPager.d.ts +17 -0
- package/dist/component/Article/ArticleSectionPager.js +193 -0
- package/dist/component/Article/ArticleTable.d.ts +10 -0
- package/dist/component/Article/ArticleTable.js +74 -0
- package/dist/component/Article/ChipStrip.d.ts +10 -0
- package/dist/component/Article/ChipStrip.js +82 -0
- package/dist/component/Article/Cloze.d.ts +31 -0
- package/dist/component/Article/Cloze.js +338 -0
- package/dist/component/Article/FramesFigure.d.ts +27 -0
- package/dist/component/Article/FramesFigure.js +438 -0
- package/dist/component/Article/RefLink.d.ts +42 -0
- package/dist/component/Article/RefLink.js +184 -0
- package/dist/component/Rating/RatingBar.d.ts +9 -0
- package/dist/component/Rating/RatingBar.js +358 -0
- package/dist/component/Rating/keyboardScroll.d.ts +7 -0
- package/dist/component/Rating/keyboardScroll.js +37 -0
- package/dist/component/Result/QuizFlatList.js +9 -9
- package/dist/component/Result/ResultActions.js +151 -58
- package/dist/component/Result/ResultHero.js +19 -18
- package/dist/component/SettingBtns/LanguageModal.js +1 -0
- package/dist/functions/articleContentFnc.d.ts +49 -1
- package/dist/functions/articleContentFnc.js +191 -2
- package/dist/functions/ratingFnc.d.ts +4 -0
- package/dist/functions/ratingFnc.js +30 -0
- package/dist/hooks/resultHook.d.ts +2 -1
- package/dist/hooks/resultHook.js +13 -1
- package/dist/page/ArticleDetail.js +58 -15
- package/dist/page/ImgZoom.d.ts +4 -3
- package/dist/page/ImgZoom.js +16 -2
- package/dist/page/QuizPage.js +23 -11
- package/dist/page/ReportPage.js +3 -2
- package/dist/quiz/QuizContentsDrill.js +26 -16
- package/dist/quiz/common/MyTextqqyy.d.ts +4 -0
- package/dist/quiz/common/MyTextqqyy.js +14 -4
- package/dist/quiz/explain/ExplainLogic.d.ts +1 -0
- package/dist/quiz/explain/ExplainLogic.js +3 -2
- package/dist/quiz/explain/NormalExplain.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const react_1 = __importStar(require("react"));
|
|
36
|
+
const react_native_1 = require("react-native");
|
|
37
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
38
|
+
const react_redux_1 = require("react-redux");
|
|
39
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
40
|
+
const common_1 = require("@nakamura-123/common");
|
|
41
|
+
const stores_1 = require("@nakamura-123/stores");
|
|
42
|
+
const ratingFnc_1 = require("../../functions/ratingFnc");
|
|
43
|
+
const keyboardScroll_1 = require("./keyboardScroll");
|
|
44
|
+
const REASONS = [
|
|
45
|
+
{ key: "unclear", label: "article.ratingReasonUnclear" },
|
|
46
|
+
{ key: "wrong", label: "article.ratingReasonWrong" },
|
|
47
|
+
];
|
|
48
|
+
// Firebaseのルールと同じ上限
|
|
49
|
+
const COMMENT_MAX = 200;
|
|
50
|
+
// 送れなかった評価の送り直しは、起動してから最初に評価の欄を出したときに1回だけ行う
|
|
51
|
+
let resentThisLaunch = false;
|
|
52
|
+
// 解説・LESSONの終わりの評価(Good・Bad)。押せば送信は終わり(10/24、本人)。
|
|
53
|
+
// Badの後に理由の札(いくつでも)と書く欄を1つの枠で開く。札は押すたびに送り、文は「送る」で送る(11/07、本人)。
|
|
54
|
+
// アプリの設定に rating を書いたアプリだけに出す
|
|
55
|
+
const RatingBar = ({ target, ver, kind, onReport }) => {
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
const { t } = (0, common_1.useDrillTranslation)();
|
|
58
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
59
|
+
const store = (0, react_redux_1.useStore)();
|
|
60
|
+
const enabled = (0, react_redux_1.useSelector)((state) => !!state.app.appSetting.setting.rating);
|
|
61
|
+
const appKey = (0, react_redux_1.useSelector)((state) => { var _a; return (_a = state.app.appSetting.quizName) === null || _a === void 0 ? void 0 : _a.appKey; });
|
|
62
|
+
const deviceId = (0, react_redux_1.useSelector)((state) => state.setting.rating.deviceId);
|
|
63
|
+
const mine = (0, react_redux_1.useSelector)((state) => state.setting.rating.votes[target]);
|
|
64
|
+
const current = mine && mine.ver === ver ? mine : null;
|
|
65
|
+
const [draft, setDraft] = (0, react_1.useState)((_a = current === null || current === void 0 ? void 0 : current.comment) !== null && _a !== void 0 ? _a : "");
|
|
66
|
+
const scrollToInput = (0, react_1.useContext)(keyboardScroll_1.KeyboardScrollContext);
|
|
67
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
68
|
+
// Androidでキーボードが出ている間だけ、欄の下に足す空き(keyboardScroll)。ページの終わりでもキーボードの上まで送れるように
|
|
69
|
+
const [keyboardSpace, setKeyboardSpace] = (0, react_1.useState)(0);
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (react_native_1.Platform.OS !== "android")
|
|
72
|
+
return;
|
|
73
|
+
const sub = react_native_1.Keyboard.addListener("keyboardDidHide", () => setKeyboardSpace(0));
|
|
74
|
+
return () => sub.remove();
|
|
75
|
+
}, []);
|
|
76
|
+
// 問題が変わっても同じ所に描かれるので、書きかけの文を次の問題へ持ち越さない
|
|
77
|
+
(0, react_1.useEffect)(() => { var _a; return setDraft((_a = current === null || current === void 0 ? void 0 : current.comment) !== null && _a !== void 0 ? _a : ""); }, [target, ver]);
|
|
78
|
+
const send = (to, vote, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
if (!appKey)
|
|
80
|
+
return;
|
|
81
|
+
if (!(yield stores_1.ratingApi.putRating(appKey, to, id, vote)))
|
|
82
|
+
return;
|
|
83
|
+
dispatch({
|
|
84
|
+
type: "setting/ratingSent",
|
|
85
|
+
payload: { target: to, at: vote.at },
|
|
86
|
+
});
|
|
87
|
+
dispatch(stores_1.settingStorage.saveSetting());
|
|
88
|
+
});
|
|
89
|
+
(0, react_1.useEffect)(() => {
|
|
90
|
+
if (!enabled || !deviceId || resentThisLaunch)
|
|
91
|
+
return;
|
|
92
|
+
resentThisLaunch = true;
|
|
93
|
+
Object.entries(store.getState().setting.rating.votes)
|
|
94
|
+
.filter(([, vote]) => !vote.sent)
|
|
95
|
+
.forEach(([to, vote]) => send(to, vote, deviceId));
|
|
96
|
+
}, [enabled, deviceId]);
|
|
97
|
+
if (!enabled || !appKey)
|
|
98
|
+
return null;
|
|
99
|
+
const record = (vote, extra = {}) => {
|
|
100
|
+
let id = deviceId;
|
|
101
|
+
if (!id) {
|
|
102
|
+
id = (0, ratingFnc_1.makeDeviceId)();
|
|
103
|
+
dispatch({ type: "setting/setRatingDeviceId", payload: id });
|
|
104
|
+
}
|
|
105
|
+
const next = Object.assign(Object.assign({ vote }, extra), { ver, at: Date.now() });
|
|
106
|
+
dispatch({
|
|
107
|
+
type: "setting/setRatingVote",
|
|
108
|
+
payload: { target, vote: next },
|
|
109
|
+
});
|
|
110
|
+
dispatch(stores_1.settingStorage.saveSetting());
|
|
111
|
+
send(target, Object.assign(Object.assign({}, next), { sent: false }), id);
|
|
112
|
+
};
|
|
113
|
+
// 同じボタンをもう一度押すと取り消す。Good・Badを入れ替えたら理由と文は捨てる
|
|
114
|
+
const onVote = (vote) => {
|
|
115
|
+
if ((current === null || current === void 0 ? void 0 : current.vote) === vote) {
|
|
116
|
+
record(null);
|
|
117
|
+
setDraft("");
|
|
118
|
+
}
|
|
119
|
+
else
|
|
120
|
+
record(vote);
|
|
121
|
+
};
|
|
122
|
+
const reasons = (_b = current === null || current === void 0 ? void 0 : current.reasons) !== null && _b !== void 0 ? _b : [];
|
|
123
|
+
const onReason = (reason) => record("down", {
|
|
124
|
+
reasons: reasons.includes(reason)
|
|
125
|
+
? reasons.filter((r) => r !== reason)
|
|
126
|
+
: [...reasons, reason],
|
|
127
|
+
comment: current === null || current === void 0 ? void 0 : current.comment,
|
|
128
|
+
});
|
|
129
|
+
// Androidでは、キーボードが出たら欄の下に空きを足し、欄がキーボードの上に来るまでスクロールする
|
|
130
|
+
const onFocus = () => {
|
|
131
|
+
if (react_native_1.Platform.OS !== "android" || !scrollToInput)
|
|
132
|
+
return;
|
|
133
|
+
const open = (height) => {
|
|
134
|
+
setKeyboardSpace(height);
|
|
135
|
+
// 空きを足した後の並びで測る
|
|
136
|
+
setTimeout(() => inputRef.current && scrollToInput(inputRef.current), 100);
|
|
137
|
+
};
|
|
138
|
+
const metrics = react_native_1.Keyboard.metrics();
|
|
139
|
+
if (react_native_1.Keyboard.isVisible() && metrics)
|
|
140
|
+
return open(metrics.height);
|
|
141
|
+
const sub = react_native_1.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
142
|
+
sub.remove();
|
|
143
|
+
open(e.endCoordinates.height);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const trimmed = draft.trim();
|
|
147
|
+
const canSend = trimmed !== "" && trimmed !== ((_c = current === null || current === void 0 ? void 0 : current.comment) !== null && _c !== void 0 ? _c : "");
|
|
148
|
+
const onSend = () => {
|
|
149
|
+
react_native_1.Keyboard.dismiss();
|
|
150
|
+
record("down", { reasons, comment: trimmed });
|
|
151
|
+
};
|
|
152
|
+
const voteButton = (vote) => {
|
|
153
|
+
const isOn = (current === null || current === void 0 ? void 0 : current.vote) === vote;
|
|
154
|
+
return (<common_1.PressAnimatedWrap onPress={() => onVote(vote)} style={[
|
|
155
|
+
styles.vote,
|
|
156
|
+
isOn && (vote === "up" ? styles.voteUpOn : styles.voteDownOn),
|
|
157
|
+
]}>
|
|
158
|
+
<common_1.Icon5 name={vote === "up" ? "thumbs-up" : "thumbs-down"} size={15} color={isOn ? "text" : "ltBlack"} solid={isOn} style={styles.voteIcon}/>
|
|
159
|
+
<common_1.MyText fsize="sm" weight={700} color={isOn ? "text" : "gray"}>
|
|
160
|
+
{t(vote === "up" ? "article.ratingUp" : "article.ratingDown")}
|
|
161
|
+
</common_1.MyText>
|
|
162
|
+
</common_1.PressAnimatedWrap>);
|
|
163
|
+
};
|
|
164
|
+
return (<react_native_1.View style={styles.container}>
|
|
165
|
+
<common_1.MyText fsize="sm" color="gray" style={styles.ask}>
|
|
166
|
+
{t(kind === "explain"
|
|
167
|
+
? "article.ratingAskExplain"
|
|
168
|
+
: "article.ratingAskLesson")}
|
|
169
|
+
</common_1.MyText>
|
|
170
|
+
<react_native_1.View style={styles.row}>
|
|
171
|
+
{voteButton("up")}
|
|
172
|
+
{voteButton("down")}
|
|
173
|
+
</react_native_1.View>
|
|
174
|
+
<Expand open={(current === null || current === void 0 ? void 0 : current.vote) === "down"}>
|
|
175
|
+
<react_native_1.View style={styles.panel}>
|
|
176
|
+
<common_1.MyText fsize="xs" color="gray" style={styles.reasonAsk}>
|
|
177
|
+
{t("article.ratingReasonAsk")}
|
|
178
|
+
</common_1.MyText>
|
|
179
|
+
<react_native_1.View style={styles.reasons}>
|
|
180
|
+
{REASONS.map(({ key, label }) => (<common_1.PressAnimatedWrap key={key} onPress={() => onReason(key)} style={[
|
|
181
|
+
styles.reason,
|
|
182
|
+
reasons.includes(key) && styles.reasonOn,
|
|
183
|
+
]}>
|
|
184
|
+
<common_1.MyText fsize="xs" weight={700} color="text">
|
|
185
|
+
{t(label)}
|
|
186
|
+
</common_1.MyText>
|
|
187
|
+
</common_1.PressAnimatedWrap>))}
|
|
188
|
+
</react_native_1.View>
|
|
189
|
+
<react_native_1.TextInput ref={inputRef} onFocus={onFocus} value={draft} onChangeText={setDraft} placeholder={t("article.ratingCommentPlaceholder")} placeholderTextColor={lib_1.colors.ltBlack} multiline maxLength={COMMENT_MAX} style={styles.input} allowFontScaling={false}/>
|
|
190
|
+
<react_native_1.View style={styles.sendRow}>
|
|
191
|
+
<common_1.MyText fsize="xs" color="ltBlack">
|
|
192
|
+
{draft.length}/{COMMENT_MAX}
|
|
193
|
+
</common_1.MyText>
|
|
194
|
+
{canSend ? (<common_1.PressAnimatedWrap onPress={onSend} style={styles.send}>
|
|
195
|
+
<common_1.MyText fsize="xs" weight={700} color="white">
|
|
196
|
+
{t("article.ratingSend")}
|
|
197
|
+
</common_1.MyText>
|
|
198
|
+
</common_1.PressAnimatedWrap>) : (!!(current === null || current === void 0 ? void 0 : current.comment) &&
|
|
199
|
+
trimmed === (current === null || current === void 0 ? void 0 : current.comment) && (<common_1.MyText fsize="xs" weight={700} color="gray">
|
|
200
|
+
{t("article.ratingCommentSent")}
|
|
201
|
+
</common_1.MyText>))}
|
|
202
|
+
</react_native_1.View>
|
|
203
|
+
<react_native_1.View style={styles.noteRow}>
|
|
204
|
+
<common_1.MyText fsize="xs" color="ltBlack">
|
|
205
|
+
{t("article.ratingNoReply")}
|
|
206
|
+
</common_1.MyText>
|
|
207
|
+
<common_1.MyText fsize="xs" color="gray" style={styles.reportLink} onPress={onReport} suppressHighlighting>
|
|
208
|
+
{t("article.ratingToReport")}
|
|
209
|
+
</common_1.MyText>
|
|
210
|
+
</react_native_1.View>
|
|
211
|
+
</react_native_1.View>
|
|
212
|
+
</Expand>
|
|
213
|
+
{(current === null || current === void 0 ? void 0 : current.vote) && (<common_1.MyText fsize="xs" color="ltBlack" style={styles.thanks}>
|
|
214
|
+
{t("article.ratingThanks")}
|
|
215
|
+
</common_1.MyText>)}
|
|
216
|
+
{keyboardSpace > 0 && <react_native_1.View style={{ height: keyboardSpace }}/>}
|
|
217
|
+
</react_native_1.View>);
|
|
218
|
+
};
|
|
219
|
+
// Badの枠を、高さを少しずつ変えて開く・閉じる。下のボタンも一緒になめらかに動く(11/07、本人)。
|
|
220
|
+
// LayoutAnimationは新アーキテクチャのiOSで動かず、1こまで出たため(2026-11-07、シミュレータの録画で確かめた)。
|
|
221
|
+
// 中身は外の高さに縛られないよう浮かせて測り、その高さまで外の箱を広げる
|
|
222
|
+
const Expand = ({ open, children, }) => {
|
|
223
|
+
const height = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
224
|
+
const progress = (0, react_native_reanimated_1.useSharedValue)(open ? 1 : 0);
|
|
225
|
+
(0, react_1.useEffect)(() => {
|
|
226
|
+
progress.value = (0, react_native_reanimated_1.withTiming)(open ? 1 : 0, {
|
|
227
|
+
duration: 250,
|
|
228
|
+
easing: react_native_reanimated_1.Easing.out(react_native_reanimated_1.Easing.cubic),
|
|
229
|
+
});
|
|
230
|
+
}, [open]);
|
|
231
|
+
const style = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
232
|
+
height: height.value * progress.value,
|
|
233
|
+
opacity: progress.value,
|
|
234
|
+
}));
|
|
235
|
+
return (<react_native_reanimated_1.default.View style={[styles.expand, style]}>
|
|
236
|
+
<react_native_1.View style={styles.expandInner} onLayout={(e) => {
|
|
237
|
+
height.value = e.nativeEvent.layout.height;
|
|
238
|
+
}} pointerEvents={open ? "auto" : "none"}>
|
|
239
|
+
{children}
|
|
240
|
+
</react_native_1.View>
|
|
241
|
+
</react_native_reanimated_1.default.View>);
|
|
242
|
+
};
|
|
243
|
+
const styles = react_native_1.StyleSheet.create({
|
|
244
|
+
expand: {
|
|
245
|
+
alignSelf: "stretch",
|
|
246
|
+
overflow: "hidden",
|
|
247
|
+
},
|
|
248
|
+
expandInner: {
|
|
249
|
+
position: "absolute",
|
|
250
|
+
top: 0,
|
|
251
|
+
left: 0,
|
|
252
|
+
right: 0,
|
|
253
|
+
},
|
|
254
|
+
container: {
|
|
255
|
+
alignItems: "center",
|
|
256
|
+
marginTop: 16,
|
|
257
|
+
marginHorizontal: 10,
|
|
258
|
+
paddingTop: 14,
|
|
259
|
+
paddingBottom: 4,
|
|
260
|
+
borderTopWidth: 1,
|
|
261
|
+
borderTopColor: lib_1.colors.light,
|
|
262
|
+
},
|
|
263
|
+
ask: {
|
|
264
|
+
marginBottom: 10,
|
|
265
|
+
},
|
|
266
|
+
row: {
|
|
267
|
+
flexDirection: "row",
|
|
268
|
+
gap: 12,
|
|
269
|
+
},
|
|
270
|
+
vote: {
|
|
271
|
+
flexDirection: "row",
|
|
272
|
+
alignItems: "center",
|
|
273
|
+
height: 38,
|
|
274
|
+
paddingHorizontal: 22,
|
|
275
|
+
borderRadius: 19,
|
|
276
|
+
borderWidth: 1,
|
|
277
|
+
borderColor: lib_1.colors.light,
|
|
278
|
+
backgroundColor: lib_1.colors.bkBeige,
|
|
279
|
+
},
|
|
280
|
+
voteUpOn: {
|
|
281
|
+
borderColor: lib_1.colors.green,
|
|
282
|
+
backgroundColor: lib_1.colors.ltGreen,
|
|
283
|
+
},
|
|
284
|
+
voteDownOn: {
|
|
285
|
+
borderColor: lib_1.colors.red,
|
|
286
|
+
backgroundColor: lib_1.colors.ltRed,
|
|
287
|
+
},
|
|
288
|
+
voteIcon: {
|
|
289
|
+
marginRight: 8,
|
|
290
|
+
},
|
|
291
|
+
panel: {
|
|
292
|
+
alignSelf: "stretch",
|
|
293
|
+
marginTop: 12,
|
|
294
|
+
padding: 12,
|
|
295
|
+
borderRadius: 10,
|
|
296
|
+
borderWidth: 1,
|
|
297
|
+
borderColor: lib_1.colors.light,
|
|
298
|
+
backgroundColor: lib_1.colors.white,
|
|
299
|
+
},
|
|
300
|
+
reasonAsk: {
|
|
301
|
+
marginBottom: 8,
|
|
302
|
+
},
|
|
303
|
+
reasons: {
|
|
304
|
+
flexDirection: "row",
|
|
305
|
+
flexWrap: "wrap",
|
|
306
|
+
gap: 8,
|
|
307
|
+
},
|
|
308
|
+
reason: {
|
|
309
|
+
paddingVertical: 6,
|
|
310
|
+
paddingHorizontal: 12,
|
|
311
|
+
borderRadius: 14,
|
|
312
|
+
borderWidth: 1,
|
|
313
|
+
borderColor: lib_1.colors.light,
|
|
314
|
+
backgroundColor: lib_1.colors.bkBeige,
|
|
315
|
+
},
|
|
316
|
+
reasonOn: {
|
|
317
|
+
borderColor: lib_1.colors.red,
|
|
318
|
+
backgroundColor: lib_1.colors.ltRed,
|
|
319
|
+
},
|
|
320
|
+
input: {
|
|
321
|
+
marginTop: 10,
|
|
322
|
+
minHeight: 72,
|
|
323
|
+
padding: 8,
|
|
324
|
+
borderRadius: 8,
|
|
325
|
+
borderWidth: 1,
|
|
326
|
+
borderColor: lib_1.colors.light,
|
|
327
|
+
backgroundColor: lib_1.colors.ltBeige,
|
|
328
|
+
color: lib_1.colors.text,
|
|
329
|
+
fontFamily: "ZenKakuGothicNew_500Medium",
|
|
330
|
+
fontSize: 14,
|
|
331
|
+
textAlignVertical: "top",
|
|
332
|
+
},
|
|
333
|
+
sendRow: {
|
|
334
|
+
flexDirection: "row",
|
|
335
|
+
alignItems: "center",
|
|
336
|
+
justifyContent: "space-between",
|
|
337
|
+
minHeight: 30,
|
|
338
|
+
marginTop: 6,
|
|
339
|
+
},
|
|
340
|
+
send: {
|
|
341
|
+
paddingVertical: 6,
|
|
342
|
+
paddingHorizontal: 16,
|
|
343
|
+
borderRadius: 14,
|
|
344
|
+
backgroundColor: lib_1.colors.darkGray,
|
|
345
|
+
},
|
|
346
|
+
noteRow: {
|
|
347
|
+
flexDirection: "row",
|
|
348
|
+
flexWrap: "wrap",
|
|
349
|
+
marginTop: 6,
|
|
350
|
+
},
|
|
351
|
+
reportLink: {
|
|
352
|
+
textDecorationLine: "underline",
|
|
353
|
+
},
|
|
354
|
+
thanks: {
|
|
355
|
+
marginTop: 10,
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
exports.default = RatingBar;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeScrollEvent, NativeSyntheticEvent, ScrollView, TextInput } from "react-native";
|
|
3
|
+
export declare const KeyboardScrollContext: React.Context<((input: TextInput) => void) | null>;
|
|
4
|
+
export declare const useKeyboardScroll: (ref: React.RefObject<ScrollView | null>) => {
|
|
5
|
+
scrollToInput: (input: TextInput) => void;
|
|
6
|
+
onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useKeyboardScroll = exports.KeyboardScrollContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
// Androidで評価の書く欄がキーボードに隠れないよう、欄の側からスクロールを頼む。評価の欄を含むスクロールの持ち主が渡す。
|
|
7
|
+
// targetSdkVersion 36では画面の端まで描く形が強制され、adjustResizeでも画面が縮まない。
|
|
8
|
+
// KeyboardAvoidingViewや外側の余白も効かなかった(2026-11-08、Pixel 8a)ので、欄の下にキーボードの高さの空きを足し(RatingBar)、ここでスクロールする。
|
|
9
|
+
// iOSはスクロールのautomaticallyAdjustKeyboardInsetsで足りる
|
|
10
|
+
exports.KeyboardScrollContext = (0, react_1.createContext)(null);
|
|
11
|
+
// 欄の下にこれだけ空けて止める(文字数と「送る」の行が見えるように)
|
|
12
|
+
const KEYBOARD_GAP = 56;
|
|
13
|
+
// 欄の画面上の位置とキーボードの上端から重なりを出し、その分だけ下へスクロールする。
|
|
14
|
+
// 今のスクロールの位置は onScroll で覚える(ScrollViewには位置を聞く手段が無い)。
|
|
15
|
+
// scrollResponderScrollNativeHandleToKeyboard はスクロールの上端が画面の一番上にある前提で止める位置を決めるので使わない
|
|
16
|
+
const useKeyboardScroll = (ref) => {
|
|
17
|
+
const offset = (0, react_1.useRef)(0);
|
|
18
|
+
const [scrollToInput] = (0, react_1.useState)(() => (input) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const metrics = react_native_1.Keyboard.metrics();
|
|
21
|
+
if (!metrics)
|
|
22
|
+
return;
|
|
23
|
+
// キーボードの位置は画面の一番上から、measureInWindow は上の帯(ステータスバー)の下から測った値なので、帯の分を引いてそろえる(Pixel 8aで確かめた)
|
|
24
|
+
const keyboardTop = metrics.screenY - ((_a = react_native_1.StatusBar.currentHeight) !== null && _a !== void 0 ? _a : 0);
|
|
25
|
+
input.measureInWindow((_x, y, _w, h) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const overlap = y + h + KEYBOARD_GAP - keyboardTop;
|
|
28
|
+
if (overlap > 0)
|
|
29
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ y: offset.current + overlap, animated: true });
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
const onScroll = (e) => {
|
|
33
|
+
offset.current = e.nativeEvent.contentOffset.y;
|
|
34
|
+
};
|
|
35
|
+
return { scrollToInput, onScroll };
|
|
36
|
+
};
|
|
37
|
+
exports.useKeyboardScroll = useKeyboardScroll;
|
|
@@ -63,13 +63,13 @@ const QuizFlatList = ({ navigation }) => {
|
|
|
63
63
|
const renderItem = ({ item }) => {
|
|
64
64
|
var _a, _b;
|
|
65
65
|
return (<react_native_1.TouchableOpacity style={styles.row} activeOpacity={0.7} onPress={() => handlePress(item.index)}>
|
|
66
|
-
<common_1.MyText fsize="
|
|
66
|
+
<common_1.MyText fsize="sm" weight={700} color="gray" style={styles.num}>
|
|
67
67
|
{item.index + 1}
|
|
68
68
|
</common_1.MyText>
|
|
69
69
|
<Badge isCorrected={item.isCorrected} system={item.system}/>
|
|
70
70
|
<react_native_1.View style={styles.texts}>
|
|
71
71
|
<QuestionText item={item}/>
|
|
72
|
-
{item.sub && (<common_1.MyText fsize="
|
|
72
|
+
{item.sub && (<common_1.MyText fsize="sm" color="gray" numberOfLines={1}>
|
|
73
73
|
{item.sub}
|
|
74
74
|
</common_1.MyText>)}
|
|
75
75
|
</react_native_1.View>
|
|
@@ -78,12 +78,12 @@ const QuizFlatList = ({ navigation }) => {
|
|
|
78
78
|
};
|
|
79
79
|
return (<react_native_1.View style={styles.container}>
|
|
80
80
|
<react_native_1.View style={styles.head}>
|
|
81
|
-
<common_1.MyText fsize="
|
|
81
|
+
<common_1.MyText fsize="md" weight={700}>
|
|
82
82
|
{t("quiz.result.review")}
|
|
83
83
|
</common_1.MyText>
|
|
84
84
|
<react_native_1.View style={styles.seg}>
|
|
85
85
|
{["all", "wrong"].map((f) => (<react_native_1.Pressable key={f} onPress={() => setFilter(f)} style={[styles.segItem, filter === f && styles.segOn]}>
|
|
86
|
-
<common_1.MyText fsize="
|
|
86
|
+
<common_1.MyText fsize="sm" weight={700} color={filter === f ? "white" : "text"}>
|
|
87
87
|
{f === "all"
|
|
88
88
|
? `${t("quiz.result.all")} ${items.length}`
|
|
89
89
|
: `${t("quiz.result.wrongOnly")} ${wrongCnt}`}
|
|
@@ -100,7 +100,7 @@ const Badge = ({ isCorrected, system }) => {
|
|
|
100
100
|
const background = isCorrected === undefined ? lib_1.colors.light : isCorrected ? lib_1.colors.red : lib_1.colors.blue;
|
|
101
101
|
const icon = isCorrected === undefined ? "minus" : isCorrected ? correctIcon : "times";
|
|
102
102
|
return (<react_native_1.View style={[styles.badge, { backgroundColor: background }]}>
|
|
103
|
-
<common_1.Icon5 name={icon} size={
|
|
103
|
+
<common_1.Icon5 name={icon} size={12} color="white"/>
|
|
104
104
|
</react_native_1.View>);
|
|
105
105
|
};
|
|
106
106
|
// 文法は例文をふりがなを外して2行まで出し、文法の部分(udl[ ])に下線を引く
|
|
@@ -117,7 +117,7 @@ const QuestionText = ({ item }) => {
|
|
|
117
117
|
return (<RubyText_1.default fsize="sm" isNoWrap>
|
|
118
118
|
{item.question}
|
|
119
119
|
</RubyText_1.default>);
|
|
120
|
-
return (<MyTextqqyy_1.default isNotSearch fsize="
|
|
120
|
+
return (<MyTextqqyy_1.default isNotSearch fsize="sm" numberOfLines={2} style={styles.drillText}>
|
|
121
121
|
{item.question}
|
|
122
122
|
</MyTextqqyy_1.default>);
|
|
123
123
|
};
|
|
@@ -141,8 +141,8 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
141
141
|
padding: 2,
|
|
142
142
|
},
|
|
143
143
|
segItem: {
|
|
144
|
-
paddingHorizontal:
|
|
145
|
-
paddingVertical:
|
|
144
|
+
paddingHorizontal: 10,
|
|
145
|
+
paddingVertical: 3,
|
|
146
146
|
borderRadius: 6,
|
|
147
147
|
},
|
|
148
148
|
segOn: {
|
|
@@ -161,7 +161,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
161
161
|
paddingRight: 10,
|
|
162
162
|
},
|
|
163
163
|
num: {
|
|
164
|
-
width:
|
|
164
|
+
width: 22,
|
|
165
165
|
textAlign: "center",
|
|
166
166
|
marginRight: 2,
|
|
167
167
|
},
|