Skip to content

Instantly share code, notes, and snippets.

@Jpoliachik
Jpoliachik / decodeHtml.ts
Created January 9, 2024 15:48
decodeHtml.ts
const entities = {
amp: "&",
apos: "'",
lt: "<",
gt: ">",
quot: '"',
nbsp: "\xa0",
ouml: "ö",
auml: "ä",
uuml: "ü",
@Jpoliachik
Jpoliachik / QuestionScreen.tsx
Created January 9, 2024 15:49
QuestionScreen.tsx (1)
import React, { FC } from "react"
import { observer } from "mobx-react-lite"
import { TextStyle, View, ViewStyle } from "react-native"
import { AppStackScreenProps } from "app/navigators"
import { Screen, Text } from "app/components"
import { spacing } from "app/theme"
// import { useNavigation } from "@react-navigation/native"
// import { useStores } from "app/models"
interface QuestionScreenProps extends AppStackScreenProps<"Question"> {}
@Jpoliachik
Jpoliachik / QuestionsScreen.tsx
Last active January 10, 2024 20:25
QuestionsScreen updated
import React, { FC, useEffect } from "react"
import { observer } from "mobx-react-lite"
import { TextStyle, View, ViewStyle } from "react-native"
import { AppStackScreenProps } from "app/navigators"
import { ListView, Screen, Text } from "app/components"
import { colors, spacing } from "app/theme"
import { Question, useStores } from "app/models"
import { decodeHTMLEntities } from "app/utils/decodeHtml"
import { ContentStyle } from "@shopify/flash-list"
@Jpoliachik
Jpoliachik / Question.ts
Created January 9, 2024 17:01
Question.ts updated
import shuffle from "lodash.shuffle"
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),
@Jpoliachik
Jpoliachik / QuestionScreen.tsx
Created January 9, 2024 17:17
QuestionScreen updated 2
...
import { RadioGroup } from "react-native-radio-buttons-group"
...
export const QuestionScreen: FC<QuestionScreenProps> = observer(function QuestionScreen() {
...
const onPressAnswer = (question: Question, guess: string) => {
question.setGuess(guess)
}