Floating button changes position when keyboard is shown in iOS 16.4.1

I have a floating button that is created using the CGFloatingButton func in my iOS app. It is positioned at the bottom of the screen, and its position is defined using frame based on the view's bounds. It was working fine in previous versions of iOS, but after updating to iOS 16.4.1, I noticed that the button's position changes when the keyboard is shown, and it does not return to its original position after the keyboard is dismissed.

I checked the constraints and they seem to be fine. However, when I looked at the debug view hierarchy, I noticed that the button appears to be outside its container, and the click only works within the original 65x65 container.

I am using the following code to set up the button:

    let loginLater = UserDefaults.standard.bool(forKey: Constants.LOGIN_LATER)
    cgFloatingButton = CGFloatingButton(onTap: {
        self.gotoCheckandGo()
    })
    cgFButtonHController = UIHostingController(rootView: cgFloatingButton)
    self.addChild(cgFButtonHController)
    var offset = CGPoint(x: (self.view.bounds.width * 0.5) - 32.5, y: (self.view.bounds.height) - 117)
    switch deviceType {
    case .iPhone8, .iPhone8Plus, .iPhoneSE:
        offset = CGPoint(x: (self.view.bounds.width * 0.5) - 32.5, y: (self.view.bounds.height) - 90)
    default:
        offset = CGPoint(x: (self.view.bounds.width * 0.5) - 32.5, y: (self.view.bounds.height) - 117)
    }
    
    let frame = CGRect(origin: offset, size: CGSize(width: 65, height: 65))
    cgFButtonHController.view.frame = frame
    cgFButtonHController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    cgFButtonHController.view.backgroundColor = UIColor.clear
    cgFButtonHController.view.isHidden = true
    self.floatingTabBar.tabBarCheckAndGoButtonView.isHidden = true
    if loginLater == false {
        view.addSubview(cgFButtonHController.view)
    } else {
        self.floatingTabBar.isHidden = true
    }
}

This is the code in SwiftUI about cgFloatingButton var:

struct CGFloatingButton: View {
var onTap: () -> Void = { }
var body: some View {
    Button(action: {
        onTap()
    }) {
        Image("cg_btn")
            .resizable()
            .frame(width: 65, height: 65)
            .background(Color.white)
            .foregroundColor(.white)
            .clipShape(Circle())
            .shadow(radius: 2)
    }.ignoresSafeArea(.all)
}}

Has anyone else experienced this issue with a floating button or have any suggestions on how to fix it? Thanks in advance for your help!

Floating button changes position when keyboard is shown in iOS 16.4.1
 
 
Q