React Native Qr code and camera not working properly in IOS - react-native

I am using react-native-camera and react-native-qrcode-scanner libraries for scanning qr codes in my app. In android I have tested this and it was working fine, but in IOS I am facing lot of issues. The camera opens successfully on first attempt but after scanning the camera gets freezes and then a blank screen appears instead of camera. I have also given permissions in info.plist file in Xcode related to camera. Here is the code for the QRcode scan which I am using in the app
render() {
return (
<View>
<QRCodeScanner
onRead={this.onSuccess.bind(this)}
showMarker={true}
/>
</View>
);
}
Current versions in my app -
react-native - 0.57.5
react-native-camera - 1.10.1
react-native-qr-code-scanner - 1.1.2
Any answer or suggestions would be helpful to me Thanks.

Related

Open image folder from device simulator in react native

I am using react native with android studio simulature (Device). I want to create a button "search image" which opens the folder of the images of the device used as a simulator. Come I can i do? Then after selecting an image from the device images folder, I want to open it in react native and transfer the image to base64.I know thant react native fetch blob is deprecated. How can i do?
<View>
<Button title="search image"></Button>
</View>

display video in react native project with expo

Im trying to display a video on screen in my react native project (with expo).
I put the video inside the project, and I see the message :
The file is not displayed in the editor because it is either binary or uses an unsupported text encoding
How can I resolve this issue?
As sidverma pointed out, this is a VS Code related error.
You cannot open large files inside the editor as it might crash.
I remember opening large bin files a long time ago with other editors and it would freeze my computer!
Anyhow, you can still use that file inside your React Native application. This is just your editor being careful about opening large files.
If want to use Video in react-native take help of this library: react-native-video
import Video from "react-native-video";
<View>
<Video
source={require("./../assets/video1.mp4")}
style={styles.backgroundVideo}
muted={true}
repeat={true}
resizeMode={"cover"}
rate={1.0}
ignoreSilentSwitch={"obey"}
/>
</View>
Alternative: Expo LINK

React-native-webview in expo ios automatically opens url that don't match originWhitelist

I am using Expo to build an app that serves a website using react-native-webview. It's working in android, but however in iOS with custom originWhitelist, react-native-webview automatically opens custom scripts in Safari without any user interaction.
For example:
<WebView
source={{
uri: 'https://www.bbc.com',
}}
originWhitelist={['https://*bbc.com']}
/>
On load, the webview opens a link that doesn't fit the whitelist automatically. You can check the screen cap here: https://imgur.com/a/Tvbua2b. In addition to that, it also shows other urls that can't be opened (My guess is that because the app isn't on foreground). Here's one of the error messages from the console:
Environment:
OS: iOS
OS version: 13.5.
react-native version: React Native 0.62.2 for Expo SDK38.
react-native-webview version: ^9.4.0.

react-native-video black screen on Android

Current behavior
I have a list a social networking app that has videos and images (under 10 Mb each).
There is a screen with the user's feed, organized in a FlatList, in which i am loading for now only (!) two videos and one image. The app shows black screen in the place of the Video component, only on Android. The black screen problem does not happen in iOS! (I presume because the way memory management and how scroll lists are done in iOS)
Reproduction steps
This is my code for Video:
<Video
source={{ uri: this.state.uri }}
ref={(ref) => {
this.player = ref
}}
paused={this.state.paused}
resizeMode={this.state.resizeMode}
onLoad={this.handleLoad}
onEnd={this.handleEnd.bind(this)}
style={[this.state.style, { backgroundColor: '#3d3d3d' }]}
/>
also, if I add in AndroidManifest:
The memory consumed by the app as seen in Android Studio is somewhere at 170Mb, and growing.
Expected behavior
I expected to show the video.
Platform
Environment:
OS: macOS High Sierra 10.13.6
Node: 8.10.0
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: 3.1 AI-173.4670197
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.54.4 => 0.54.4
Which player are you experiencing the problem on:
I am using the Video tag from : import Video from 'react-native-video';
https://www.dropbox.com/s/o7q9kejiabs7y88/CrashVideo.mp4?dl=0
Questions
1) what is the solution to this?
2) Is this related to memory issues? When I load 10 more videos, the app crashes because of an error (as I see in Crashlytics) called 'Fatal Exception: java.lang.OutOfMemoryError'.
Does the library react-native-video not load when there is high memory used?
3) does the FlatList on Android unload from memory the images/videos when I scroll them outside of view? Otherwise, If I go down with scrolling , do I continually add images / videos to the app memory and it will eventually crash?
4) Is another solution for performance for video? I am thinking react-native-thumbnail to show initially the thumbnail to not download the whole video. I am having trouble installing the library (issue #35 on https://github.com/phuochau/react-native-thumbnail/issues/35 ) , do you know of a better way to get the video thumbnail? (so that instead of showing videos in feed, i show them on thumbnail touch in a different screen).
5) does the Exoplayer eliminate this problem?
This is I believe the greatest challenge with this app so far. Please contribute what solutions you have found to apps with feeds with videos.
(I have posted the question on Github here, but sometimes I only get responses on SO: https://github.com/react-native-community/react-native-video/issues/1318 )
Thank you!

React-native Webkit - getting WebKitErrorDomain Code 204 on video for iOS

We have a website that needs to be ported to mobile app. We have used react-native and the webkit view.
In the website, there is a play button that will open up a video. On Android, this works very well. However, it is not the same for iOS.
Please see error message
Error Loading Page
Domain: WebKitErrorDomain
Error Code: 204
Description: Plug-in handled load
Otherwise, the website looks good on iOS. On Android, the video opens and runs smoothly.
We have used this code in the app which is extremely simple.
<WebView
source={{uri: 'http://www.domain.abc'}}
bounces={false}
scrollEnable={false}
/>
Any idea on how to fix this issue?