react-native-selectable-text
react-native-selectable-text copied to clipboard
onHighlightPress property is not working on IOS OS 16+
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),
});
}
@AlenToma
Sadly I dont own IOS or mac so I can't fix this if it is really an issue.
But no body have complained about this so I dont know if the issue is really with the library.
If someone could test this?
I am also facing the same issue. is any one have luck?
I have build another library may be as a replacement.
https://github.com/AlenToma/react-native-text-contextmenu
@AlenToma thank you for your support. for now I changed in native library code of your and I replace this line UITextRange *word = [_backedTextInputView.tokenizer rangeEnclosingPosition:tapPos withGranularity:(UITextGranularityWord) inDirection: inDirection:UITextLayoutDirectionRight]; to UITextRange *word = [_backedTextInputView.tokenizer rangeEnclosingPosition:tapPos withGranularity:(UITextGranularityWord) inDirection:UITextWritingDirectionNatural];
and its work for me in all versions of IOS.
Hey im facing issue with selection text on higher version of IOS lower versions are working fine
@Harshkansaramoon can you please let me know which file did you updated for the fix?
@ZainabShakeel in this I changed file RNSelectableTextView.m
yes found @Harshkansaramoon Thanks a lot.
@Harshkansaramoon Have you got app crash when long press a word and swipe right ?whether some new feature update caused this issue on ios 16?
@Harshkansaramoon could you check in your version of the fix and I will do pull and publish it.
Hi, we have implemented https://www.npmjs.com/package/@vandrei977/react-native-selectable-text and that is forked from this library. We are not getting any crash.