Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed App.js Bug #521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions with-tfjs-camera/App.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { Camera } from "expo-camera";
import { useCameraPermissions } from "expo-camera";
import React from "react";
import { Button } from 'react-native';
import { Button, View, Text } from 'react-native';

import { LoadingView } from "./src/LoadingView";
import { ModelView } from "./src/ModelView";
import { useTensorFlowLoaded } from "./src/useTensorFlow";

export default function App() {
const isLoaded = useTensorFlowLoaded();
const [permission, requestPermission] = Camera.useCameraPermissions();
const [permission, requestPermission] = useCameraPermissions();

if (!permission?.granted) {
if (!permission) {
return <View><Text>Loading Camera Permissions...</Text></View>;
}

if (!permission.granted) {
return (
<LoadingView message="Camera permission is required to continue">
<Button title="Grant permission" onPress={requestPermission} />
</LoadingView>
);
}

if (!isLoaded) {
return <LoadingView message="Loading TensorFlow" />;
}
Expand Down