forked from timothymiller/t4-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Android API & Image access in localhost + Fixed list margin on na…
…tive + Fixed bun usage in EAS context
- Loading branch information
Timothy Miller
committed
Nov 2, 2023
1 parent
09fd312
commit 921e23e
Showing
9 changed files
with
64 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,16 @@ | |
"main": "index.js", | ||
"private": true, | ||
"scripts": { | ||
"ios": "expo run:ios", | ||
"android": "cross-env TAMAGUI_TARGET=native expo run:android", | ||
"dev": "cross-env TAMAGUI_TARGET=native expo start --dev-client", | ||
"dev:prod": "cross-env TAMAGUI_TARGET=native expo start --no-dev --minify", | ||
"prebuild": "cross-env TAMAGUI_TARGET=native expo prebuild", | ||
"build:ios:preview": " eas build --platform ios --profile preview --local", | ||
"build:android:preview": "eas build --platform android --profile preview --local", | ||
"build:ios": " eas build --platform ios --profile production --local", | ||
"build:android": "eas build --platform android --profile production --local", | ||
"clean": "git clean -xdf .expo node_modules ios android", | ||
"eas-build-pre-install": "npm install -g [email protected]" | ||
"ios": "cross-env TAMAGUI_TARGET=native bun expo run:ios", | ||
"android": "cross-env TAMAGUI_TARGET=native bun expo run:android", | ||
"dev": "cross-env TAMAGUI_TARGET=native bun expo start --dev-client", | ||
"dev:prod": "cross-env TAMAGUI_TARGET=native bun expo start --no-dev --minify", | ||
"prebuild": "cross-env TAMAGUI_TARGET=native bun expo prebuild", | ||
"build:ios:preview": "bun eas build --platform ios --profile preview --local", | ||
"build:android:preview": "bun eas build --platform android --profile preview --local", | ||
"build:ios": "bun eas build --platform ios --profile production --local", | ||
"build:android": "bun eas build --platform android --profile production --local", | ||
"clean": "git clean -xdf .expo node_modules ios android" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.23.2", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { replaceLocalhost } from 'app/utils/trpc/localhost.native' | ||
import { SolitoImageProvider as SolitoImageProviderOG } from 'solito/image' | ||
|
||
const imageURL = process.env.NEXT_PUBLIC_APP_URL | ||
export const getImageUrl = () => { | ||
const imageUrl = `${process.env.NEXT_PUBLIC_APP_URL}` | ||
return replaceLocalhost(imageUrl) | ||
} | ||
|
||
export const SolitoImageProvider = ({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}): React.ReactNode => { | ||
return <SolitoImageProviderOG nextJsURL={imageURL as `http:${string}` | `https:${string}`}>{children}</SolitoImageProviderOG> | ||
return ( | ||
<SolitoImageProviderOG nextJsURL={getImageUrl() as `http:${string}` | `https:${string}`}> | ||
{children} | ||
</SolitoImageProviderOG> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
export function formatNumber(x: number): string { | ||
return x.toLocaleString('en-US') | ||
}; | ||
} | ||
|
||
export function formatPrice(price: number): string { | ||
return price.toLocaleString('en-US', { | ||
style: 'currency', | ||
currency: 'USD', | ||
maximumFractionDigits: 0, | ||
}) | ||
}; | ||
const formatter = new Intl.NumberFormat('en-US', { | ||
style: 'currency', | ||
currency: 'USD', | ||
minimumFractionDigits: 0, | ||
maximumFractionDigits: 0, | ||
}) | ||
|
||
export function formatPrice(number) { | ||
if (typeof number !== 'number' || isNaN(number) || !isFinite(number)) { | ||
throw new Error('Invalid number value') | ||
} | ||
|
||
return formatter.format(number) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Constants from 'expo-constants' | ||
|
||
let localhost: string | undefined | ||
const PROTOCOL = 'http:' | ||
const localhostRegex = new RegExp(`${PROTOCOL}\/\/localhost:`, 'g') | ||
|
||
export function getLocalhost() { | ||
if (localhost !== undefined) { | ||
return localhost | ||
} | ||
const debuggerHost = Constants.expoConfig?.hostUri | ||
localhost = debuggerHost?.split(':')[0] ?? 'localhost' | ||
return localhost | ||
} | ||
|
||
export function replaceLocalhost(address: string) { | ||
return address.replace(localhostRegex, () => `${PROTOCOL}//${getLocalhost()}:`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
921e23e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔ EAS production build completed