Closed creen-aps closed 1 year ago
Hi,
Disable default profile in DataWedge and create a profile for your app.
It is already default and only profile in DataWedge.
No you need to disable default profile and create a new one for your expo app.
Sorry, I did not explain clearly. My profile is the only one in DataWedge.
Is it a new one with only your expo app specify ?
Someone get an error like this when he was using the default profile in Datawedge.
If it doesn't resolve the problem, Check that you're in Expo 49 and rebuild your development build. I never got this error in my all apps, it seems the problem come from Firebase check on this, I have no other idea.
Are you running the code 2 times and create multiple listener ? It could be an error too.
I use reusable component with multiple inputs, it works, but sometime app crash.
import React, { useEffect, useState, useRef } from 'react'
import { TextInput, StyleSheet, View, Text } from 'react-native'
import * as ExpoZebraScanner from 'expo-zebra-scanner'
type ZebraScannerInputProps = {
value: string
onChange: (value: string) => void
helperText?: string
error?: boolean
placeholder: string
}
const ZebraScannerInput: React.FC<ZebraScannerInputProps> = ({
value,
onChange,
helperText,
error = false,
placeholder,
}) => {
const [isActive, setIsActive] = useState(false)
const [isFocused, setIsFocused] = useState(false)
const inputRef = useRef(null)
useEffect(() => {
const listener = ExpoZebraScanner.addListener((event) => {
if (isActive && event.scanData) {
onChange(event.scanData)
}
})
return () => {
ExpoZebraScanner.removeListener(listener)
}
}, [isActive, onChange])
return (
<View style={styles.inputContainer}>
{isFocused && helperText && (
<Text style={styles.helperText}>{helperText}</Text>
)}
<TextInput
ref={inputRef}
style={[
styles.input,
isFocused && { borderColor: '#1E88E5' },
error && { borderColor: 'red' },
]}
value={value}
onChangeText={onChange}
onFocus={() => {
setIsFocused(true)
setIsActive(true)
}}
onBlur={() => {
setIsFocused(false)
setIsActive(false)
}}
placeholder={placeholder}
/>
</View>
)
}
const styles = StyleSheet.create({
inputContainer: {
},
input: {
},
helperText: {
},
})
export default ZebraScannerInput
I think you should not do that. If you're app listen the same Intent in 2 components at same time, I think that could crash the app.
Try to wrap the listener and the return function in the if(isActive).
Is it working ?
I can't reproduce anymore.
I do not use firebase, my app sometimes crash, with thsi error. (react native 0.72 eso custom build) Your app just crashed. See the error below.