Flow Promise This type is incompatible with undefined undefined
Get a warning
in line:
Use Flow.js v.0.48.0. Sample code:
...
import { Font, AppLoading } from 'expo';
...
export default class App extends Component {
async componentDidMount() {
await Font.loadAsync(fontsStore);
...
}
...
}
+3
Bohdan pomohaibo
source
to share
2 answers
Found solution for the hack:
...
componentDidMount() {
this.loadFonts();
}
async loadFonts () {
await Font.loadAsync(fontsStore);
this.setState({ fontLoaded: true });
}
...
+3
Bohdan pomohaibo
source
to share
Async is for losers ... it's a promise, so just implement then
and head out to dinner. :)
componentDidMount () {
Font.loadAsync({
'open-sans-bold': require('./assets/fonts/OpenSans-Bold.ttf'),
}).then(() => this.setState({fontLoaded: true}))
}
-4
hcatlin
source
to share