Skip to content

Commit

Permalink
upgrade testflight demo with bottom-tabs and move to apps folder
Browse files Browse the repository at this point in the history
  • Loading branch information
natew committed Oct 24, 2024
1 parent c7d3bf6 commit e7f2113
Show file tree
Hide file tree
Showing 56 changed files with 118 additions and 81 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
import { Tabs } from 'one'
import { NativeTabs } from '../layouts/BottomTabs'
import { HomeIcons } from './HomeIcons'
import { useTheme } from 'tamagui'

export function HomeLayout() {
const theme = useTheme()

return (
<Tabs
screenOptions={{
headerShown: false,
tabBarActiveTintColor: theme.accentColor.val,
tabBarInactiveTintColor: theme.gray9.val,
}}
>
<Tabs.Screen
<NativeTabs>
<NativeTabs.Screen
name="index"
options={{
title: 'Feed',
tabBarIcon: ({ color }) => <HomeIcons.Home size={20} color={color} />,
}}
/>

<Tabs.Screen
<NativeTabs.Screen
name="notifications"
options={{
title: 'Notifications',
tabBarIcon: ({ color }) => <HomeIcons.Notifications size={20} color={color} />,
}}
/>

<Tabs.Screen
<NativeTabs.Screen
name="profile"
options={{
title: 'Profile',
tabBarIcon: ({ color }) => <HomeIcons.User size={20} color={color} />,
}}
/>
</Tabs>
</NativeTabs>
)
}
File renamed without changes.
18 changes: 18 additions & 0 deletions apps/testflight/code/layouts/BottomTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { withLayoutContext } from 'one'
import {
createNativeBottomTabNavigator,
type NativeBottomTabNavigationEventMap,
} from 'react-native-bottom-tabs/react-navigation'

import type { BottomTabNavigationOptions } from '@react-navigation/bottom-tabs'

import type { ParamListBase, TabNavigationState } from '@react-navigation/native'

const { Navigator } = createNativeBottomTabNavigator()

export const NativeTabs = withLayoutContext<
BottomTabNavigationOptions,
typeof Navigator,
TabNavigationState<ParamListBase>,
NativeBottomTabNavigationEventMap
>(Navigator)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
"drizzle-kit": "^0.24.2",
"drizzle-orm": "^0.33.0",
"expo": "~51.0.28",
"expo-build-properties": "^0.12.5",
"expo-modules-core": "^1.12.24",
"one": "1.1.325",
"postgres": "^3.4.4",
"react": "^18.3.1",
"react-native": "0.74.5",
"react-native-bottom-tabs": "0.0.12",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export default {
},
}),

tamaguiPlugin({
optimize: true,
components: ['tamagui'],
config: './config/tamagui.config.ts',
outputCSS: './code/styles/tamagui.css',
}),
// tamaguiPlugin({
// optimize: true,
// components: ['tamagui'],
// config: './config/tamagui.config.ts',
// outputCSS: './code/styles/tamagui.css',
// }),
],
} satisfies UserConfig
28 changes: 21 additions & 7 deletions packages/one/src/vite/one.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ events.setMaxListeners(1_000)
globalThis.__vxrnEnableNativeEnv = true

