forked from Astrocoders/react-native-selectable-text
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
onHighlightPress property is not working on IOS OS 16+
"react": "17.0.2",
"react-native": "0.67.2",
"@alentoma/react-native-selectable-text": "1.6.0",
below mentioned code always return 0 for clickedRangeStart & clickedRangeEnd.
-(void) handleSingleTap: (UITapGestureRecognizer *) gesture
{
CGPoint pos = [gesture locationInView:_backedTextInputView];
pos.y += _backedTextInputView.contentOffset.y;
UITextPosition *tapPos = [_backedTextInputView closestPositionToPoint:pos];
UITextRange *word = [_backedTextInputView.tokenizer rangeEnclosingPosition:tapPos withGranularity:(UITextGranularityWord) inDirection:UITextLayoutDirectionRight];
UITextPosition* beginning = _backedTextInputView.beginningOfDocument;
UITextPosition *selectionStart = word.start;
UITextPosition *selectionEnd = word.end;
const NSInteger location = [_backedTextInputView offsetFromPosition:beginning toPosition:selectionStart];
const NSInteger endLocation = [_backedTextInputView offsetFromPosition:beginning toPosition:selectionEnd];
self.onHighlightPress(@{
@"clickedRangeStart": @(location),
@"clickedRangeEnd": @(endLocation),
});
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels