This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react" | |
import { observer } from "mobx-react-lite" | |
import { FlatList, TextStyle, View, ViewStyle } from "react-native" | |
import { Screen, Text } from "../../components" | |
import { color, spacing } from "../../theme" | |
import { useStores } from "../../models" | |
import { Question } from "../../models/question/question" | |
import { decodeHTMLEntities } from "../../utils/html-decode" | |
const ROOT: ViewStyle = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const QuestionModel = types | |
.model("Question") | |
.props({ | |
id: types.identifier, | |
category: types.maybe(types.string), | |
type: types.enumeration(["multiple", "boolean"]), | |
difficulty: types.enumeration(["easy", "medium", "hard"]), | |
question: types.maybe(types.string), | |
correctAnswer: types.maybe(types.string), | |
incorrectAnswers: types.optional(types.array(types.string), []), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CHECK_ANSWER: ViewStyle = { | |
paddingVertical: spacing.smaller, | |
backgroundColor: color.palette.angry, | |
marginTop: spacing.smaller, | |
} | |
export const QuestionScreen = observer(function QuestionScreen() { | |
... | |
const onPressAnswer = (question: Question, guess: string) => { | |
question.setGuess(guess) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get radioProps() { | |
const allAnswers = self.incorrectAnswers.concat([self.correctAnswer]) | |
const radioProps = allAnswers.map(answer => ({ label: answer, value: answer })) | |
return shuffle(radioProps) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Instance, SnapshotOut, types } from "mobx-state-tree" | |
import { QuestionStore, QuestionStoreModel } from "../question-store/question-store" | |
/** | |
* A RootStore model. | |
*/ | |
// prettier-ignore | |
export const RootStoreModel = types.model("RootStore").props({ | |
questionStore: types.optional(QuestionStoreModel, {} as QuestionStore) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
export const QuestionModel = types | |
... | |
.views((self) => ({ | |
get allAnswers() { | |
return shuffle(self.incorrectAnswers.concat([self.correctAnswer])) | |
} | |
)} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/robinheinze/.npm/_npx/e31027f3785124a8/node_modules/gluegun/build/index.js:13 | |
throw up; | |
^ | |
npm WARN exec The following package was not found and will be installed: react-native-rename | |
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info. | |
mv: no such file or directory: /Users/robinheinze/Code/ir/MyApp/ios/MyApp | |
mv: no such file or directory: /Users/robinheinze/Code/ir/MyApp/ios/MyApp-tvOS | |
mv: no such file or directory: /Users/robinheinze/Code/ir/MyApp/ios/MyApp-tvOSTests | |
mv: no such file or directory: /Users/robinheinze/Code/ir/MyApp/ios/MyApp.xcodeproj | |
mv: no such file or directory: /Users/robinheinze/Code/ir/MyApp/ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyApp-tvOS.xcscheme |
OlderNewer