Hello!
I just need some help.
The project was created with expo-cli in bare workflow yesterday.
What I do -
in MainComponent
import { AppLoading, Linking } from 'expo';
...some component code
async componentDidMount(): Promise<void> {
...some code
Linking.addEventListener('url', this.handleDeepLinks);
...some other code
}
...
handleDeepLinks = (event: object): void => {
const loginUrl = Linking.makeUrl('/login?');
if (event.url.includes(loginUrl)) {
const { loginWithToken } = this.props.actions;
const cleanUrl = event.url.replace(Linking.makeUrl('/login?'), '');
const { auth_token, client_id, expiry, uid } = qs.parse(cleanUrl);
loginWithToken(auth_token, client_id, expiry, uid.split('#')[0]);
}
};
...
render() {
if (!this.state.isLoadingComplete) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this.handleLoadingError}
onFinish={this.handleFinishLoading}
autoHideSplash={false}
/>
);
} else {
return (
<Fragment>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
<AppNavigator uriPrefix={Linking.makeUrl('/')} /> // error occurs here
</Fragment>
);
}
}
AppLoading threw an unexpected error when loading:
TypeError: Cannot read property 'scheme' of null
at Linking.makeUrl (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:108259:35)
at MainComponent.render (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:118696:38)
at finishClassComponent (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:22009:37)
at updateClassComponent (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:21972:30)
at beginWork$1 (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:23250:22)
at Object.invokeGuardedCallbackImpl (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:13249:16)
at invokeGuardedCallback (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:13345:37)
at beginWork$$1 (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:27466:13)
at performUnitOfWork (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26604:18)
at workLoopSync (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:26586:28)
After trying to debug it I found that in makeUrl
function manifest
is null
which imports from expo-constants
import Constants from 'expo-constants';
...
const { manifest } = Constants;
...
function makeUrl() {
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var queryParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var scheme = 'exp';
var manifestScheme = manifest.scheme || manifest.detach && manifest.detach.scheme; // error occurs here
...
}
What am I doing wrong?