Check out example codes for "set password visible in android". It will help you in understanding the concepts better.

Code Example 1

button.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if(button.isPressed()) {
                upass.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
                return true;
            }
            return true;
        }
   });

Learn ReactJs, React Native from akashmittal.com