Skip to content

Instantly share code, notes, and snippets.

View pytqqq's full-sized avatar

Aleksandra Pytko-Włodarczyk pytqqq

View GitHub Profile
import React from 'react';
import { View } from 'react-native';
import codePush from 'react-native-code-push';
const MyApp = () => <View />;
export default codePush(MyApp);
import React from 'react';
import { View } from 'react-native';
import codePush from 'react-native-code-push';
const MyApp = () => <View />;
export default codePush({
updateDialog: true,
checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
installMode: codePush.InstallMode.ON_NEXT_RESUME,
})(MyApp);
project.ext.react = [
entryFile: "index.js",
enableHermes: true
]
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and
then install pods
:hermes_enabled => true
)
export const GameList = () => {
const {isLoading, data} = useGetGames();
const [gameLikes, setGameLikes] = React.useState<any>({});
const likeGame = (id: number) => {
setGameLikes((prevState: any) => {
return {
...prevState,
[id]: prevState[id] ? prevState[id] + 1 : 1,
jest.mock('../hooks', () => ({
useGetGames: () => ({
data: {
pages: [
{
results: Array.from({length: 1000}, () => ({
id: Math.random() * 10000,
name: Math.random().toString(36).substring(7),
background_url: `https://i.imgur.com/${Math.random()
.toString(36)
const initialWindowMetrics = {
frame: {
x: 0,
y: 0,
width: 0,
height: 0,
},
insets: {
top: 0,
left: 0,
const createWrapper = () => {
return (node: JSX.Element) => (
<NativeBaseProvider initialWindowMetrics={initialWindowMetrics}>
{node}
</NativeBaseProvider>
);
};
import React from 'react';
import {NativeBaseProvider} from 'native-base';
import {measurePerformance} from 'reassure';
import {GameList} from './GameList';
jest.setTimeout(60_000);
jest.mock('../hooks', () => ({
useGetGames: () => ({
data: {
pages: [
{
{"metadata":{}}
{"name":"GameList perf test","runs":10,"meanDuration":480.2,"stdevDuration":31.957610813214572,"durations":[516,506,505,504,495,488,473,456,431,428],"meanCount":1,"stdevCount":0,"counts":[1,1,1,1,1,1,1,1,1,1]}