mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

always use utf8 offsets (#3024)

authored by hailey.at and committed by

GitHub c7de733d a697b39c

+3 -4
+3 -4
modules/react-native-ui-text-view/ios/RNUITextView.swift
··· 108 108 fractionOfDistanceBetweenInsertionPoints: nil 109 109 ) 110 110 111 - var lastUpperOffset: Int = 0 111 + var lastUpperBound: String.Index? = nil 112 112 for child in self.reactSubviews() { 113 113 if let child = child as? RNUITextViewChild, let childText = child.text { 114 114 let fullText = self.textView.attributedText.string ··· 116 116 // We want to skip over the children we have already checked, otherwise we could run into 117 117 // collisions of similar strings (i.e. links that get shortened to the same hostname but 118 118 // different paths) 119 - let startIndex = fullText.index(fullText.startIndex, offsetBy: lastUpperOffset) 120 - let range = fullText.range(of: childText, options: [], range: startIndex..<fullText.endIndex) 119 + let range = fullText.range(of: childText, options: [], range: (lastUpperBound ?? String.Index(utf16Offset: 0, in: fullText) )..<fullText.endIndex) 121 120 122 121 if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound { 123 122 let lowerOffset = lowerBound.utf16Offset(in: fullText) ··· 128 127 { 129 128 return child 130 129 } else { 131 - lastUpperOffset = upperOffset 130 + lastUpperBound = upperBound 132 131 } 133 132 } 134 133 }