Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ GEM
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.4.6)
activesupport (6.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.11.2)
cocoapods (1.11.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.2)
cocoapods-core (= 1.11.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -34,7 +34,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.2)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -45,7 +45,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -54,38 +54,38 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
concurrent-ruby (1.1.10)
escape (0.0.4)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
json (2.6.2)
minitest (5.16.3)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)
zeitwerk (2.6.5)

PLATFORMS
ruby
Expand Down
3 changes: 2 additions & 1 deletion Libraries/Components/Switch/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ const SwitchWithForwardedRef: React.AbstractComponent<
// that the update should be ignored and we should stick with the value
// that we have in JS.
const jsValue = value === true;
const shouldUpdateNativeSwitch = native.value !== jsValue;
const shouldUpdateNativeSwitch =
native.value != null && native.value !== jsValue;
if (
shouldUpdateNativeSwitch &&
nativeSwitchRef.current?.setNativeProps != null
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Core/ReactNativeVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
exports.version = {
major: 0,
minor: 67,
patch: 3,
patch: 5,
prerelease: null,
};
11 changes: 7 additions & 4 deletions Libraries/Text/RCTTextAttributes.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ - (NSParagraphStyle *)effectiveParagraphStyle
attributes[NSForegroundColorAttributeName] = effectiveForegroundColor;
}

if (_backgroundColor || !isnan(_opacity)) {
attributes[NSBackgroundColorAttributeName] = self.effectiveBackgroundColor;
}

// Kerning
if (!isnan(_letterSpacing)) {
attributes[NSKernAttributeName] = @(_letterSpacing);
Expand Down Expand Up @@ -169,6 +165,13 @@ - (NSParagraphStyle *)effectiveParagraphStyle
attributes[NSUnderlineColorAttributeName] = _textDecorationColor ?: effectiveForegroundColor;
}

// @Taskadev1 Turn background highlight into underline highlight
if (_backgroundColor || !isnan(_opacity)) {
isTextDecorationEnabled = YES;
attributes[NSUnderlineColorAttributeName] = self.effectiveBackgroundColor;
attributes[NSUnderlineStyleAttributeName] = @(NSUnderlineStyleThick + NSUnderlineStyleSingle);
}

// Shadow
if (!isnan(_textShadowRadius)) {
NSShadow *shadow = [NSShadow new];
Expand Down
46 changes: 45 additions & 1 deletion Libraries/Text/Text/RCTTextShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,50 @@
#import "NSTextStorage+FontScaling.h"
#import <React/RCTTextView.h>

// @Taskadev1 A custom layout manager to support gapless underlined text
@interface CustomLayoutManager : NSLayoutManager {
}
- (void)drawUnderlineForRect:(CGRect)rect;
- (void)drawUnderlineForGlyphRange:(NSRange)glyphRange
underlineType:(NSUnderlineStyle)underlineVal
baselineOffset:(CGFloat)baselineOffset
lineFragmentRect:(CGRect)lineRect
lineFragmentGlyphRange:(NSRange)lineGlyphRange
containerOrigin:(CGPoint)containerOrigin;
@end

@implementation CustomLayoutManager

- (void)drawUnderlineForRect:(CGRect)rect
{
UIBezierPath *path = [UIBezierPath new];
path.lineWidth = 3.5;
[path moveToPoint: CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect))];
[path addLineToPoint: CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect))];
[path stroke];
}

- (void)drawUnderlineForGlyphRange:(NSRange)glyphRange
underlineType:(NSUnderlineStyle)underlineVal
baselineOffset:(CGFloat)baselineOffset
lineFragmentRect:(CGRect)lineRect
lineFragmentGlyphRange:(NSRange)lineGlyphRange
containerOrigin:(CGPoint)containerOrigin
{
NSTextContainer *textContainer = [self textContainerForGlyphAtIndex:glyphRange.location effectiveRange: nil];
CGRect boundingRect = [self boundingRectForGlyphRange:glyphRange inTextContainer:textContainer];
CGRect offsetRect = CGRectOffset(boundingRect, containerOrigin.x, containerOrigin.y );
UIColor *color = [self.textStorage attribute:NSUnderlineColorAttributeName atIndex:glyphRange.location effectiveRange: nil];

if (color) {
[color setStroke];
}

[self drawUnderlineForRect:offsetRect];
}

@end

@implementation RCTTextShadowView
{
__weak RCTBridge *_bridge;
Expand Down Expand Up @@ -232,7 +276,7 @@ - (NSTextStorage *)textStorageAndLayoutManagerThatFitsSize:(CGSize)size
_maximumNumberOfLines > 0 ? _lineBreakMode : NSLineBreakByClipping;
textContainer.maximumNumberOfLines = _maximumNumberOfLines;

NSLayoutManager *layoutManager = [NSLayoutManager new];
CustomLayoutManager *layoutManager = [CustomLayoutManager new];
layoutManager.usesFontLeading = NO;
[layoutManager addTextContainer:textContainer];

Expand Down
2 changes: 2 additions & 0 deletions Libraries/Text/TextInput/Multiline/RCTUITextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) UITextFieldViewMode clearButtonMode;

@property (nonatomic, assign) BOOL caretHidden;
//@Taskadev1 Editor input prop declaration
@property (nonatomic, assign) BOOL editorInput;

@property (nonatomic, strong, nullable) NSString *inputAccessoryViewID;

Expand Down
5 changes: 5 additions & 0 deletions Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRang
if (newText == nil) {
return NO;
}

//@Taskadev1 Prevent enter for editor input
if (_backedTextInputView.editorInput && [text isEqualToString:@"\n"]) {
return NO;
}

if ([newText isEqualToString:text]) {
_textDidChangeIsComing = YES;
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL contextMenuHidden;
@property (nonatomic, assign, getter=isEditable) BOOL editable;
@property (nonatomic, assign) BOOL caretHidden;
//@Taskadev1 Editor input declaration
@property (nonatomic, assign) BOOL editorInput;
@property (nonatomic, assign) BOOL enablesReturnKeyAutomatically;
@property (nonatomic, assign) UITextFieldViewMode clearButtonMode;
@property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled;
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Text/TextInput/RCTBaseTextInputView.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL selectTextOnFocus;
@property (nonatomic, assign) BOOL clearTextOnFocus;
@property (nonatomic, assign) BOOL secureTextEntry;
//@Taskadev1 Editor input prop declaration
@property (nonatomic, assign) BOOL editorInput;
@property (nonatomic, copy) RCTTextSelection *selection;
@property (nonatomic, strong, nullable) NSNumber *maxLength;
@property (nonatomic, copy, nullable) NSAttributedString *attributedText;
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Text/TextInput/RCTBaseTextInputViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ @implementation RCTBaseTextInputViewManager
RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode)
RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
RCT_REMAP_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL)
//@Taskadev1 Editor input map property
RCT_REMAP_VIEW_PROPERTY(editorInput, backedTextInputView.editorInput, BOOL)
RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL)
RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
Expand Down
2 changes: 1 addition & 1 deletion React/Base/RCTVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
__rnVersion = @{
RCTVersionMajor: @(0),
RCTVersionMinor: @(67),
RCTVersionPatch: @(3),
RCTVersionPatch: @(5),
RCTVersionPrerelease: [NSNull null],
};
});
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=0.67.3
VERSION_NAME=0.67.5
GROUP=com.facebook.react

