Closed
Labels
Resolution: LockedThis 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.
Activity
hramos commentedon Aug 3, 2017
This issue looks like a question that would be best asked on StackOverflow.
StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.
Will close this as this is really a question that should be asked on StackOverflow.