diff --git a/packages/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift b/packages/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift index cc87ef29e9704b..dab1733c07dead 100644 --- a/packages/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift +++ b/packages/react-native-aztec/ios/RNTAztecView/RCTAztecView.swift @@ -100,8 +100,14 @@ class RCTAztecView: Aztec.TextView { /// the dictation engine refreshes the TextView with an empty string when the dictation finishes. /// This helps to avoid propagating that unwanted empty string to RN. (Solving #606) /// on `textViewDidChange` and `textViewDidChangeSelection` - private var isInsertingDictationResult = false - + private var isInsertingDictationResult: Bool = { + if #available(iOS 16, *) { + return true; + } else { + return false; + } + }() + // MARK: - Font /// Flag to enable using the defaultFont in Aztec for specific blocks @@ -358,10 +364,14 @@ class RCTAztecView: Aztec.TextView { } public override func insertDictationResult(_ dictationResult: [UIDictationPhrase]) { - let objectPlaceholder = "\u{FFFC}" let dictationText = dictationResult.reduce("") { $0 + $1.text } - isInsertingDictationResult = false - self.text = self.text?.replacingOccurrences(of: objectPlaceholder, with: dictationText) + if #available(iOS 16, *) { + insertText(dictationText) + } else { + let objectPlaceholder = "\u{FFFC}" + isInsertingDictationResult = false + self.text = self.text?.replacingOccurrences(of: objectPlaceholder, with: dictationText) + } } // MARK: - Custom Edit Intercepts