POM_NAME=ReactNative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class ReactNativeVersion {
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
"major", 0,
"minor", 67,
"patch", 3,
"patch", 5,
"prerelease", null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ private static void buildSpannedFromShadowNode(
new SetSpanOperation(start, end, new ReactForegroundColorSpan(textShadowNode.mColor)));
}
if (textShadowNode.mIsBackgroundColorSet) {
ops.add(
new SetSpanOperation(
start, end, new ReactBackgroundColorSpan(textShadowNode.mBackgroundColor)));
// @Taskadev1 Draw underline highlight
ops.add(new SetSpanOperation(
start,
end,
new UnderlineStyleSpan(textShadowNode.mBackgroundColor)));
}
float effectiveLetterSpacing = textAttributes.getEffectiveLetterSpacing();
if (!Float.isNaN(effectiveLetterSpacing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ private static void buildSpannableFromFragment(
start, end, new ReactForegroundColorSpan(textAttributes.mColor)));
}
if (textAttributes.mIsBackgroundColorSet) {
ops.add(
new SetSpanOperation(
start, end, new ReactBackgroundColorSpan(textAttributes.mBackgroundColor)));
}
if (!Float.isNaN(textAttributes.getLetterSpacing())) {
ops.add(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.facebook.react.views.text;

import android.text.TextPaint;
import android.text.style.CharacterStyle;
import java.lang.reflect.Method;

// @Taskadev1 Color underline highlight span
public class UnderlineStyleSpan extends CharacterStyle implements ReactSpan {
private final int mColor;

public UnderlineStyleSpan(final int color) {
mColor = color;
}

@Override
public void updateDrawState(TextPaint textPaint) {
try {
final Method method = TextPaint.class.getMethod("setUnderlineText", Integer.TYPE, Float.TYPE);
method.invoke(textPaint, mColor, 8.0f);
} catch (final Exception e) {
textPaint.setUnderlineText(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public class ReactEditText extends AppCompatEditText

private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager();
protected boolean mDisableTextDiffing = false;


// @Taskadev1 Editor input prop declaration
protected boolean mIsEditorInput = false;
protected boolean mIsSettingTextFromState = false;

private static final KeyListener sKeyListener = QwertyKeyListener.getInstanceForFullKeyboard();
Expand Down Expand Up @@ -384,6 +386,11 @@ public void setBlurOnSubmit(@Nullable Boolean blurOnSubmit) {
public void setOnKeyPress(boolean onKeyPress) {
mOnKeyPress = onKeyPress;
}

// @Taskadev1 Set editor input prop
public void setIsEditorInput(boolean isEditorInput) {
mIsEditorInput = isEditorInput;
}

public boolean getBlurOnSubmit() {
if (mBlurOnSubmit == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ public void setOnKeyPress(final ReactEditText view, boolean onKeyPress) {
view.setOnKeyPress(onKeyPress);
}

@ReactProp(name = "editorInput", defaultBoolean = false)
public void setEditorInput(final ReactEditText view, boolean isEditorInput) {
view.setIsEditorInput(isEditorInput);
}

// Sets the letter spacing as an absolute point size.
// This extra handling, on top of what ReactBaseTextShadowNode already does, is required for the
// correct display of spacing in placeholder (hint) text.
Expand Down Expand Up @@ -988,6 +993,19 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
return;
}

// @Taskadev1 Prevent newline from being created
if (mEditText.mIsEditorInput) {
int mIndex = mEditText.getText().toString().lastIndexOf("\n");
if(mIndex != -1) {
if (mEditText.getText().length() > 0) {
mEditText.setText(mEditText.getText().delete(mIndex , mIndex + 1));
}
mEditText.setSelection(mEditText.getText().length());
mEventDispatcher.dispatchEvent(new ReactTextInputKeyPressEvent(mEditText.getId(), "Enter"));
return;
}
}

if (mEditText.getFabricViewStateManager().hasStateWrapper()) {
// Fabric: communicate to C++ layer that text has changed
// We need to call `incrementAndGetEventCounter` here explicitly because this
Expand Down Expand Up @@ -1023,7 +1041,8 @@ public WritableMap getStateUpdate() {
}

@Override
public void afterTextChanged(Editable s) {}
public void afterTextChanged(Editable s) {
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/ReactNativeVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace facebook::react {
constexpr struct {
int32_t Major = 0;
int32_t Minor = 67;
int32_t Patch = 3;
int32_t Patch = 5;
std::string_view Prerelease = "";
} ReactNativeVersion;

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ee834cad55b3aff4200f49f58eab4782
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
334ca9e2426c5d72705382016cf3708980c2a241
Loading