-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
46 lines (41 loc) · 1.21 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React, { Component } from "react";
import { StyleSheet, View } from "react-native";
import { AppLoading } from "expo";
import { Appbar } from "react-native-paper";
import * as tf from "@tensorflow/tfjs";
import "@tensorflow/tfjs-react-native";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import MainScreen from "./src/components/MainScreen";
const styles = StyleSheet.create({
container: { flex: 1 },
title: { textAlign: "center" },
cardActions: { justifyContent: "space-around" },
});
export default class App extends Component {
state = {
isTfReady: false,
};
prepApp = async () => await tf.ready();
setAppReady = () => this.setState({ isTfReady: true });
render() {
if (!this.state.isTfReady) {
return (
<AppLoading
startAsync={this.prepApp}
onFinish={this.setAppReady}
onError={console.warn}
/>
);
}
return (
<View style={styles.container}>
<Appbar.Header>
<Appbar.Content title="MobileNet" titleStyle={styles.title} />
</Appbar.Header>
<KeyboardAwareScrollView>
<MainScreen />
</KeyboardAwareScrollView>
</View>
);
}
}