Closed
Description
I'm new at react native and typescript.I wanna create permissions module for my react native project and I seperated two links at below Yonah's project and Facebook's permissions project
Additionaly
npm install ,npm start , yarn run build --watch and react-native run-android
command running smoothly but permission module dont use it ,I dont present this module add my project.
And my trying link at below ;
const permission = require('react-native-permissions')
import React from 'react'
import {
StyleSheet,
TouchableHighlight,
Text,
View,
Alert,
AppState,
Platform,
PermissionsAndroid,
} from 'react-native'
interface Props {
names: string[]
}
interface PermissionsState {
status: PermissionStatus
}
type PermissionStatus = 'granted' | 'denied' | 'never_ask_again' | ''
export class permissions extends React.Component<Props, PermissionsState>
{
constructor(props: Props, context: any)
// tslint:disable-next-line:brace-style
{
super(props, context)
this.state = {
status: '',
}
}
public render()
// tslint:disable-next-line:brace-style
{
return (<View> a </View>)
}
}
async function requestCameraPermission() {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.CAMERA,
)
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
// console.log("kamerayı kullanabilirsiniz")
} else {
// console.log('kamerayı kullanamazsınız')
}
} catch (err) {
// console.warn(err)
}
}
export default permission