Skip to content

Instantly share code, notes, and snippets.

@phpmaps
Created March 4, 2023 17:23
Show Gist options
  • Save phpmaps/09b55503d1c42a6650576018e8660b30 to your computer and use it in GitHub Desktop.
Save phpmaps/09b55503d1c42a6650576018e8660b30 to your computer and use it in GitHub Desktop.
Camera react-native-webview
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React from 'react';
import { WebView } from 'react-native-webview';
//https://simpl.info/getusermedia/sources/
//https://demo-onboarding.incodesmile.com/incode_internal310/flow/64023c3cabf419406093dab2?region=ALL
//https://davidwalsh.name/demo/camera.php
//https://incodetech-govcheck.s3.us-west-2.amazonaws.com/incode-camera-iframe.html
function App(): JSX.Element {
return (
<WebView
useWebKit
originWhitelist={['*']}
allowsInlineMediaPlayback
bounces={true}
mediaPlaybackRequiresUserAction={false}
mediaCapturePermissionGrantType="grantIfSameHostElsePrompt"
source={{
uri: 'https://incodetech-govcheck.s3.us-west-2.amazonaws.com/incode-camera-iframe.html'
}}
startInLoadingState
scalesPageToFit
javaScriptEnabledAndroid={true}
javaScriptEnabled={true}
style={{ flex: 1 }}
/>
)
}
export default App;
@phpmaps
Copy link
Author

phpmaps commented Mar 4, 2023


<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>


@phpmaps
Copy link
Author

phpmaps commented Mar 4, 2023

This project was created using the react-native-community CLI, @react-native-community/cli.

npx react-native init camera

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment