presses
This commit is contained in:
@@ -62,6 +62,7 @@ class RNUITextView: UIView {
|
|||||||
self.textView.frame.size = size
|
self.textView.frame.size = size
|
||||||
self.textView.textContainer.maximumNumberOfLines = numberOfLines
|
self.textView.textContainer.maximumNumberOfLines = numberOfLines
|
||||||
self.textView.attributedText = string
|
self.textView.attributedText = string
|
||||||
|
self.textView.selectedTextRange = nil
|
||||||
|
|
||||||
if let onTextLayout = self.onTextLayout {
|
if let onTextLayout = self.onTextLayout {
|
||||||
var lines: [String] = []
|
var lines: [String] = []
|
||||||
@@ -107,16 +108,15 @@ class RNUITextView: UIView {
|
|||||||
fractionOfDistanceBetweenInsertionPoints: nil
|
fractionOfDistanceBetweenInsertionPoints: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
for child in self.subviews {
|
for child in self.reactSubviews() {
|
||||||
guard let child = child as? RNUITextViewChild, let text = child.text else {
|
if let child = child as? RNUITextViewChild, let childText = child.text {
|
||||||
continue
|
let fullText = self.textView.attributedText.string
|
||||||
}
|
let range = fullText.range(of: childText)
|
||||||
|
|
||||||
let range = text.range(of: text)
|
if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound {
|
||||||
|
if charIndex >= lowerBound.utf16Offset(in: fullText) && charIndex <= upperBound.utf16Offset(in: fullText) {
|
||||||
if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound {
|
return child
|
||||||
if charIndex >= lowerBound.utf16Offset(in: text) && charIndex <= upperBound.utf16Offset(in: text) {
|
}
|
||||||
return child
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ export function UITextView({style, children, ...rest}: TextProps) {
|
|||||||
{...textDefaults}
|
{...textDefaults}
|
||||||
{...rest}
|
{...rest}
|
||||||
ellipsizeMode={rest.ellipsizeMode ?? rest.lineBreakMode ?? 'tail'}
|
ellipsizeMode={rest.ellipsizeMode ?? rest.lineBreakMode ?? 'tail'}
|
||||||
style={[{flex: 1}, flattenedStyle]}>
|
style={[{flex: 1}, flattenedStyle]}
|
||||||
|
onPress={undefined} // We want these to go to the children only
|
||||||
|
onLongPress={undefined}>
|
||||||
{React.Children.toArray(children).map((c, index) => {
|
{React.Children.toArray(children).map((c, index) => {
|
||||||
if (React.isValidElement(c)) {
|
if (React.isValidElement(c)) {
|
||||||
return c
|
return c
|
||||||
|
|||||||
Reference in New Issue
Block a user