Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocle2497 committed Jul 12, 2023
1 parent 8e2fa80 commit e2dc93d
Show file tree
Hide file tree
Showing 112 changed files with 1,361 additions and 691 deletions.
17 changes: 10 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 2,
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/explicit-module-boundary-types': 0,
'react/jsx-filename-extension': ['error', {extensions: ['.tsx']}],
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'react-native/no-unused-styles': 2,
'react-native/split-platform-components': 2,
'react-native/no-inline-styles': 0,
'react-native/no-color-literals': 0,
'react-native/no-raw-text': 0,
'import/no-extraneous-dependencies': 2,
'import/extensions': ['error', 'never', {svg: 'always'}],
'import/extensions': ['error', 'never', { svg: 'always' }],
'for-direction': 2,
'no-cond-assign': 2,
'no-constant-condition': 2,
Expand All @@ -71,10 +71,10 @@ module.exports = {
'no-ex-assign': 2,
'padding-line-between-statements': [
'error',
{blankLine: 'always', prev: '*', next: 'return'},
{blankLine: 'always', prev: '*', next: 'export'},
{blankLine: 'always', prev: 'break', next: ['case']},
{blankLine: 'always', prev: '*', next: 'default'},
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: '*', next: 'export' },
{ blankLine: 'always', prev: 'break', next: ['case'] },
{ blankLine: 'always', prev: '*', next: 'default' },
{
blankLine: 'always',
prev: ['import', 'cjs-import'],
Expand Down Expand Up @@ -147,7 +147,10 @@ module.exports = {
'@typescript-eslint/indent': 0,
'import/no-anonymous-default-export': 2,
'react-hooks/rules-of-hooks': 1,
'react-hooks/exhaustive-deps': ['warn', {additionalHooks: '(useDidMount)'}],
'react-hooks/exhaustive-deps': [
'warn',
{ additionalHooks: '(useDidMount)' },
],
'jest/no-identical-title': 2,
'jest/valid-expect': 2,
camelcase: 0,
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
};
17 changes: 0 additions & 17 deletions __tests__/App.test.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'react-native-gesture-handler';
import {AppRegistry} from 'react-native';
import { AppRegistry } from 'react-native';

import {name as appName} from './app.json';
import {MyApp} from './src/app';
import { name as appName } from './app.json';
import { MyApp } from './src/app';
AppRegistry.registerComponent(appName, () => MyApp);
4 changes: 0 additions & 4 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ target 'RNChallenge' do
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'RNChallengeTests' do
inherit! :complete
# Pods for testing
end

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
Expand Down
34 changes: 12 additions & 22 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ PODS:
- DoubleConversion (1.1.6)
- EXApplication (5.3.0):
- ExpoModulesCore
- EXAV (13.4.1):
- ExpoModulesCore
- ReactCommon/turbomodule/core
- EXConstants (14.4.2):
- ExpoModulesCore
- EXFileSystem (15.4.2):
Expand Down Expand Up @@ -96,9 +99,9 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- hermes-engine (0.72.1):
- hermes-engine/Pre-built (= 0.72.1)
- hermes-engine/Pre-built (0.72.1)
- hermes-engine (0.72.2):
- hermes-engine/Pre-built (= 0.72.2)
- hermes-engine/Pre-built (0.72.2)
- libaom (3.0.0):
- libvmaf (>= 2.2.0)
- libavif (0.11.1):
Expand All @@ -119,9 +122,6 @@ PODS:
- libwebp/demux
- libwebp/webp (1.2.4)
- OpenSSL-Universal (1.1.1100)
- PromisesObjC (2.2.0)
- PromisesSwift (2.2.0):
- PromisesObjC (= 2.2.0)
- RCT-Folly (2021.07.22.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -427,12 +427,6 @@ PODS:
- React
- React-callinvoker
- React-Core
- react-native-video (6.0.0-alpha.6):
- React-Core
- react-native-video/Video (= 6.0.0-alpha.6)
- react-native-video/Video (6.0.0-alpha.6):
- PromisesSwift
- React-Core
- React-NativeModulesApple (0.72.1):
- hermes-engine
- React-callinvoker
Expand Down Expand Up @@ -604,6 +598,7 @@ DEPENDENCIES:
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXApplication (from `../node_modules/expo-application/ios`)
- EXAV (from `../node_modules/expo-av/ios`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXFont (from `../node_modules/expo-font/ios`)
Expand Down Expand Up @@ -656,7 +651,6 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- "react-native-skia (from `../node_modules/@shopify/react-native-skia`)"
- react-native-video (from `../node_modules/react-native-video`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
Expand Down Expand Up @@ -700,8 +694,6 @@ SPEC REPOS:
- libvmaf
- libwebp
- OpenSSL-Universal
- PromisesObjC
- PromisesSwift
- SDWebImage
- SDWebImageAVIFCoder
- SDWebImageSVGCoder
Expand All @@ -718,6 +710,8 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXApplication:
:path: "../node_modules/expo-application/ios"
EXAV:
:path: "../node_modules/expo-av/ios"
EXConstants:
:path: "../node_modules/expo-constants/ios"
EXFileSystem:
Expand Down Expand Up @@ -775,8 +769,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-safe-area-context"
react-native-skia:
:path: "../node_modules/@shopify/react-native-skia"
react-native-video:
:path: "../node_modules/react-native-video"
React-NativeModulesApple:
:path: "../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios"
React-perflogger:
Expand Down Expand Up @@ -832,6 +824,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
EXApplication: 02655a251434d564bb0e73291f5a490c74b5b76f
EXAV: f393dfc0b28214d62855a31e06eb21d426d6e2da
EXConstants: ce5bbea779da8031ac818c36bea41b10e14d04e1
EXFileSystem: d7f59869885cfeab3ac771e2a8d0f5ed98cd3fdb
EXFont: 738c44c390953ebcbab075a4848bfbef025fd9ee
Expand All @@ -851,15 +844,13 @@ SPEC CHECKSUMS:
FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 9df83855a0fd15ef8eb61694652bae636b0c466e
hermes-engine: 3f42310d66bcbc814b3771b79ad8d5a3f8df3df1
libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libvmaf: 27f523f1e63c694d14d534cd0fddd2fab0ae8711
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
PromisesSwift: cf9eb58666a43bbe007302226e510b16c1e10959
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: c52ee8fb2b35c1b54031dd8e92d88ad4dba8f2ce
RCTTypeSafety: 75fa444becadf0ebfa0a456b8c64560c7c89c7df
Expand All @@ -877,7 +868,6 @@ SPEC CHECKSUMS:
React-logger: b8103c9b04e707b50cdd2b1aeb382483900cbb37
react-native-safe-area-context: 46b2815aabca6921dca647416a9ff42668a52580
react-native-skia: e2cb3443442bf7680e3276dc82cd87c97f96b6f9
react-native-video: fee89269ad07556d960721f3b62e39be6ace3c90
React-NativeModulesApple: 4f31a812364443cee6ef768d256c594ad3b20f53
React-perflogger: 3d501f34c8d4b10cb75f348e43591765788525ad
React-RCTActionSheet: f5335572c979198c0c3daff67b07bd1ad8370c1d
Expand Down Expand Up @@ -909,6 +899,6 @@ SPEC CHECKSUMS:
Yoga: 65286bb6a07edce5e4fe8c90774da977ae8fc009
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: ae129feb52fe9b7cce0e34fdfabf94c4891d21fa
PODFILE CHECKSUM: e958c075ee81e16af99e1c10c9f991765b7fca49

COCOAPODS: 1.12.0
5 changes: 4 additions & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { getDefaultConfig } = require('expo/metro-config');
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/order */
const { mergeConfig } = require('@react-native/metro-config');

const { getDefaultConfig } = require('expo/metro-config');

/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
"axios": "^1.4.0",
"d3": "^7.8.5",
"expo": "^49.0.0",
"expo-av": "^13.4.1",
"expo-image": "^1.3.1",
"gaussian": "^1.3.0",
"react": "18.2.0",
"react-fast-compare": "^3.2.2",
"react-native": "0.72.2",
"react-native": "0.72.1",
"react-native-bootsplash": "^4.7.5",
"react-native-gesture-handler": "^2.12.0",
"react-native-linear-gradient": "^2.7.3",
"react-native-reanimated": "^3.3.0",
"react-native-safe-area-context": "^4.7.0",
"react-native-screens": "^3.22.1",
"react-native-svg": "^13.10.0",
"react-native-video": "^6.0.0-alpha.6"
"react-native-svg": "^13.10.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand All @@ -47,12 +47,14 @@
"@types/gaussian": "^1.2.0",
"@types/metro-config": "^0.76.3",
"@types/react": "^18.0.24",
"@types/react-native-video": "^5.0.14",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-jest": "^29.2.1",
"babel-plugin-module-resolver": "^4.1.0",
"eslint": "^8.19.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.7",
"patch-package": "^6.5.1",
Expand Down
11 changes: 6 additions & 5 deletions src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, {Suspense} from 'react';
import {LogBox, StyleSheet} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {RootNavigation} from './app/navigation/root';
import React, { Suspense } from 'react';
import { LogBox, StyleSheet } from 'react-native';

import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context';

import { RootNavigation } from './app/navigation/root';
LogBox.ignoreAllLogs();

const styles = StyleSheet.create({
Expand Down
9 changes: 7 additions & 2 deletions src/app/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {useCallback, useEffect, useState} from 'react';
import {BackHandler, Platform} from 'react-native';
import { useCallback, useEffect, useState } from 'react';
import { BackHandler, Platform } from 'react-native';

export const randomUUID = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8;

return v.toString(16);
});
};
Expand All @@ -23,12 +24,14 @@ export function useMounted(callback: () => void, deps: any[] = []) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [...deps]);
}

export const sharedClamp = (
value: number,
lowerValue: number,
upperValue: number,
) => {
'worklet';

return Math.min(Math.max(lowerValue, value), upperValue);
};

Expand All @@ -41,6 +44,7 @@ export function useDisableBackHandler(
if (typeof callback === 'function') {
callback();
}

return true;
}, [callback]);

Expand All @@ -50,6 +54,7 @@ export function useDisableBackHandler(
} else {
BackHandler.removeEventListener('hardwareBackPress', onBackPress);
}

return () =>
BackHandler.removeEventListener('hardwareBackPress', onBackPress);
}, [disabled, onBackPress]);
Expand Down
Loading

0 comments on commit e2dc93d

Please sign in to comment.