Don't allow camera and mic permissions by default. Notify user about permission request

This commit is contained in:
Volodymyr Kozieiev
2020-08-03 11:18:45 +03:00
parent 3bef57fcf8
commit f7a3d58b2f
23 changed files with 264 additions and 78 deletions
+14
View File
@@ -10,6 +10,7 @@ import {
Platform,
} from 'react-native';
import Permission from './examples/Permission';
import Alerts from './examples/Alerts';
import Scrolling from './examples/Scrolling';
import Background from './examples/Background';
@@ -19,6 +20,14 @@ import Injection from './examples/Injection';
import LocalPageLoad from './examples/LocalPageLoad';
const TESTS = {
Permission: {
title: 'Permission',
testId: 'permission',
description: 'Permission tests',
render() {
return <Permission />;
},
},
Alerts: {
title: 'Alerts',
testId: 'alerts',
@@ -113,6 +122,11 @@ export default class App extends Component<Props, State> {
</TouchableOpacity>
<View style={styles.testPickerContainer}>
<Button
testID="testType_permission"
title="Permission"
onPress={() => this._changeTest('Permission')}
/>
<Button
testID="testType_alerts"
title="Alerts"
+27
View File
@@ -0,0 +1,27 @@
import React, {Component} from 'react';
import {Text, View} from 'react-native';
import WebView from 'react-native-webview';
type Props = {};
type State = {};
export default class Permission extends Component<Props, State> {
state = {};
render() {
return (
<View style={{ height: 120 }}>
<WebView
ref={(ref) => (this.webview = ref)}
onPermissionRequest={(event) => {
console.log("!!! JS: onPermissionRequest, event: ", event.nativeEvent);
this.webview.answerPermissionRequest(false, event.nativeEvent.resources );
}}
source={{uri: 'https://fatal0.netlify.app/android/webviewvideo.html'}}
automaticallyAdjustContentInsets={false}
/>
</View>
);
}
}