use textkit 1
This commit is contained in:
@@ -2,7 +2,7 @@ import Foundation
|
|||||||
import ExpoModulesCore
|
import ExpoModulesCore
|
||||||
|
|
||||||
class ExpoSelectableTextView: ExpoView {
|
class ExpoSelectableTextView: ExpoView {
|
||||||
let textView: UITextView = UITextView()
|
var textView: UITextView
|
||||||
var segments: Array<TextSegment> = [] {
|
var segments: Array<TextSegment> = [] {
|
||||||
didSet {
|
didSet {
|
||||||
// We don't want to set the text if the root style has not been set yet
|
// 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()
|
let onTextLayout = EventDispatcher()
|
||||||
|
|
||||||
public required init(appContext: AppContext? = nil) {
|
public required init(appContext: AppContext? = nil) {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
textView = UITextView(usingTextLayoutManager: false)
|
||||||
|
} else {
|
||||||
|
textView = UITextView()
|
||||||
|
}
|
||||||
|
|
||||||
super.init(appContext: appContext)
|
super.init(appContext: appContext)
|
||||||
|
|
||||||
// Configure default appearance
|
// Configure default appearance
|
||||||
@@ -34,7 +40,7 @@ class ExpoSelectableTextView: ExpoView {
|
|||||||
textView.textContainer.lineFragmentPadding = 0
|
textView.textContainer.lineFragmentPadding = 0
|
||||||
|
|
||||||
// Add the text view to the root view
|
// Add the text view to the root view
|
||||||
addSubview(textView)
|
self.addSubview(textView)
|
||||||
|
|
||||||
// Configure the press recognizer
|
// Configure the press recognizer
|
||||||
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(callOnPress(_:)))
|
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(callOnPress(_:)))
|
||||||
|
|||||||
Reference in New Issue
Block a user