I solve this by setting bounds of the rightView, instead frame just like that:
private func layoutTextFieldViews() {
let textFieldHeight = textField.frame.height
//left
leftTextFieldView.frame = .init(
x: 0,
y: 0,
width: 50,
height: textFieldHeight)
leftTextFieldImageView.frame = .init(
x: 0,
y: 0,
width: 18,
height: 18)
leftTextFieldImageView.center = .init(
x: 15,
y: leftTextFieldView.bounds.midY)
//right
let rightViewWidth:CGFloat = 80
rightTextFieldView.bounds = .init(
x: 0,
y: 0,
width: rightViewWidth,
height: textFieldHeight)
rightTextFieldButton.frame = .init(
x: 0,
y: 0,
width: rightViewWidth - 20,
height: textFieldHeight)
rightTextFieldButton.center = .init(
x: 40,
y: rightTextFieldView.bounds.midY)
}