uxcam / react-native-ux-cam

51 stars 10 forks source link

occludeSensitiveView not working reliably #90

Open ziga-hvalec opened 1 year ago

ziga-hvalec commented 1 year ago

We are using occludeSensitiveView to hide credit card info. It mostly works but randomly stops working.

Any workarounds for this?

Our implementation

` <View ref={(view) => { if (view) RNUxcam.occludeSensitiveView(view); }}

`

Screenshot 2023-05-26 at 1 47 37 PM Screenshot 2023-05-26 at 1 45 41 PM
egealpay commented 1 year ago

We are having the same problem. It is working in iOS but not in Android

ziga-hvalec commented 1 year ago

Support said they have some issues. Workaround is apparently to pass style prop to the view you're trying to hide. style={{}} is enough. I haven't yet tested this

rohitmakwanauxcam commented 1 year ago

Hi, @ziga-hvalec @egealpay

Please apply backgroundColor as transparent or you can add own color style={{backgroundColor: 'transparent'}}

andrewtremblay commented 10 months ago

We also noticed we were getting a Red Screen of Death when using occludeSensitiveView and WebView

<WebView ref={(ref) => { RNUxcam.occludeSensitiveView(ref); }>

The current types allow this to be possible. However, once we try to occlude the web view, we get the following error:

Argument appears to not be a ReactComponent

Which is surprising, because the WebView extends React Component.

Our workaround was to wrap WebView in a View component and occlude that:

<View ref={(ref) => { RNUxcam.occludeSensitiveView(ref); }>
   <WebView />
<View>

This could more clearly be enforced with types

    static occludeSensitiveView: (sensitiveView: any) => void;

could become something like

    static occludeSensitiveView: <T extends View | null>(sensitiveView: T) => void;

or

    static occludeSensitiveView: <T extends React.ComponentRef<any>>(sensitiveView: T) => void;

I'm not sure what type is better because I'm not sure what the internal list of allowed components is actually correct.