react-native-camera-kit icon indicating copy to clipboard operation
react-native-camera-kit copied to clipboard

Add the ability to disable focus frame (ex. for a camera preview)

Open snikoletopoulos opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. In a camera preview it would be nice to hide the focus frame.

Describe the solution you'd like A prop to disable focus frame

Describe alternatives you've considered Manage the focus frame color with the option to set it to transparent

snikoletopoulos avatar Sep 07 '23 08:09 snikoletopoulos

Hi, if you really need this in android (dont know about ios), go to node_modules>react-native-camera-kit>android>src>main>java>com>rncamerakit>CKCamera.kt and change these lines

  1. if you want to make the tap to focus from green to transparent
private val paint = Paint().apply {
       style = Paint.Style.STROKE
       //color = ContextCompat.getColor(context, android.R.color.holo_green_light)
       color = ContextCompat.getColor(context, android.R.color.transparent) //change color to transparent
       strokeWidth = 5f
   }
  1. If you want to disable the tap to focus, comment out these whole code from the same file
          // Tap to focus
            viewFinder.setOnTouchListener { _, event ->
                if (event.action != MotionEvent.ACTION_UP) {
                    return@setOnTouchListener scaleDetector.onTouchEvent(event)
                }
                focusOnPoint(event.x, event.y)
                return@setOnTouchListener true
            }

Rebuilt your app

mahmingtea avatar Dec 11 '23 20:12 mahmingtea