Skip to content

add custom view and modifier - #1

Open
betomoedano wants to merge 1 commit into
mainfrom
lesson/custom-swiftui-views-and-modifiers
Open

add custom view and modifier#1
betomoedano wants to merge 1 commit into
mainfrom
lesson/custom-swiftui-views-and-modifiers

Conversation

@betomoedano

@betomoedano betomoedano commented Jun 14, 2026

Copy link
Copy Markdown
Member

Custom SwiftUI views & modifiers

📚 Lesson: https://codewithbeto.dev/rnCourse/customSwiftUIViewsAndModifiers

This lesson adds a custom native module (modules/my-swift-ui-view) that exposes a SwiftUI view and modifiers to JS, then uses them alongside @expo/ui.

What we built

  • Custom SwiftUI view — defined a ViewModifier view and exposed it from the module definition with ExpoUIView(...), so it renders inside an @expo/ui Host.
  • Custom modifiersmySwiftUiViewSwiftUIModifier (static border) and rotatingBorder (animated gradient border, iOS 17+).
  • Lifecycle registration — modifiers are registered with ViewModifierRegistry.register(...) in OnCreate and torn down with unregister(...) in OnDestroy.
  • Typed TS APIrequireNativeView for the view and createModifier helpers for the modifiers, giving us type-safe props/params on the JS side.

How it's used

  • Render our custom view inside the @expo/ui Host, passing children and an onTap event.
  • Extend it with both built-in expo-ui modifiers (padding()) and our custom modifier (rotatingBorder).
  • Apply our custom modifier to regular expo-ui views too — e.g. rotatingBorder on a Column.

A conceptual overview is covered in the lesson itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant