- add app.json, set the newest sdkVersion
{
"name": "<yourname>",
"displayName": "<yourname>",
"expo": {
"sdkVersion": "25.0.0"
}
}
- add to package.json, something:
"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz" // according to package.json's sdkVersion
- add to index.ts:
import { KeepAwake, registerRootComponent } from 'expo';
import { App } from './app';
if (__DEV__) {
KeepAwake.activate();
}
registerRootComponent(App);
- add to app.tsx
import { Font } from 'expo';
interface AppProps {
dispatch: Dispatch<any>;
nav: NavigationState;
}
export class App extends Component<AppProps> {
constructor(props: any) {
super(props)
this.state = {
isFontLoaded: false
};
}
public componentDidMount() {
Font.loadAsync({
'<customFontName>': require('../assets/fonts/<customFontName>.ttf')
}).then(() => this.setState({ isFontLoaded: true }));
}
public render() {
return (this.state as any).isFontLoaded ? <App /> : null;
}
}
npm i expo
npm i exponent
exp start
- Enjoy
You may put it the playground and see the output:
https://www.typescriptlang.org/play?#code/C4TwDgpgBAIglgZzAQ2AYwBYB4AqA+KAXigG8BfAKFEigDlkA3OAc1TgHsA7AZWFWmLkKaADbIECKAGF2AWzBcInYLgJCKcZRABOAM2RpoAQTBgACtvZhJJClCgATRCnQYAXLGepMWZJxB4ANx2UJyMHvRMrMAcPHzAEMGUFBAAHgrawFCi4pImYFBpCZwOkjLyispY+RZWCGohaFwIwNoArmjA7NoAFGCW1h5+IACUpCH2CG2Qvf11IxNQwBiIAHQt-ETj9jtQiABiXMAAMuzIDhAOHvoiCBCLZMH2lPZgbQBGInBo2XIKnEpgPAHABZdhtZQ9Ma2XaHZSrERnBxGBAgThoHow3ZQADkWDQbRacjhwHosggeBxHm0EAAjm04DSejjVqsAPS5CDABBs3RHHn4wldWQkskU1bAYC6HELXZkEYSjBKHpQogEZZrO7AXj8TF7BAk07nS4eVptaDykZPKDJV4fL4-GklHSqrH2GnANraThQHoahDreLQcRQYYKg5HI0XBxQAD8UGqpigbIIHk4bREImtlDIQA