export function one(options: One.PluginOptions = {}): PluginOption {
console.trace('??????????????')

oneOptions = options

// ensure tsconfig
Expand All @@ -52,6 +54,10 @@ export function one(options: One.PluginOptions = {}): PluginOption {

const { clientEnvDefine } = loadEnv(vxrnOptions?.mode ?? 'development')

const disableDepsPreBundle = options.ssr?.disableAutoDepsPreBundling

console.log('wtf', !!disableDepsPreBundle)

const devAndProdPlugins = [
{
name: 'one-define-env',
Expand All @@ -62,13 +68,10 @@ export function one(options: One.PluginOptions = {}): PluginOption {
},
},

...(options.ssr?.disableAutoDepsPreBundling
? []
: [
autoPreBundleDepsForSsrPlugin({
root: vxrnOptions?.root || process.cwd(),
}),
]),
autoPreBundleDepsForSsrPlugin({
root: vxrnOptions?.root || process.cwd(),
disable: !!disableDepsPreBundle,
}),

// proxy because you cant add a plugin inside a plugin
new Proxy(
Expand Down Expand Up @@ -142,6 +145,15 @@ export function one(options: One.PluginOptions = {}): PluginOption {
},
},

{
name: 'one-react-native-web',
enforce: 'pre',

resolveId(id) {
console.log('resolve?', id)
},
},

{
name: 'one:init-config',

Expand Down Expand Up @@ -251,6 +263,8 @@ export function one(options: One.PluginOptions = {}): PluginOption {
} satisfies Plugin,
] satisfies Plugin[]

console.trace('gogogogo')

// TODO make this passed into vxrn through real API
globalThis.__vxrnAddNativePlugins = [clientTreeShakePlugin()]
globalThis.__vxrnAddWebPluginsProd = devAndProdPlugins
Expand Down
13 changes: 12 additions & 1 deletion packages/vxrn/src/plugins/autoPreBundleDepsForSsrPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ import type { Plugin } from 'vite'
import { EXCLUDE_LIST, scanDepsToPreBundleForSsr } from '../utils/scanDepsToPreBundleForSsr'
import { getFileHash, lookupFile } from '../utils/utils'

export function autoPreBundleDepsForSsrPlugin({ root }: { root: string }) {
export function autoPreBundleDepsForSsrPlugin({
root,
disable,
}: { root: string; disable?: boolean }) {
console.trace('start123')

if (disable) {
return {
name: 'vxrn:auto-pre-bundle-deps-for-ssr',
}
}

return {
name: 'vxrn:auto-pre-bundle-deps-for-ssr',
enforce: 'pre',
Expand Down
4 changes: 1 addition & 3 deletions packages/vxrn/src/utils/scanDepsToPreBundleForSsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ export async function scanDepsToPreBundleForSsr(
const currentRoot = path.dirname(packageJsonPath)

const pkgJson = pkgJsonContent || (await readPackageJsonSafe(packageJsonPath))
const deps = [
...Object.keys(pkgJson.dependencies || {}),
]
const deps = [...Object.keys(pkgJson.dependencies || {})]

return (
await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export declare function autoPreBundleDepsForSsrPlugin({ root }: {
export declare function autoPreBundleDepsForSsrPlugin({ root, disable, }: {
root: string;
disable?: boolean;
}): {
name: string;
enforce?: undefined;
config?: undefined;
} | {
name: string;
enforce: "pre";
config(this: void, _cfg: import("vite").UserConfig, env: import("vite").ConfigEnv): Promise<{
Expand Down
94 changes: 46 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2068,14 +2068,14 @@ __metadata:
languageName: node
linkType: hard

"@docsearch/css@npm:3.6.1, @docsearch/css@npm:^3.6.1":
"@docsearch/css@npm:3.6.1":
version: 3.6.1
resolution: "@docsearch/css@npm:3.6.1"
checksum: 10/9afddf93797d85519e18ba7b747a1dc7e2a7e46d5530180fbb890657bcf77039bd728e435a82b143363da6f05d4bb993a000963ac41491c60725874b55ccc696
languageName: node
linkType: hard

"@docsearch/css@npm:3.6.2":
"@docsearch/css@npm:3.6.2, @docsearch/css@npm:^3.6.1":
version: 3.6.2
resolution: "@docsearch/css@npm:3.6.2"
checksum: 10/630a26b7a570cb8c04becad769d32be5371a37d0cde1f72114e4d37d4890ea228b6e04fa0ee4bc6f37653773ddaa9bab09ba887ccd2a95ed2b6d0ac43a48b7ac
Expand Down Expand Up @@ -7940,17 +7940,7 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:*":
version: 18.3.6
resolution: "@types/react@npm:18.3.6"
dependencies:
"@types/prop-types": "npm:*"
csstype: "npm:^3.0.2"
checksum: 10/ba0d337244347ecbf921de174d9db9bb80b03d41ad3ae7aa65500b3339925852c97e501d7657b5cd629ffed9f7fe3820a63069847e7b8529e4d02934d0f182e9
languageName: node
linkType: hard

"@types/react@npm:^18.2.24":
"@types/react@npm:*, @types/react@npm:^18.2.24, @types/react@npm:^18.3.11":
version: 18.3.12
resolution: "@types/react@npm:18.3.12"
dependencies:
Expand All @@ -7960,16 +7950,6 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.3.11":
version: 18.3.11
resolution: "@types/react@npm:18.3.11"
dependencies:
"@types/prop-types": "npm:*"
csstype: "npm:^3.0.2"
checksum: 10/a36f0707fdfe9fe19cbe5892bcdab0f042ecadb501ea4e1c39519943f3e74cffbd31e892d3860f5c87cf33f5f223552b246a552bed0087b95954f2cb39d5cf65
languageName: node
linkType: hard

"@types/resolve@npm:1.20.2":
version: 1.20.2
resolution: "@types/resolve@npm:1.20.2"
Expand Down Expand Up @@ -8753,7 +8733,7 @@ __metadata:
languageName: node
linkType: hard

"ajv@npm:^8.0.1":
"ajv@npm:^8.0.1, ajv@npm:^8.11.0":
version: 8.17.1
resolution: "ajv@npm:8.17.1"
dependencies:
Expand Down Expand Up @@ -12235,9 +12215,9 @@ __metadata:
languageName: unknown
linkType: soft

"example-testflight@workspace:examples/testflight":
"example-testflight@workspace:apps/testflight":
version: 0.0.0-use.local
resolution: "example-testflight@workspace:examples/testflight"
resolution: "example-testflight@workspace:apps/testflight"
dependencies:
"@biomejs/biome": "npm:^1.8.3"
"@dotenvx/dotenvx": "npm:^1.12.1"
Expand All @@ -12252,11 +12232,13 @@ __metadata:
drizzle-kit: "npm:^0.24.2"
drizzle-orm: "npm:^0.33.0"
expo: "npm:~51.0.28"
expo-build-properties: "npm:^0.12.5"
expo-modules-core: "npm:^1.12.24"
one: "npm:1.1.325"
postgres: "npm:^3.4.4"
react: "npm:^18.3.1"
react-native: "npm:0.74.5"
react-native-bottom-tabs: "npm:0.0.12"
react-native-reanimated: "npm:~3.10.1"
react-native-safe-area-context: "npm:4.10.5"
react-native-screens: "npm:3.31.1"
Expand Down Expand Up @@ -12368,6 +12350,18 @@ __metadata:
languageName: unknown
linkType: soft

"expo-build-properties@npm:^0.12.5":
version: 0.12.5
resolution: "expo-build-properties@npm:0.12.5"
dependencies:
ajv: "npm:^8.11.0"
semver: "npm:^7.6.0"
peerDependencies:
expo: "*"
checksum: 10/22a1c3fbe6ef00efe13976612766c665390df033d84203bb8d8133fec5d9291be333341119f35b4f5e60932b5829e9ac10c7aaa1a28cbfb5fa689b1b7917229a
languageName: node
linkType: hard

"expo-camera@npm:^15.0.16":
version: 15.0.16
resolution: "expo-camera@npm:15.0.16"
Expand Down Expand Up @@ -18318,6 +18312,23 @@ __metadata:
languageName: node
linkType: hard

"react-native-bottom-tabs@npm:0.0.12":
version: 0.0.12
resolution: "react-native-bottom-tabs@npm:0.0.12"
dependencies:
sf-symbols-typescript: "npm:^2.0.0"
use-latest-callback: "npm:^0.2.1"
peerDependencies:
"@react-navigation/native": ">=6"
react: "*"
react-native: "*"
peerDependenciesMeta:
"@react-navigation/native":
optional: true
checksum: 10/51cbc716a7efd6df10d516f58c120339fbb93da22daee984d7b97ab2d101c2232f29186e54558e193627c089e3bad2c6a5871f6c6af91cafc4a8d72dec248196
languageName: node
linkType: hard

"react-native-gesture-handler@npm:^2.18.1":
version: 2.19.0
resolution: "react-native-gesture-handler@npm:2.19.0"
Expand Down Expand Up @@ -19557,6 +19568,13 @@ __metadata:
languageName: node
linkType: hard

"sf-symbols-typescript@npm:^2.0.0":
version: 2.0.0
resolution: "sf-symbols-typescript@npm:2.0.0"
checksum: 10/dde81c01265bdff16f527e1242af03793460c3c5f34ca6950ab1ca73a3bccd54ebabfcd56961658e72f94baac06ad620134a0bc03b0674dd543d4883c7d5e18f
languageName: node
linkType: hard

"shallow-clone@npm:^3.0.0":
version: 3.0.1
resolution: "shallow-clone@npm:3.0.1"
Expand Down Expand Up @@ -21007,7 +21025,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.2.2":
"typescript@npm:^5.2.2, typescript@npm:^5.5.2, typescript@npm:^5.6.2":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
bin:
Expand All @@ -21017,17 +21035,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.5.2, typescript@npm:^5.6.2":
version: 5.6.2
resolution: "typescript@npm:5.6.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/f95365d4898f357823e93d334ecda9fcade54f009b397c7d05b7621cd9e865981033cf89ccde0f3e3a7b73b1fdbae18e92bc77db237b43e912f053fef0f9a53b
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.2.2#optional!builtin<compat/typescript>":
"typescript@patch:typescript@npm%3A^5.2.2#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.5.2#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.6.2#optional!builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin<compat/typescript>::version=5.6.3&hash=8c6c40"
bin:
Expand All @@ -21037,16 +21045,6 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.5.2#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.6.2#optional!builtin<compat/typescript>":
version: 5.6.2
resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>::version=5.6.2&hash=8c6c40"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/8bfc7ca0d9feca4c3fcbd6c70741abfcd714197d6448e68225ae71e462447d904d3bfba49759a8fbe4956d87f054e2d346833c8349c222daa594a2626d4e1be8
languageName: node
linkType: hard

"ua-parser-js@npm:^1.0.35":
version: 1.0.39
resolution: "ua-parser-js@npm:1.0.39"
Expand Down

0 comments on commit e7f2113

Please sign in to comment.