regulaforensics / react-native-document-reader

React-Native Framework for reading and validation of identification documents
19 stars 10 forks source link

[BR] Incorrect types for `expectedPass` on iOS #22

Open Watersdr opened 5 months ago

Watersdr commented 5 months ago

Before Submitting, be sure to

Bug Description

Incorrect types for expectedPass on iOS. The variables defined on eImageQualityCheckType that are shown in the documentation examples are typed incorrectly for the iOS library. The variables in JS are defined as numbers but iOS expects them as strings

Steps To Reproduce

Try to setup your document scan config using the exact example from the docs and your app will crash because the parameters are incorrect.

DocumentReader.setProcessParams({
    imageQA: {
        expectedPass: [
            eImageQualityCheckType.IQC_IMAGE_RESOLUTION,
            eImageQualityCheckType.IQC_IMAGE_GLARES
        ]
    }
}, (str) => { console.log(str) }, (error) => { console.log(error) });

I attempted to use the getTranslation method but that method expects a callback which is just completely unnecessary for doing a simple number to string mapping. I think the iOS native code needs to be update to accept the number type like the docs show. Or you could do the mapping on the JS side. Or even just define the string versions of the eImageQualityCheckType in JS and let the consumer do their own mappings.