Styling Control
Override styles with custom config json
Component Targeting
Customize specific components and pages
Advanced Theming
Complex color schemes and typography
UIKit Framework
Still within the UIKit ecosystem
When to Choose Component Styling
Component Styling is ideal when you need: ✅ Custom brand experiences - Basic colors and fonts✅ Granular control - Target specific components or pages
✅ Advanced theming - Complex color schemes and typography
✅ Framework benefits - Want to stay within UIKit’s ecosystem ❌ Simple branding -
Dynamic UI
is easier for basic needs❌ Complex layouts -
Fork & Extend
offers more freedom❌ Custom components - Need source code access for new components
Configuration Model
Component Styling uses a single
config.json
surface for cross-platform overrides. It layers on top of default UIKit tokens (and Dynamic UI if present) using a path pattern: page_id/component_id/element_id
with wildcards (*
).Path Pattern & Levels
Level | Example | Description | Wildcard Use |
---|---|---|---|
Page | camera_page/*/* | Entire screen / route | Replace component & element with */* |
Component | */comment_tray_component/* | Functional unit within a page | Wildcard page to apply globally |
Element | story_page/*/close_button | Single interactive / visual element | Wildcard component for all instances |
Specific beats generic: Element overrides > Component overrides > Page overrides > Global theme.
Supported Theme Tokens
Token | Purpose | Notes |
---|---|---|
primary_color | Actions / highlights | High contrast vs background |
secondary_color | Secondary actions / borders | Complementary to primary |
base_color | Primary text color | Body & headings |
base_shade1_color | Secondary text | Subtitles / meta |
base_shade2_color | Tertiary text / hints | Placeholders, inactive |
base_shade3_color | Disabled text | Low emphasis |
base_shade4_color | Optional faint text / separators | Lowest emphasis |
alert_color | Errors / destructive | Distinct from brand palette |
background_color | Surface background | Page / component surface |
Minimal Config Skeleton
Theme Application & Preferred Mode
Set the app’s theme resolution strategy withpreferred_theme
:
Value | Behavior |
---|---|
default | Follow OS setting (light/dark) |
light | Force light regardless of OS |
dark | Force dark regardless of OS |
Use
default
unless you have a business requirement to lock theme (e.g., brand guidelines for launch).Targeting Examples
Page-Level
Page-Level
Override a whole screen. Great for hero / camera / immersive surfaces.
Component-Level
Component-Level
Adjust reusable functional blocks everywhere.
Element-Level
Element-Level
Fine-grain tweak for single control.
Reference: Allowed IDs
Exclusions
Remove (hide) specific elements by adding their path toexcludes
:
Excluding structural elements (like a required close button) may degrade usability. Test flows after any exclusion.
Precedence & Conflict Resolution
Scenario | Winning Value |
---|---|
Page vs Global | Page override |
Component vs Page | Component override |
Element vs Component | Element override |
Multiple matches same level | Last in file (bottom-most) |
Group related overrides together to prevent accidental shadowing by later blocks.
Best Practices
Token First
Change global tokens before per-element overrides.
Progressive Specificity
Escalate from page → component → element only when needed.
Consistency
Reuse colors; avoid random hex proliferation.
Auditable Changes
Document rationale in PR descriptions.
Dark Mode QA
Visually inspect every high-contrast surface.
Minimal Exclusions
Prefer styling adjustments over removal.
Overriding Navigation Behaviour
Navigation can be customized without forking by overriding the provided Behaviour classes. UIKit isolates navigation & event hooks into behaviour objects per page/component so you can inject custom flows (e.g., presenting a different creation screen, analytics, guards) while keeping styling overrides separate.
Behaviour Architecture
- Each major screen/component exposes a
Behaviour
(iOS) /Behavior
(Android) class with overridable navigation methods. - A top-level
AmityUIKit4Manager.behaviour
(iOS) /AmityUIKit4Manager.behavior
(Android) aggregates these instances. - Replace only the concrete behaviour you need; leave others at default.
Override Example: Story Tab Navigation
Only override the specific methods you need; keep defaults for forward compatibility.
Advanced iOS Navigation (Swipe Back & SwiftUI Hosting)
UIKit v4 pages are predominantly SwiftUI, embedded inUINavigationController
via helper controllers:
Class | Purpose |
---|---|
AmitySwiftUIHostingController | Wrap a single SwiftUI view |
AmitySwiftUIHostingNavigationController | Provide a navigation stack hosting SwiftUI pages |
AmitySwipeToBackGestureBehavior
.
Keep gesture logic lightweight—long operations here can block UI responsiveness.