From d8125deb1b82d8ef7ae3b626d913dc9f948fa253 Mon Sep 17 00:00:00 2001 From: Beat YT <66485277+Beat-YT@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:32:31 -0500 Subject: [PATCH 1/2] Add title customization to scroll edge appearance Introduces support for configuring the title's font, color, and style in the scroll edge appearance of the top bar on iOS. Updates Objective-C and TypeScript interfaces and implements logic to apply these title attributes when the scroll view reaches the edge. --- ios/RNNScrollEdgeAppearanceOptions.h | 2 ++ ios/RNNScrollEdgeAppearanceOptions.mm | 3 +++ ios/TopBarAppearancePresenter.mm | 28 +++++++++++++++++++++++++ src/interfaces/Options.ts | 30 +++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/ios/RNNScrollEdgeAppearanceOptions.h b/ios/RNNScrollEdgeAppearanceOptions.h index ff820ed1597..8f0f020a03b 100644 --- a/ios/RNNScrollEdgeAppearanceOptions.h +++ b/ios/RNNScrollEdgeAppearanceOptions.h @@ -1,9 +1,11 @@ #import "RNNComponentOptions.h" #import "RNNOptions.h" #import "RNNScrollEdgeAppearanceBackgroundOptions.h" +#import "RNNTitleOptions.h" @interface RNNScrollEdgeAppearanceOptions : RNNOptions +@property(nonatomic, strong) RNNTitleOptions *title; @property(nonatomic, strong) RNNScrollEdgeAppearanceBackgroundOptions *background; @property(nonatomic, strong) Bool *active; @property(nonatomic, strong) Bool *noBorder; diff --git a/ios/RNNScrollEdgeAppearanceOptions.mm b/ios/RNNScrollEdgeAppearanceOptions.mm index 7cdabe68d47..647b3e879a7 100644 --- a/ios/RNNScrollEdgeAppearanceOptions.mm +++ b/ios/RNNScrollEdgeAppearanceOptions.mm @@ -10,11 +10,14 @@ - (instancetype)initWithDict:(NSDictionary *)dict { self.noBorder = [BoolParser parse:dict key:@"noBorder"]; self.borderColor = [ColorParser parse:dict key:@"borderColor"]; + self.title = [[RNNTitleOptions alloc] initWithDict:dict[@"title"]]; + return self; } - (void)mergeOptions:(RNNScrollEdgeAppearanceOptions *)options { [self.background mergeOptions:options.background]; + [self.title mergeOptions:options.title]; if (options.active.hasValue) self.active = options.active; diff --git a/ios/TopBarAppearancePresenter.mm b/ios/TopBarAppearancePresenter.mm index e914b761fe4..8084862ac19 100644 --- a/ios/TopBarAppearancePresenter.mm +++ b/ios/TopBarAppearancePresenter.mm @@ -19,8 +19,13 @@ - (void)applyOptions:(RNNTopBarOptions *)options { [self setBackgroundColor:[options.background.color withDefault:nil]]; [self setScrollEdgeAppearanceColor:[options.scrollEdgeAppearance.background.color withDefault:nil]]; + [self setTitleAttributes:options.title]; [self setLargeTitleAttributes:options.largeTitle]; + if (options.scrollEdgeAppearance.title && [options.scrollEdgeAppearance.title hasValue]) { + [self setScrollEdgeTitleAttributes:options.scrollEdgeAppearance.title]; + } + [self setBorderColor:[options.borderColor withDefault:nil]]; [self showBorder:![options.noBorder withDefault:NO]]; [self setBackButtonOptions:options.backButton]; @@ -158,6 +163,29 @@ - (void)setTitleAttributes:(RNNTitleOptions *)titleOptions { self.getScrollEdgeAppearance.titleTextAttributes = titleTextAttributes; } +- (void)setScrollEdgeTitleAttributes:(RNNTitleOptions *)titleOptions { + NSString *fontFamily = [titleOptions.fontFamily withDefault:nil]; + NSString *fontWeight = [titleOptions.fontWeight withDefault:nil]; + NSNumber *fontSize = [titleOptions.fontSize withDefault:nil]; + UIColor *fontColor = [titleOptions.color withDefault:nil]; + + NSDictionary *titleTextAttributes = + [RNNFontAttributesCreator createFromDictionary:self.getScrollEdgeAppearance.titleTextAttributes + fontFamily:fontFamily + fontSize:fontSize + fontWeight:fontWeight + color:fontColor + centered:YES]; + + id attrib = titleTextAttributes[NSParagraphStyleAttributeName]; + if ([attrib isKindOfClass:[NSMutableParagraphStyle class]]) { + ((NSMutableParagraphStyle *)titleTextAttributes[NSParagraphStyleAttributeName]).lineBreakMode = + NSLineBreakByTruncatingTail; + } + + self.getScrollEdgeAppearance.titleTextAttributes = titleTextAttributes; +} + - (void)setLargeTitleAttributes:(RNNLargeTitleOptions *)largeTitleOptions { NSString *fontFamily = [largeTitleOptions.fontFamily withDefault:nil]; NSString *fontWeight = [largeTitleOptions.fontWeight withDefault:nil]; diff --git a/src/interfaces/Options.ts b/src/interfaces/Options.ts index 05320abfcaa..4d00e768437 100644 --- a/src/interfaces/Options.ts +++ b/src/interfaces/Options.ts @@ -453,7 +453,37 @@ export interface OptionsTopBarScrollEdgeAppearanceBackground { translucent?: boolean; } +export interface OptionsTopBarScrollEdgeAppearanceTitle { + /** + * Font size + */ + fontSize?: number; + /** + * Text color + */ + color?: Color; + /** + * Set the font family for the title + */ + fontFamily?: FontFamily; + /** + * Set the font style for the title + */ + fontStyle?: FontStyle; + /** + * Specifies font weight. The values 'normal' and 'bold' are supported + * for most fonts. Not all fonts have a variant for each of the numeric + * values, in that case the closest one is chosen. + */ + fontWeight?: FontWeight; +} + export interface OptionsTopBarScrollEdgeAppearance { + /** + * Title configuration applied when the scroll view reaches the edge + * ### (iOS specific) + */ + title?: OptionsTopBarScrollEdgeAppearanceTitle; background?: OptionsTopBarScrollEdgeAppearanceBackground; active: boolean; /** From 50f797abf36c9403d748cdb509f7522cb2f44f04 Mon Sep 17 00:00:00 2001 From: Beat YT <66485277+Beat-YT@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:41:36 -0500 Subject: [PATCH 2/2] Remove extra newline in RNNScrollEdgeAppearanceOptions Deleted an unnecessary blank line in the initWithDict method for improved code cleanliness. --- ios/RNNScrollEdgeAppearanceOptions.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/ios/RNNScrollEdgeAppearanceOptions.mm b/ios/RNNScrollEdgeAppearanceOptions.mm index 647b3e879a7..528124b405d 100644 --- a/ios/RNNScrollEdgeAppearanceOptions.mm +++ b/ios/RNNScrollEdgeAppearanceOptions.mm @@ -9,7 +9,6 @@ - (instancetype)initWithDict:(NSDictionary *)dict { self.active = [BoolParser parse:dict key:@"active"]; self.noBorder = [BoolParser parse:dict key:@"noBorder"]; self.borderColor = [ColorParser parse:dict key:@"borderColor"]; - self.title = [[RNNTitleOptions alloc] initWithDict:dict[@"title"]]; return self;