nx-react-native-cli 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +32 -32
- package/package.json +5 -1
- package/templates/.eslintrc.json +1 -0
- package/templates/.nvmrc +1 -1
- package/templates/apps/mobile/android/app/build.gradle +12 -24
- package/templates/apps/mobile/android/app/proguard-rules.pro +20 -0
- package/templates/apps/mobile/android/build.gradle +6 -19
- package/templates/apps/mobile/babel.config.json +2 -1
- package/templates/apps/mobile/export-node-binary.sh +6 -0
- package/templates/apps/mobile/jest.config.ts +12 -0
- package/templates/apps/mobile/package.json +6 -1
- package/templates/apps/mobile/project.json +3 -2
- package/templates/apps/mobile/react-native.config.js +7 -0
- package/templates/apps/mobile/src/app/index.tsx +7 -1
- package/templates/apps/mobile/src/assets/fonts/InterBlack.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBlackItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterMedium.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterMediumItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterRegular.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterSemiBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterSemiBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterThin.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterThinItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBlack.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBlackItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratMedium.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratMediumItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratRegular.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratSemiBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratSemiBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratThin.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratThinItalic.ttf +0 -0
- package/templates/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +9 -7
- package/templates/apps/mobile/src/components/atoms/Box/box.component.tsx +21 -0
- package/templates/apps/mobile/src/components/atoms/Box/index.ts +1 -0
- package/templates/apps/mobile/src/components/atoms/Button/button.component.tsx +24 -8
- package/templates/apps/mobile/src/components/atoms/Button/index.ts +0 -1
- package/templates/apps/mobile/src/components/atoms/Divider/divider-component.tsx +2 -2
- package/templates/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +12 -11
- package/templates/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx +17 -17
- package/templates/apps/mobile/src/components/atoms/Modal/modal.component.tsx +5 -4
- package/templates/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +5 -4
- package/templates/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +2 -2
- package/templates/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +5 -5
- package/templates/apps/mobile/src/components/atoms/Typography/index.ts +1 -0
- package/templates/apps/mobile/src/components/atoms/{Text/text.component.tsx → Typography/typography.component.tsx} +1 -1
- package/templates/apps/mobile/src/components/atoms/index.ts +2 -1
- package/templates/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +4 -4
- package/templates/apps/mobile/src/components/molecules/BottomActionsContainer/BottomActionsContainer.component.tsx +1 -4
- package/templates/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +11 -9
- package/templates/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +13 -19
- package/templates/apps/mobile/src/components/molecules/StorageManager/StorageManager.component.tsx +1 -3
- package/templates/apps/mobile/src/hooks/index.ts +2 -1
- package/templates/apps/mobile/src/hooks/useToggleDarkMode.hook.tsx +9 -0
- package/templates/apps/mobile/src/routes/index.tsx +3 -3
- package/templates/apps/mobile/src/routes/privateRoutes.tsx +10 -7
- package/templates/apps/mobile/src/routes/publicRoutes.tsx +12 -9
- package/templates/apps/mobile/src/routes/screen-options.ts +1 -6
- package/templates/apps/mobile/src/routes/screens.enum.ts +1 -1
- package/templates/apps/mobile/src/screens/HomeScreen/home.screen.tsx +2 -2
- package/templates/apps/mobile/src/screens/LandingScreen/landing.screen.tsx +37 -0
- package/templates/apps/mobile/src/types/component.type.ts +1 -6
- package/templates/apps/mobile/src/utils/axios.util.ts +10 -0
- package/templates/apps/mobile/src/utils/index.ts +4 -0
- package/templates/apps/mobile/src/utils/log.util.ts +40 -0
- package/templates/apps/mobile/src/utils/route.util.ts +48 -0
- package/templates/apps/mobile/test-setup.ts +1 -0
- package/templates/apps/mobile/tsconfig.spec.json +20 -0
- package/templates/apps/mobile/src/components/atoms/Button/outlined-button.component.tsx +0 -59
- package/templates/apps/mobile/src/components/atoms/Text/index.ts +0 -1
- package/templates/apps/mobile/src/screens/LoginScreen/login.screen.tsx +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx-react-native-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "A react native starter (with NX) cli script",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"build": "rm -rf lib && esbuild src/index.js --format=cjs --platform=node --bundle --outfile=lib/index.cjs --minify --analyze",
|
|
18
18
|
"prepublish": "npm run build",
|
|
19
19
|
"example": "npx nxrn create example",
|
|
20
|
+
"example-fresh": "npx nxrn create example-fresh --fresh",
|
|
21
|
+
"generate-diff": "./generate-diff.sh",
|
|
22
|
+
"show-diff": "npx diff2html -s side --sc --hc --cs light -i file -o preview -F diff.html -- diff.diff && open diff.html",
|
|
20
23
|
"relink": "npm unlink nxrn && npm run prepublish && npm link",
|
|
21
24
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
25
|
},
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
"prettier": "^3.3.3"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
39
|
+
"diff2html-cli": "^5.2.15",
|
|
36
40
|
"esbuild": "^0.23.0"
|
|
37
41
|
}
|
|
38
42
|
}
|
package/templates/.eslintrc.json
CHANGED
|
@@ -264,6 +264,7 @@
|
|
|
264
264
|
"extends": ["plugin:@nx/typescript"],
|
|
265
265
|
"rules": {
|
|
266
266
|
"@typescript-eslint/consistent-type-definitions": "off",
|
|
267
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
267
268
|
"@typescript-eslint/no-explicit-any": "off",
|
|
268
269
|
"@typescript-eslint/no-use-before-define": "off",
|
|
269
270
|
"@typescript-eslint/no-unused-vars": [
|
package/templates/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v20.9.0
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
2
3
|
apply plugin: "com.facebook.react"
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -9,12 +10,12 @@ react {
|
|
|
9
10
|
/* Folders */
|
|
10
11
|
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
11
12
|
// root = file("../")
|
|
12
|
-
// The folder where the react-native NPM package is. Default is
|
|
13
|
-
|
|
14
|
-
// The folder where the react-native Codegen package is. Default is
|
|
15
|
-
|
|
16
|
-
// The cli.js file which is the React Native CLI entrypoint. Default is
|
|
17
|
-
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../../../node_modules/react-native
|
|
14
|
+
reactNativeDir = file("../../../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../../../node_modules/@react-native/codegen
|
|
16
|
+
codegenDir = file("../../../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../../../node_modules/react-native/cli.js
|
|
18
|
+
cliFile = file("../../../../node_modules/react-native/cli.js")
|
|
18
19
|
|
|
19
20
|
/* Variants */
|
|
20
21
|
// The list of variants to that are debuggable. For those we're going to
|
|
@@ -36,7 +37,7 @@ react {
|
|
|
36
37
|
// bundleAssetName = "MyApplication.android.bundle"
|
|
37
38
|
//
|
|
38
39
|
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
39
|
-
|
|
40
|
+
entryFile = file("../../src/main.tsx")
|
|
40
41
|
//
|
|
41
42
|
// A list of extra flags to pass to the 'bundle' commands.
|
|
42
43
|
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
@@ -44,11 +45,10 @@ react {
|
|
|
44
45
|
|
|
45
46
|
/* Hermes Commands */
|
|
46
47
|
// The hermes compiler command to run. By default it is 'hermesc'
|
|
47
|
-
// hermesCommand = "
|
|
48
|
+
// hermesCommand = "../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
|
|
48
49
|
//
|
|
49
50
|
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
50
51
|
// hermesFlags = ["-O", "-output-source-map"]
|
|
51
|
-
entryFile = file("../../src/main.tsx")
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -71,7 +71,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
|
|
71
71
|
|
|
72
72
|
android {
|
|
73
73
|
ndkVersion rootProject.ext.ndkVersion
|
|
74
|
-
|
|
74
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
75
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
75
76
|
namespace "com.appsmobile"
|
|
76
77
|
flavorDimensions "default"
|
|
77
78
|
|
|
@@ -139,27 +140,14 @@ android {
|
|
|
139
140
|
// see https://reactnative.dev/docs/signed-apk-android.
|
|
140
141
|
minifyEnabled enableProguardInReleaseBuilds
|
|
141
142
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
142
|
-
|
|
143
|
-
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
|
|
144
|
-
|
|
145
143
|
}
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
dependencies {
|
|
150
|
-
|
|
151
|
-
androidTestImplementation('com.wix:detox:+')
|
|
152
|
-
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
153
|
-
|
|
154
148
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
155
149
|
implementation("com.facebook.react:react-android")
|
|
156
150
|
|
|
157
|
-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
158
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
159
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
163
151
|
if (hermesEnabled.toBoolean()) {
|
|
164
152
|
implementation("com.facebook.react:hermes-android")
|
|
165
153
|
} else {
|
|
@@ -167,4 +155,4 @@ dependencies {
|
|
|
167
155
|
}
|
|
168
156
|
}
|
|
169
157
|
|
|
170
|
-
apply from: file("
|
|
158
|
+
apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
11
|
+
|
|
12
|
+
-keep public class com.dylanvann.fastimage.* {*;}
|
|
13
|
+
-keep public class com.dylanvann.fastimage.** {*;}
|
|
14
|
+
-keep public class * implements com.bumptech.glide.module.GlideModule
|
|
15
|
+
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
|
16
|
+
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
|
17
|
+
**[] $VALUES;
|
|
18
|
+
public *;
|
|
19
|
+
}
|
|
20
|
+
-keep class com.shopify.reactnative.skia.** { *; }
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
2
|
-
|
|
3
1
|
buildscript {
|
|
4
2
|
ext {
|
|
5
|
-
buildToolsVersion = "
|
|
6
|
-
minSdkVersion =
|
|
3
|
+
buildToolsVersion = "34.0.0"
|
|
4
|
+
minSdkVersion = 23
|
|
7
5
|
compileSdkVersion = 34
|
|
8
6
|
targetSdkVersion = 34
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
|
|
12
|
-
ndkVersion = "23.1.7779620"
|
|
7
|
+
ndkVersion = "26.1.10909125"
|
|
8
|
+
kotlinVersion = "1.9.22"
|
|
13
9
|
}
|
|
14
10
|
repositories {
|
|
15
11
|
google()
|
|
@@ -18,17 +14,8 @@ buildscript {
|
|
|
18
14
|
dependencies {
|
|
19
15
|
classpath("com.android.tools.build:gradle")
|
|
20
16
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
21
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
repositories {
|
|
27
|
-
|
|
28
|
-
maven {
|
|
29
|
-
// https://wix.github.io/Detox/docs/introduction/project-setup
|
|
30
|
-
url("$rootDir/../node_modules/detox/Detox-android")
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
displayName: 'mobile',
|
|
3
|
+
preset: 'react-native',
|
|
4
|
+
resolver: '@nx/jest/plugins/resolver',
|
|
5
|
+
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
|
6
|
+
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
'\\.svg$': '@nx/react-native/plugins/jest/svg-mock',
|
|
9
|
+
},
|
|
10
|
+
coverageDirectory: '../../coverage/apps/mobile',
|
|
11
|
+
};
|
|
12
|
+
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"ensure-symlink": "npx nx ensure-symlink mobile",
|
|
11
11
|
"sync-deps": "npx nx sync-deps mobile",
|
|
12
12
|
"pod-install": "npx nx pod-install mobile",
|
|
13
|
-
"
|
|
13
|
+
"export-node-binary": "./export-node-binary.sh",
|
|
14
|
+
"bundle:pod-install": "cd ios && bundle install && bundle exec pod install --repo-update && npm run export-node-binary",
|
|
14
15
|
"pre-build": "npm run ensure-symlink && npm run sync-deps && npm run pod-install",
|
|
15
16
|
"list:ios-configurations": "cd ios && xcodebuild -list",
|
|
16
17
|
"list:ios-devices": "xcrun xctrace list devices",
|
|
17
18
|
"xcode": "open ios/AppsMobile.xcworkspace",
|
|
19
|
+
"touch-xcode": "cd ios && touch .xcode.env",
|
|
18
20
|
"check-env:mobile": "cd ../.. && npm run check-env:mobile",
|
|
19
21
|
"setup-fastlane": "rbenv local && bundle install && bundle update",
|
|
20
22
|
"deploy-android:dev": "bundle exec fastlane android dev --env development",
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
"@react-navigation/native": "*",
|
|
35
37
|
"@react-navigation/routers": "*",
|
|
36
38
|
"@react-navigation/stack": "*",
|
|
39
|
+
"@shopify/react-native-skia": "*",
|
|
37
40
|
"@tanstack/query-async-storage-persister": "*",
|
|
38
41
|
"@tanstack/query-core": "*",
|
|
39
42
|
"@tanstack/query-sync-storage-persister": "*",
|
|
@@ -47,12 +50,14 @@
|
|
|
47
50
|
"jotai-optics": "*",
|
|
48
51
|
"jotai": "*",
|
|
49
52
|
"lodash": "*",
|
|
53
|
+
"lottie-react-native": "*",
|
|
50
54
|
"metro-config": "*",
|
|
51
55
|
"react-hook-form": "*",
|
|
52
56
|
"react-native-dotenv": "*",
|
|
53
57
|
"react-native-fast-image": "*",
|
|
54
58
|
"react-native-gesture-handler": "*",
|
|
55
59
|
"react-native-get-random-values": "*",
|
|
60
|
+
"react-native-haptic-feedback": "*",
|
|
56
61
|
"react-native-keyboard-aware-scroll-view": "*",
|
|
57
62
|
"react-native-mmkv": "*",
|
|
58
63
|
"react-native-modal-datetime-picker": "*",
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
4
|
"sourceRoot": "apps/mobile/src",
|
|
5
5
|
"projectType": "application",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"// targets": "to see all targets run: nx show project mobile --web",
|
|
6
8
|
"targets": {
|
|
7
9
|
"check-env": {
|
|
8
10
|
"executor": "nx:run-script",
|
|
@@ -100,6 +102,5 @@
|
|
|
100
102
|
"jestConfig": "apps/mobile/jest.config.ts"
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
}
|
|
104
|
-
"tags": []
|
|
105
|
+
}
|
|
105
106
|
}
|
|
@@ -8,6 +8,8 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
|
8
8
|
import 'react-native-get-random-values';
|
|
9
9
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
10
10
|
import { enableFreeze } from 'react-native-screens';
|
|
11
|
+
import { useDeviceContext } from 'twrnc';
|
|
12
|
+
|
|
11
13
|
import 'react-native-url-polyfill/auto';
|
|
12
14
|
|
|
13
15
|
import { StorageManager } from '../components';
|
|
@@ -35,7 +37,11 @@ const persister = createAsyncStoragePersister({
|
|
|
35
37
|
|
|
36
38
|
const persistOptions = { maxAge: CACHE_TIME, persister };
|
|
37
39
|
|
|
38
|
-
function Application()
|
|
40
|
+
function Application() {
|
|
41
|
+
useDeviceContext(tw, {
|
|
42
|
+
initialColorScheme: 'light',
|
|
43
|
+
});
|
|
44
|
+
|
|
39
45
|
return (
|
|
40
46
|
<GestureHandlerRootView style={tw`flex-1`}>
|
|
41
47
|
<SafeAreaProvider>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
3
|
/* eslint-disable no-magic-numbers */
|
|
2
4
|
import {
|
|
3
5
|
BottomSheetBackdropProps,
|
|
@@ -6,7 +8,7 @@ import {
|
|
|
6
8
|
BottomSheetModal,
|
|
7
9
|
BottomSheetScrollView,
|
|
8
10
|
} from '@gorhom/bottom-sheet';
|
|
9
|
-
import React, { FC,
|
|
11
|
+
import React, { FC, RefObject, useCallback, useMemo, useRef, useState } from 'react';
|
|
10
12
|
import { Keyboard, StyleProp, ViewStyle } from 'react-native';
|
|
11
13
|
import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
|
|
12
14
|
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
@@ -16,7 +18,7 @@ import { DefaultComponentProps } from '../../../types';
|
|
|
16
18
|
|
|
17
19
|
export type BottomSheetProps = DefaultComponentProps & {
|
|
18
20
|
backgroundStyle?: StyleProp<Omit<ViewStyle, 'left' | 'right' | 'position' | 'top' | 'bottom'>>;
|
|
19
|
-
children?: ReactNode;
|
|
21
|
+
children?: React.ReactNode;
|
|
20
22
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
21
23
|
enableDismissOnPressBackdrop?: boolean;
|
|
22
24
|
enableDynamicSizing?: boolean;
|
|
@@ -100,6 +102,7 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
100
102
|
return (
|
|
101
103
|
<BottomSheetModal
|
|
102
104
|
ref={sheetRef}
|
|
105
|
+
android_keyboardInputMode="adjustResize"
|
|
103
106
|
backdropComponent={renderBackdrop}
|
|
104
107
|
backgroundStyle={[tw`bg-gray-50`, backgroundStyle]}
|
|
105
108
|
enableDynamicSizing={enableDynamicSizing}
|
|
@@ -125,21 +128,20 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export function useBottomSheet() {
|
|
131
|
+
const [isVisible, setIsVisible] = useState<boolean>(false);
|
|
128
132
|
const sheetRef = useRef<BottomSheetModal>(null);
|
|
129
133
|
|
|
130
134
|
const expandSheet = useCallback(() => {
|
|
131
135
|
Keyboard.dismiss();
|
|
132
136
|
sheetRef.current?.present();
|
|
137
|
+
setIsVisible(true);
|
|
133
138
|
}, []);
|
|
134
139
|
|
|
135
140
|
const closeSheet = useCallback(() => {
|
|
136
141
|
Keyboard.dismiss();
|
|
137
142
|
sheetRef.current?.close();
|
|
143
|
+
setIsVisible(false);
|
|
138
144
|
}, []);
|
|
139
145
|
|
|
140
|
-
return {
|
|
141
|
-
closeSheet,
|
|
142
|
-
expandSheet,
|
|
143
|
-
sheetRef,
|
|
144
|
-
};
|
|
146
|
+
return { closeSheet, expandSheet, isVisible, sheetRef };
|
|
145
147
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { tw } from '../../../tailwind';
|
|
5
|
+
import { DefaultComponentProps } from '../../../types';
|
|
6
|
+
|
|
7
|
+
type Props = DefaultComponentProps &
|
|
8
|
+
ViewProps & {
|
|
9
|
+
row?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function Box(props: Props) {
|
|
13
|
+
const { row, style, ...rest } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View
|
|
17
|
+
style={[tw`bg-gray-50 dark:bg-gray-900`, row && tw`flex-row items-center`, style]}
|
|
18
|
+
{...rest}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './box.component';
|
|
@@ -5,16 +5,17 @@ import {
|
|
|
5
5
|
TextStyle,
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
TouchableOpacityProps,
|
|
8
|
-
View,
|
|
9
8
|
ViewStyle,
|
|
10
9
|
} from 'react-native';
|
|
11
10
|
|
|
12
11
|
import { colors, disabledInputStyle, tw } from '../../../tailwind';
|
|
13
12
|
import { DefaultComponentProps } from '../../../types/component.type';
|
|
14
|
-
import {
|
|
13
|
+
import { Box } from '../Box';
|
|
14
|
+
import { Typography } from '../Typography';
|
|
15
15
|
|
|
16
16
|
type Props = DefaultComponentProps &
|
|
17
17
|
TouchableOpacityProps & {
|
|
18
|
+
activityIndicatorColor?: string;
|
|
18
19
|
buttonStyle?: StyleProp<ViewStyle>;
|
|
19
20
|
children?: React.ReactNode;
|
|
20
21
|
isLoading?: boolean;
|
|
@@ -24,9 +25,10 @@ type Props = DefaultComponentProps &
|
|
|
24
25
|
|
|
25
26
|
const ACTIVE_OPACITY = 0.5;
|
|
26
27
|
|
|
27
|
-
export function Button(props: Props)
|
|
28
|
+
export function Button(props: Props) {
|
|
28
29
|
const {
|
|
29
30
|
activeOpacity = ACTIVE_OPACITY,
|
|
31
|
+
activityIndicatorColor = colors.white,
|
|
30
32
|
buttonStyle,
|
|
31
33
|
children,
|
|
32
34
|
isDisabled = false,
|
|
@@ -37,19 +39,33 @@ export function Button(props: Props): JSX.Element {
|
|
|
37
39
|
...rest
|
|
38
40
|
} = props;
|
|
39
41
|
const disabled = isDisabled || isLoading;
|
|
40
|
-
const display = children ??
|
|
42
|
+
const display = children ?? (
|
|
43
|
+
<Typography style={[tw`font-medium text-white`, textStyle]}>{title}</Typography>
|
|
44
|
+
);
|
|
41
45
|
|
|
42
46
|
return (
|
|
43
47
|
<TouchableOpacity activeOpacity={activeOpacity} disabled={disabled} style={[style]} {...rest}>
|
|
44
|
-
<
|
|
48
|
+
<Box
|
|
45
49
|
style={[
|
|
46
|
-
tw`bg-primary-700 items-center justify-center rounded-xl p-
|
|
50
|
+
tw`bg-primary-700 items-center justify-center rounded-xl p-3`,
|
|
47
51
|
buttonStyle,
|
|
48
52
|
disabledInputStyle(disabled),
|
|
49
53
|
]}
|
|
50
54
|
>
|
|
51
|
-
{isLoading ? <ActivityIndicator color={
|
|
52
|
-
</
|
|
55
|
+
{isLoading ? <ActivityIndicator color={activityIndicatorColor} /> : display}
|
|
56
|
+
</Box>
|
|
53
57
|
</TouchableOpacity>
|
|
54
58
|
);
|
|
55
59
|
}
|
|
60
|
+
|
|
61
|
+
export function OutlinedButton(props: Props) {
|
|
62
|
+
const { ...rest } = props;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Button
|
|
66
|
+
{...rest}
|
|
67
|
+
buttonStyle={tw`border-primary-700 border-2 bg-white`}
|
|
68
|
+
textStyle={tw`text-primary-700`}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { tw } from '../../../tailwind';
|
|
5
4
|
import { DefaultComponentProps } from '../../../types';
|
|
5
|
+
import { Box } from '../Box';
|
|
6
6
|
|
|
7
7
|
type Props = DefaultComponentProps & {};
|
|
8
8
|
|
|
9
9
|
export function Divider(props: Props) {
|
|
10
10
|
const { style } = props;
|
|
11
11
|
|
|
12
|
-
return <
|
|
12
|
+
return <Box style={[tw`h-[1px] w-full bg-gray-200`, style]}></Box>;
|
|
13
13
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleProp, TextStyle
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { tw } from '../../../tailwind';
|
|
5
5
|
import { DefaultComponentProps } from '../../../types';
|
|
6
|
-
import {
|
|
6
|
+
import { Box } from '../Box';
|
|
7
|
+
import { Typography } from '../Typography';
|
|
7
8
|
|
|
8
9
|
type Props = DefaultComponentProps & {
|
|
9
|
-
children
|
|
10
|
+
children?: React.ReactNode;
|
|
10
11
|
isRequired?: boolean;
|
|
11
12
|
label?: string;
|
|
12
13
|
textStyle?: StyleProp<TextStyle>;
|
|
@@ -16,19 +17,19 @@ export function InputLayout(props: Props) {
|
|
|
16
17
|
const { children, error, isRequired, label, style, textStyle } = props;
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
<
|
|
20
|
+
<Box style={[style]}>
|
|
20
21
|
{label && (
|
|
21
|
-
<
|
|
22
|
+
<Typography style={[tw`mb-2 text-gray-600`, textStyle]}>
|
|
22
23
|
{label}
|
|
23
|
-
{isRequired && <
|
|
24
|
-
</
|
|
24
|
+
{isRequired && <Typography style={tw`text-red-600`}>{isRequired && '*'}</Typography>}
|
|
25
|
+
</Typography>
|
|
25
26
|
)}
|
|
26
27
|
{children}
|
|
27
28
|
{!!error && (
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
</
|
|
29
|
+
<Box style={tw`items-end`}>
|
|
30
|
+
<Typography style={tw`text-right text-red-500`}>{error}</Typography>
|
|
31
|
+
</Box>
|
|
31
32
|
)}
|
|
32
|
-
</
|
|
33
|
+
</Box>
|
|
33
34
|
);
|
|
34
35
|
}
|