Skip to content

Commit b852821

Browse files
committed
fix: granite
1 parent e1d5a4f commit b852821

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

packages/react-native/src/app/Granite.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { AppRoot } from './AppRoot';
77
import { HostAppRoot } from './HostAppRoot';
88
import { getSchemeUri } from '../constant-bridges';
99
import { setupPolyfills } from '../polyfills';
10-
import { resolveInitialScheme } from './resolveInitialScheme';
1110

1211
export interface GraniteProps {
1312
/**
@@ -32,7 +31,7 @@ export interface GraniteProps {
3231
* @description
3332
* The initial scheme of the app.
3433
*/
35-
initialScheme?: string;
34+
initialScheme?: string | (() => string);
3635

3736
/**
3837
* @description
@@ -64,7 +63,7 @@ const createApp = () => {
6463
}
6564

6665
return {
67-
registerApp(
66+
registerApp(
6867
AppContainer: ComponentType<PropsWithChildren<InitialProps>>,
6968
{ appName, context, router, initialScheme, setIosSwipeGestureEnabled, getInitialUrl }: GraniteProps
7069
): (initialProps: InitialProps) => JSX.Element {
@@ -73,15 +72,13 @@ const createApp = () => {
7372
}
7473

7574
function Root(initialProps: InitialProps) {
75+
const initialSchemeValue = (typeof initialScheme === 'function' ? initialScheme() : initialScheme) ?? getSchemeUri();
76+
7677
return (
7778
<AppRoot
7879
container={AppContainer}
7980
initialProps={initialProps}
80-
initialScheme={resolveInitialScheme({
81-
initialPropsScheme: initialProps.scheme,
82-
initialScheme,
83-
getSchemeUri,
84-
})}
81+
initialScheme={initialSchemeValue}
8582
setIosSwipeGestureEnabled={setIosSwipeGestureEnabled}
8683
getInitialUrl={getInitialUrl}
8784
appName={appName}

0 commit comments

Comments
 (0)