From b8f7bc23c2df8532941af8b62a4d36a4814c5965 Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 12 Jan 2024 23:24:43 -0800 Subject: [PATCH] use textkit 1 --- .../ios/ExpoSelectableTextView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift b/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift index fb63c9972c..0b9c6201d3 100644 --- a/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift +++ b/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift @@ -2,7 +2,7 @@ import Foundation import ExpoModulesCore class ExpoSelectableTextView: ExpoView { - let textView: UITextView = UITextView() + var textView: UITextView var segments: Array = [] { didSet { // We don't want to set the text if the root style has not been set yet @@ -21,6 +21,12 @@ class ExpoSelectableTextView: ExpoView { let onTextLayout = EventDispatcher() public required init(appContext: AppContext? = nil) { + if #available(iOS 16.0, *) { + textView = UITextView(usingTextLayoutManager: false) + } else { + textView = UITextView() + } + super.init(appContext: appContext) // Configure default appearance @@ -34,7 +40,7 @@ class ExpoSelectableTextView: ExpoView { textView.textContainer.lineFragmentPadding = 0 // Add the text view to the root view - addSubview(textView) + self.addSubview(textView) // Configure the press recognizer let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(callOnPress(_:)))