Skip to content

Instantly share code, notes, and snippets.

@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)
}
@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 / 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 / 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 / decodeHtml.ts
Created January 9, 2024 15:48
decodeHtml.ts
const entities = {
amp: "&",
apos: "'",
lt: "<",
gt: ">",
quot: '"',
nbsp: "\xa0",
ouml: "ö",
auml: "ä",
uuml: "ü",
@Jpoliachik
Jpoliachik / Question.ts
Last active January 9, 2024 15:50
Ignite Trivia App
...
import shuffle from "lodash.shuffle"
...
...
export const QuestionModel = types
...
.views((self) => ({
get allAnswers() {
return shuffle([
...self.incorrectAnswers,
@Jpoliachik
Jpoliachik / android_instructions.md
Created December 13, 2017 20:51 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@Jpoliachik
Jpoliachik / RCTAccessibilityManager+FontMultipliers.m
Last active August 28, 2018 13:20
React Native iOS Accessibility Font Scaling Workaround
//
// RCTAccessibilityManager+FontMultipliers.m
//
// This category is a workaround React Native's default Font Sizing Accessibility settings
//
// Swizzle the getter of the font size multipliers so we can limit the max size.
//
#import "RCTAccessibilityManager+FontMultipliers.h"
#import <objc/runtime.h>
@Jpoliachik
Jpoliachik / AppDelegate.m
Created December 19, 2016 15:25
ReactNative iOS Launch Screen No Flash
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. init window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
// 2. backgroundView using LaunchScreen.xib
UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject];
backgroundView.frame = self.window.bounds;
@Jpoliachik
Jpoliachik / layoutanimationcustom.js
Last active January 31, 2016 21:40
LayoutAnimation Custom Example
// Spring
var CustomLayoutSpring = {
duration: 400,
create: {
type: LayoutAnimation.Types.spring,
property: LayoutAnimation.Properties.scaleXY,
springDamping: 0.7,
},
update: {