-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
I'm new to react native. I wrote the following code to call a function, if a user clicks on a camera.In addition I've a camera module how to call camera module on this partition at code.Code is run but it is call function while project starting,I want to click camera button and ask user camera options allow or deny question.I referenced yonahfrostproject esspecially example.js file I focused on but I don't understand it.
render () {
return (<TouchableOpacity onPress={this.openCamera}>
<View> ??? </View>
</TouchableOpacity>
)
}
Plus my full code is here;
const permission = require('react-native-permissions')
import React , { Component } from 'react'
import {
StyleSheet,
TouchableHighlight,
Text,
View,
Alert,
AppState,
Platform,
AppRegistry,
Button,
TouchableOpacity,
} from 'react-native'
interface Props {
names: string[]
}
interface PermissionsState {
status: PermissionStatus
}
type PermissionStatus = 'granted' | 'denied' | 'never_ask_again' | ''
class Permissions {
static request(arg0: any): any {
throw new Error('Method not implemented.')
}
static RESULTS: any
static PERMISSIONS: any
openCamera: any
public async requestCameraPermission() {
try {
const granted = await Permissions.request(
Permissions.PERMISSIONS.CAMERA,
)
if (granted === Permissions.RESULTS.GRANTED) {
// console.log("kamerayı kullanabilirsiniz")
} else {
// console.log('kamerayı kullanamazsınız')
}
} catch (err) {
// console.warn(err)
}
}
render () {
return (<TouchableOpacity onPress={this.openCamera}>
<View> <Text>openCamera</Text> </View>
</TouchableOpacity>
)
}
}
export default new Permissions()
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.