Skip to content

Commit

Permalink
[home] Fix non-working barcode scanner (expo#3780)
Browse files Browse the repository at this point in the history
# Why

Fixes expo#3767

# How

Home was using removed method `onBarCodeRead` instead of new `onBarCodeScanned`

# Test Plan

Build `home` and build Expo on Android.

# Things to be done

- [ ] publish new `home` for dev
- [x] address `ExpoAppAuth` missing module (expo#3781)
  • Loading branch information
bbarthec authored Mar 19, 2019
1 parent 1330873 commit 5ac9e41
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
18 changes: 6 additions & 12 deletions home/screens/QRCodeScreen.android.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
/* @flow */

import React from 'react';
import {
Dimensions,
Linking,
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import { Linking, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { BarCodeScanner } from 'expo';
import { throttle } from 'lodash';

Expand Down Expand Up @@ -47,7 +39,10 @@ export default class BarCodeScreen extends React.Component {
return (
<View style={styles.container}>
{this.state.scannerIsVisible ? (
<BarCodeScanner onBarCodeRead={this._handleBarCodeRead} style={StyleSheet.absoluteFill} />
<BarCodeScanner
onBarCodeScanned={this._handleBarCodeScanned}
style={StyleSheet.absoluteFill}
/>
) : null}

<View style={styles.topOverlay} />
Expand Down Expand Up @@ -76,7 +71,7 @@ export default class BarCodeScreen extends React.Component {
);
}

_handleBarCodeRead = throttle(({ data: url }) => {
_handleBarCodeScanned = throttle(({ data: url }) => {
this.setState({ scannerIsVisible: false }, () => {
if (this._isMounted) {
this._openUrl(url);
Expand Down Expand Up @@ -186,7 +181,6 @@ const styles = StyleSheet.create({
header: {
position: 'absolute',
top: 40,
left: 0,
right: 0,
alignItems: 'flex-start',
left: 25,
Expand Down
17 changes: 3 additions & 14 deletions home/screens/QRCodeScreen.ios.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
/* @flow */

import React from 'react';
import {
Linking,
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import { Linking, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { Camera } from 'expo';
import { throttle } from 'lodash';
import isIPhoneX from '../utils/isIPhoneX';
Expand Down Expand Up @@ -43,10 +36,7 @@ export default class BarCodeScreen extends React.Component {
return (
<View style={styles.container}>
{this.state.scannerIsVisible ? (
<Camera
onBarCodeRead={this._handleBarCodeRead}
style={StyleSheet.absoluteFill}
/>
<Camera onBarCodeScanned={this._handleBarCodeScanned} style={StyleSheet.absoluteFill} />
) : null}

<View style={styles.topOverlay} />
Expand Down Expand Up @@ -75,7 +65,7 @@ export default class BarCodeScreen extends React.Component {
);
}

_handleBarCodeRead = throttle(({ data: url }) => {
_handleBarCodeScanned = throttle(({ data: url }) => {
this.setState({ scannerIsVisible: false }, () => {
if (this._isMounted) {
this._openUrl(url);
Expand Down Expand Up @@ -192,7 +182,6 @@ const styles = StyleSheet.create({
left: 0,
right: 0,
alignItems: 'center',
left: 0,
},
headerText: {
color: '#fff',
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-app-auth/build/ExpoAppAuth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-app-auth/build/ExpoAppAuth.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-app-auth/src/ExpoAppAuth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { NativeModulesProxy } from '@unimodules/core';

export default NativeModulesProxy.ExpoAppAuth;
export default NativeModulesProxy.ExpoAppAuth || {};

0 comments on commit 5ac9e41

Please sign in to comment.