Closed Praveencena88 closed 5 months ago
@Praveencena88 I am not familiarise with react-native environment. Any way I am happy to help.
Can you guide me by saying what are the necessary code to be added to disable the screenshot
There is no proper implementation available in iOS to prevent user from recording a specific view. But in iOS UITextField is used to input data from keyboard, it has a property called isSecureTextEntry, if it's enabled system will not let record or capture anything that render in the text field. So we can use this behaviour of the UITextField to achieve our goal.
let field = UITextField()
field.isSecureTextEntry = true
self.addSubview(field)
field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.layer.superlayer?.addSublayer(field.layer)
field.layer.sublayers?.first?.addSublayer(self.layer)
Now it's ready. In which view the react-native UI renders ? If we create some thing like this view to use with react-native can we add more react components over it ? you have to find out.
Hi @kuttz we are using react-native to create iOS app and i'm new to swift code, can you help me in providing necessary information about configuring this screenshot disabler to the react-native app.