nwui-cli 0.4.0-beta.1 → 0.4.1-beta.1
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/build/index.js +8 -3
- package/build/install-component.js +41 -2
- package/no-install/app/+html.tsx +46 -0
- package/no-install/app/+not-found.tsx +25 -0
- package/no-install/app/_layout.tsx +7 -0
- package/no-install/app/details.tsx +20 -0
- package/no-install/app/index.tsx +19 -0
- package/no-install/app-env.d.ts +2 -0
- package/no-install/app.json +41 -0
- package/no-install/assets/adaptive-icon.png +0 -0
- package/no-install/assets/favicon.png +0 -0
- package/no-install/assets/icon.png +0 -0
- package/no-install/assets/splash.png +0 -0
- package/no-install/babel.config.js +13 -0
- package/no-install/cesconfig.json +35 -0
- package/no-install/components/Button.tsx +25 -0
- package/no-install/components/Container.tsx +9 -0
- package/no-install/components/EditScreenInfo.tsx +31 -0
- package/no-install/components/ScreenContent.tsx +29 -0
- package/no-install/components/nativewindui/Slider.tsx +26 -0
- package/no-install/global.css +3 -0
- package/no-install/metro.config.js +10 -0
- package/no-install/package-lock.json +17505 -0
- package/no-install/package.json +59 -0
- package/no-install/prettier.config.js +10 -0
- package/no-install/tailwind.config.js +14 -0
- package/package.json +1 -1
- package/test-app/app/+html.tsx +46 -0
- package/test-app/app/+not-found.tsx +25 -0
- package/test-app/app/_layout.tsx +7 -0
- package/test-app/app/details.tsx +20 -0
- package/test-app/app/index.tsx +19 -0
- package/test-app/app-env.d.ts +2 -0
- package/test-app/app.json +41 -0
- package/test-app/assets/adaptive-icon.png +0 -0
- package/test-app/assets/favicon.png +0 -0
- package/test-app/assets/icon.png +0 -0
- package/test-app/assets/splash.png +0 -0
- package/test-app/babel.config.js +13 -0
- package/test-app/cesconfig.json +35 -0
- package/test-app/components/Button.tsx +25 -0
- package/test-app/components/Container.tsx +9 -0
- package/test-app/components/EditScreenInfo.tsx +31 -0
- package/test-app/components/ScreenContent.tsx +29 -0
- package/test-app/components/nativewindui/ActivityIndicator.tsx +13 -0
- package/test-app/components/nativewindui/Avatar.tsx +133 -0
- package/test-app/components/nativewindui/DatePicker/DatePicker.android.tsx +72 -0
- package/test-app/components/nativewindui/DatePicker/DatePicker.tsx +23 -0
- package/test-app/components/nativewindui/DatePicker/index.ts +1 -0
- package/test-app/components/nativewindui/Picker.tsx +42 -0
- package/test-app/components/nativewindui/ProgressIndicator.tsx +78 -0
- package/test-app/components/nativewindui/Sheet.tsx +52 -0
- package/test-app/components/nativewindui/Slider.tsx +26 -0
- package/test-app/components/nativewindui/Text.tsx +55 -0
- package/test-app/components/nativewindui/Toggle.tsx +20 -0
- package/test-app/global.css +3 -0
- package/test-app/metro.config.js +10 -0
- package/test-app/package.json +64 -0
- package/test-app/prettier.config.js +10 -0
- package/test-app/tailwind.config.js +14 -0
- package/test-no-install/app/+html.tsx +46 -0
- package/test-no-install/app/+not-found.tsx +25 -0
- package/test-no-install/app/_layout.tsx +7 -0
- package/test-no-install/app/details.tsx +20 -0
- package/test-no-install/app/index.tsx +19 -0
- package/test-no-install/app-env.d.ts +2 -0
- package/test-no-install/app.json +41 -0
- package/test-no-install/assets/adaptive-icon.png +0 -0
- package/test-no-install/assets/favicon.png +0 -0
- package/test-no-install/assets/icon.png +0 -0
- package/test-no-install/assets/splash.png +0 -0
- package/test-no-install/babel.config.js +13 -0
- package/test-no-install/cesconfig.json +35 -0
- package/test-no-install/components/Button.tsx +25 -0
- package/test-no-install/components/Container.tsx +9 -0
- package/test-no-install/components/EditScreenInfo.tsx +31 -0
- package/test-no-install/components/ScreenContent.tsx +29 -0
- package/test-no-install/components/nativewindui/ActivityIndicator.tsx +13 -0
- package/test-no-install/components/nativewindui/Avatar.tsx +133 -0
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.android.tsx +72 -0
- package/test-no-install/components/nativewindui/DatePicker/DatePicker.tsx +23 -0
- package/test-no-install/components/nativewindui/DatePicker/index.ts +1 -0
- package/test-no-install/components/nativewindui/Picker.tsx +42 -0
- package/test-no-install/components/nativewindui/ProgressIndicator.tsx +78 -0
- package/test-no-install/components/nativewindui/Sheet.tsx +52 -0
- package/test-no-install/components/nativewindui/Slider.tsx +26 -0
- package/test-no-install/components/nativewindui/Text.tsx +55 -0
- package/test-no-install/components/nativewindui/Toggle.tsx +20 -0
- package/test-no-install/global.css +3 -0
- package/test-no-install/metro.config.js +10 -0
- package/test-no-install/package.json +64 -0
- package/test-no-install/prettier.config.js +10 -0
- package/test-no-install/tailwind.config.js +14 -0
package/build/index.js
CHANGED
|
@@ -19,16 +19,21 @@ const main = async () => {
|
|
|
19
19
|
switch (process.argv[2]) {
|
|
20
20
|
case 'add':
|
|
21
21
|
const args = process.argv.slice(3);
|
|
22
|
+
let noInstall = false;
|
|
22
23
|
let bigExamplesWithDependencies = false;
|
|
23
24
|
let overwrite = false;
|
|
24
25
|
let ignoreExpoRouterMissing = false;
|
|
25
26
|
let directory = undefined;
|
|
26
|
-
while (['--big-examples-with-deps', '--overwrite', '--yes', '-d'].includes(args[0])) {
|
|
27
|
+
while (['--big-examples-with-deps', '--overwrite', '--yes', '-d', '--no-install'].includes(args[0])) {
|
|
27
28
|
switch (args[0]) {
|
|
28
29
|
case '--big-examples-with-deps':
|
|
29
30
|
bigExamplesWithDependencies = true;
|
|
30
31
|
args.shift();
|
|
31
32
|
break;
|
|
33
|
+
case '--no-install':
|
|
34
|
+
noInstall = true;
|
|
35
|
+
args.shift();
|
|
36
|
+
break;
|
|
32
37
|
case '--overwrite':
|
|
33
38
|
overwrite = true;
|
|
34
39
|
args.shift();
|
|
@@ -55,7 +60,7 @@ const main = async () => {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
// remaining args are components
|
|
58
|
-
await installComponent(args, overwrite, directory, bigExamplesWithDependencies, ignoreExpoRouterMissing);
|
|
63
|
+
await installComponent(args, overwrite, directory, bigExamplesWithDependencies, ignoreExpoRouterMissing, noInstall);
|
|
59
64
|
break;
|
|
60
65
|
case 'init':
|
|
61
66
|
const manualInstallationURL = `${env.API_BASE_URL}/installation/manual`;
|
|
@@ -76,7 +81,7 @@ const main = async () => {
|
|
|
76
81
|
break;
|
|
77
82
|
default:
|
|
78
83
|
console.log('Usage:');
|
|
79
|
-
console.log("\tadd [--overwrite] [-d directory] [--yes] [componentName | 'all' | 'free' | 'paid' | 'screens' [...]]");
|
|
84
|
+
console.log("\tadd [--overwrite] [-d directory] [--yes] [--no-install] [componentName | 'all' | 'free' | 'paid' | 'screens' [...]]");
|
|
80
85
|
console.log("\tinit");
|
|
81
86
|
console.log("\tlogin");
|
|
82
87
|
console.log("");
|
|
@@ -8,7 +8,7 @@ import { env } from './utils/env.js';
|
|
|
8
8
|
import * as git from './utils/git.js';
|
|
9
9
|
import { isLoggedIn, login } from './login.js';
|
|
10
10
|
import { confirmAsync } from './utils/prompts.js';
|
|
11
|
-
export const installComponent = async (slugs, overwrite = false, directory = `.${path.sep}`, bigExamplesWithDependencies = false, ignoreExpoRouterMissing = false) => {
|
|
11
|
+
export const installComponent = async (slugs, overwrite = false, directory = `.${path.sep}`, bigExamplesWithDependencies = false, ignoreExpoRouterMissing = false, noInstall = false) => {
|
|
12
12
|
const cwd = path.resolve(directory);
|
|
13
13
|
let spinner = ora({ text: 'Fetching component metadata...' });
|
|
14
14
|
spinner.start();
|
|
@@ -87,13 +87,52 @@ export const installComponent = async (slugs, overwrite = false, directory = `.$
|
|
|
87
87
|
const libs = Array.from(resolved.libraries).concat(Array.from(resolved.primitives));
|
|
88
88
|
if (libs.length > 0) {
|
|
89
89
|
try {
|
|
90
|
-
const
|
|
90
|
+
const npxArgs = ['expo', 'install'];
|
|
91
|
+
// conditionally for --no-install (see below)
|
|
92
|
+
let removePackageLock = false;
|
|
93
|
+
if (noInstall) {
|
|
94
|
+
npxArgs.push('--npm', ...libs, ...[
|
|
95
|
+
'--',
|
|
96
|
+
// prevent downloading & writing node_modules
|
|
97
|
+
'--package-lock-only',
|
|
98
|
+
'--no-package-lock',
|
|
99
|
+
// speed up invocation
|
|
100
|
+
'--silent',
|
|
101
|
+
'--no-audit',
|
|
102
|
+
'--progress=false',
|
|
103
|
+
]);
|
|
104
|
+
if (env.NODE_ENV === 'development') {
|
|
105
|
+
console.log('lockfile:', resolveNormalizedPath(cwd, 'package-lock.json'));
|
|
106
|
+
}
|
|
107
|
+
// some versions of npm will create/modify the lockfile with these args, others won't.
|
|
108
|
+
const packageLockExists = await fs.access(resolveNormalizedPath(cwd, 'package-lock.json'))
|
|
109
|
+
.then(() => true)
|
|
110
|
+
.catch(() => false);
|
|
111
|
+
// if a lockfile doesn't exist before we get started, delete it afterward.
|
|
112
|
+
// we do this because we don't know the user's preferred package manager.
|
|
113
|
+
if (!packageLockExists) {
|
|
114
|
+
removePackageLock = true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
npxArgs.push(...libs);
|
|
119
|
+
}
|
|
120
|
+
if (env.NODE_ENV === 'development')
|
|
121
|
+
console.log('> npx', npxArgs);
|
|
122
|
+
const install = await execa('npx', npxArgs, { cwd });
|
|
91
123
|
if (install.exitCode !== 0) {
|
|
92
124
|
console.log(install.all);
|
|
93
125
|
spinner.stop();
|
|
94
126
|
console.error('command:', install.command);
|
|
95
127
|
throw `npx expo install failed with exit code ${install.exitCode}`;
|
|
96
128
|
}
|
|
129
|
+
if (removePackageLock) {
|
|
130
|
+
// older versions of `npm` will not create a package-lock.json with the args provided,
|
|
131
|
+
// so we use `force: true` which does not throw if the deletion fails (and nothing else).
|
|
132
|
+
await fs.rm(resolveNormalizedPath(cwd, 'package-lock.json'), { force: true });
|
|
133
|
+
if (env.NODE_ENV === 'development')
|
|
134
|
+
console.log('deleted package-lock.json');
|
|
135
|
+
}
|
|
97
136
|
}
|
|
98
137
|
catch (err) {
|
|
99
138
|
if (err) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ScrollViewStyleReset } from "expo-router/html";
|
|
2
|
+
|
|
3
|
+
// This file is web-only and used to configure the root HTML for every
|
|
4
|
+
// web page during static rendering.
|
|
5
|
+
// The contents of this function only run in Node.js environments and
|
|
6
|
+
// do not have access to the DOM or browser APIs.
|
|
7
|
+
export default function Root({ children }: { children: React.ReactNode }) {
|
|
8
|
+
return (
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charSet="utf-8" />
|
|
12
|
+
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
|
|
13
|
+
|
|
14
|
+
{/*
|
|
15
|
+
This viewport disables scaling which makes the mobile website act more like a native app.
|
|
16
|
+
However this does reduce built-in accessibility. If you want to enable scaling, use this instead:
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
18
|
+
*/}
|
|
19
|
+
<meta
|
|
20
|
+
name="viewport"
|
|
21
|
+
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1.00001,viewport-fit=cover"
|
|
22
|
+
/>
|
|
23
|
+
{/*
|
|
24
|
+
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
|
|
25
|
+
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
|
|
26
|
+
*/}
|
|
27
|
+
<ScrollViewStyleReset />
|
|
28
|
+
|
|
29
|
+
{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
|
|
30
|
+
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
|
|
31
|
+
{/* Add any additional <head> elements that you want globally available on web... */}
|
|
32
|
+
</head>
|
|
33
|
+
<body>{children}</body>
|
|
34
|
+
</html>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const responsiveBackground = `
|
|
39
|
+
body {
|
|
40
|
+
background-color: #fff;
|
|
41
|
+
}
|
|
42
|
+
@media (prefers-color-scheme: dark) {
|
|
43
|
+
body {
|
|
44
|
+
background-color: #000;
|
|
45
|
+
}
|
|
46
|
+
}`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Link, Stack } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Text } from "react-native";
|
|
4
|
+
|
|
5
|
+
import { Container } from "~/components/Container";
|
|
6
|
+
|
|
7
|
+
export default function NotFoundScreen() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Stack.Screen options={{ title: "Oops!" }} />
|
|
11
|
+
<Container>
|
|
12
|
+
<Text className={styles.title}>This screen doesn't exist.</Text>
|
|
13
|
+
<Link href="/" className={styles.link}>
|
|
14
|
+
<Text className={styles.linkText}>Go to home screen!</Text>
|
|
15
|
+
</Link>
|
|
16
|
+
</Container>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const styles = {
|
|
22
|
+
title: `text-xl font-bold`,
|
|
23
|
+
link: `mt-4 pt-4`,
|
|
24
|
+
linkText: `text-base text-[#2e78b7]`,
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Stack, useLocalSearchParams } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Container } from "~/components/Container";
|
|
4
|
+
import { ScreenContent } from "~/components/ScreenContent";
|
|
5
|
+
|
|
6
|
+
export default function Details() {
|
|
7
|
+
const { name } = useLocalSearchParams();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<Stack.Screen options={{ title: "Details" }} />
|
|
12
|
+
<Container>
|
|
13
|
+
<ScreenContent
|
|
14
|
+
path="screens/details.tsx"
|
|
15
|
+
title={`Showing details for user ${name}`}
|
|
16
|
+
/>
|
|
17
|
+
</Container>
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Stack, Link } from "expo-router";
|
|
2
|
+
|
|
3
|
+
import { Button } from "~/components/Button";
|
|
4
|
+
import { Container } from "~/components/Container";
|
|
5
|
+
import { ScreenContent } from "~/components/ScreenContent";
|
|
6
|
+
|
|
7
|
+
export default function Home() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Stack.Screen options={{ title: "Home" }} />
|
|
11
|
+
<Container>
|
|
12
|
+
<ScreenContent path="app/index.tsx" title="Home"></ScreenContent>
|
|
13
|
+
<Link href={{ pathname: "/details", params: { name: "Dan" } }} asChild>
|
|
14
|
+
<Button title="Show Details" />
|
|
15
|
+
</Link>
|
|
16
|
+
</Container>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "no-install",
|
|
4
|
+
"slug": "no-install",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
|
|
7
|
+
"scheme": "no-install",
|
|
8
|
+
"web": {
|
|
9
|
+
"bundler": "metro",
|
|
10
|
+
"output": "static",
|
|
11
|
+
"favicon": "./assets/favicon.png"
|
|
12
|
+
},
|
|
13
|
+
"plugins": ["expo-router"],
|
|
14
|
+
"experiments": {
|
|
15
|
+
"typedRoutes": true,
|
|
16
|
+
|
|
17
|
+
"tsconfigPaths": true
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"orientation": "portrait",
|
|
21
|
+
"icon": "./assets/icon.png",
|
|
22
|
+
|
|
23
|
+
"userInterfaceStyle": "light",
|
|
24
|
+
|
|
25
|
+
"splash": {
|
|
26
|
+
"image": "./assets/splash.png",
|
|
27
|
+
"resizeMode": "contain",
|
|
28
|
+
"backgroundColor": "#ffffff"
|
|
29
|
+
},
|
|
30
|
+
"assetBundlePatterns": ["**/*"],
|
|
31
|
+
"ios": {
|
|
32
|
+
"supportsTablet": true
|
|
33
|
+
},
|
|
34
|
+
"android": {
|
|
35
|
+
"adaptiveIcon": {
|
|
36
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
37
|
+
"backgroundColor": "#ffffff"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cesVersion": "2.11.17",
|
|
3
|
+
"projectName": "no-install",
|
|
4
|
+
"packages": [
|
|
5
|
+
{
|
|
6
|
+
"name": "expo-router",
|
|
7
|
+
"type": "navigation",
|
|
8
|
+
"options": {
|
|
9
|
+
"type": "stack"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "nativewind",
|
|
14
|
+
"type": "styling"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"flags": {
|
|
18
|
+
"noGit": false,
|
|
19
|
+
"noInstall": true,
|
|
20
|
+
"overwrite": false,
|
|
21
|
+
"importAlias": true,
|
|
22
|
+
"packageManager": "npm",
|
|
23
|
+
"eas": false
|
|
24
|
+
},
|
|
25
|
+
"packageManager": {
|
|
26
|
+
"type": "npm",
|
|
27
|
+
"version": "10.8.1"
|
|
28
|
+
},
|
|
29
|
+
"os": {
|
|
30
|
+
"type": "Darwin",
|
|
31
|
+
"platform": "darwin",
|
|
32
|
+
"arch": "arm64",
|
|
33
|
+
"kernelVersion": "23.3.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { Text, TouchableOpacity, TouchableOpacityProps } from "react-native";
|
|
3
|
+
|
|
4
|
+
type ButtonProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
} & TouchableOpacityProps;
|
|
7
|
+
|
|
8
|
+
export const Button = forwardRef<TouchableOpacity, ButtonProps>(
|
|
9
|
+
({ title, ...touchableProps }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<TouchableOpacity
|
|
12
|
+
ref={ref}
|
|
13
|
+
{...touchableProps}
|
|
14
|
+
className={`${styles.button} ${touchableProps.className}`}
|
|
15
|
+
>
|
|
16
|
+
<Text className={styles.buttonText}>{title}</Text>
|
|
17
|
+
</TouchableOpacity>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const styles = {
|
|
23
|
+
button: "items-center bg-indigo-500 rounded-[28px] shadow-md p-4",
|
|
24
|
+
buttonText: "text-white text-lg font-semibold text-center",
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SafeAreaView } from "react-native";
|
|
2
|
+
|
|
3
|
+
export const Container = ({ children }: { children: React.ReactNode }) => {
|
|
4
|
+
return <SafeAreaView className={styles.container}>{children}</SafeAreaView>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const styles = {
|
|
8
|
+
container: "flex flex-1 p-6",
|
|
9
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Text, View } from "react-native";
|
|
2
|
+
|
|
3
|
+
export const EditScreenInfo = ({ path }: { path: string }) => {
|
|
4
|
+
const title = "Open up the code for this screen:";
|
|
5
|
+
const description =
|
|
6
|
+
"Change any of the text, save the file, and your app will automatically update.";
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<View>
|
|
10
|
+
<View className={styles.getStartedContainer}>
|
|
11
|
+
<Text className={styles.getStartedText}>{title}</Text>
|
|
12
|
+
<View
|
|
13
|
+
className={styles.codeHighlightContainer + styles.homeScreenFilename}
|
|
14
|
+
>
|
|
15
|
+
<Text>{path}</Text>
|
|
16
|
+
</View>
|
|
17
|
+
<Text className={styles.getStartedText}>{description}</Text>
|
|
18
|
+
</View>
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const styles = {
|
|
24
|
+
codeHighlightContainer: `rounded-md px-1`,
|
|
25
|
+
getStartedContainer: `items-center mx-12`,
|
|
26
|
+
getStartedText: `text-lg leading-6 text-center`,
|
|
27
|
+
helpContainer: `items-center mx-5 mt-4`,
|
|
28
|
+
helpLink: `py-4`,
|
|
29
|
+
helpLinkText: `text-center`,
|
|
30
|
+
homeScreenFilename: `my-2`,
|
|
31
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Text, View } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { EditScreenInfo } from "./EditScreenInfo";
|
|
4
|
+
|
|
5
|
+
type ScreenContentProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
path: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const ScreenContent = ({
|
|
12
|
+
title,
|
|
13
|
+
path,
|
|
14
|
+
children,
|
|
15
|
+
}: ScreenContentProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<View className={styles.container}>
|
|
18
|
+
<Text className={styles.title}>{title}</Text>
|
|
19
|
+
<View className={styles.separator} />
|
|
20
|
+
<EditScreenInfo path={path} />
|
|
21
|
+
{children}
|
|
22
|
+
</View>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
const styles = {
|
|
26
|
+
container: `items-center flex-1 justify-center`,
|
|
27
|
+
separator: `h-[1px] my-7 w-4/5 bg-gray-200`,
|
|
28
|
+
title: `text-xl font-bold`,
|
|
29
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import RNSlider from '@react-native-community/slider';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useColorScheme } from '~/lib/useColorScheme';
|
|
5
|
+
import { COLORS } from '~/theme/colors';
|
|
6
|
+
|
|
7
|
+
function Slider({
|
|
8
|
+
thumbTintColor,
|
|
9
|
+
minimumTrackTintColor,
|
|
10
|
+
maximumTrackTintColor,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentPropsWithoutRef<typeof RNSlider>) {
|
|
13
|
+
const { colors } = useColorScheme();
|
|
14
|
+
return (
|
|
15
|
+
<RNSlider
|
|
16
|
+
thumbTintColor={thumbTintColor ?? Platform.OS === 'ios' ? COLORS.white : colors.primary}
|
|
17
|
+
minimumTrackTintColor={minimumTrackTintColor ?? colors.primary}
|
|
18
|
+
maximumTrackTintColor={
|
|
19
|
+
maximumTrackTintColor ?? Platform.OS === 'android' ? colors.primary : undefined
|
|
20
|
+
}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Slider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Learn more https://docs.expo.io/guides/customizing-metro
|
|
2
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
3
|
+
|
|
4
|
+
const { withNativeWind } = require("nativewind/metro");
|
|
5
|
+
|
|
6
|
+
/** @type {import('expo/metro-config').MetroConfig} */
|
|
7
|
+
// eslint-disable-next-line no-undef
|
|
8
|
+
const config = getDefaultConfig(__dirname);
|
|
9
|
+
|
|
10
|
+
module.exports = withNativeWind(config, { input: "./global.css" });
|