@@ -7,7 +7,6 @@ import { AppRoot } from './AppRoot';
77import { HostAppRoot } from './HostAppRoot' ;
88import { getSchemeUri } from '../constant-bridges' ;
99import { setupPolyfills } from '../polyfills' ;
10- import { resolveInitialScheme } from './resolveInitialScheme' ;
1110
1211export 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