git.iko.soy/rowtype-yoga/purescript-yoga-react-native
on main help sign in
WIP: React Native bindings development
commit286cdf202630753e1767a9ccf3ea9a1d39dfd5d4 authorMark <mark.eibes@gmail.com> dateMon 16 Feb 2026, 22:46 (7 months ago) parent8c1f4cf
4 files changed+28−3
docs/src/Docs/Pages/InputControls.purs+2−1 example-macos/macos/YogaReactExample-macOS/RCTMacOSControlsManager.m+24−1 example-macos/src/Demo/Chat.purs+1−1 src/Yoga/React/Native/MacOS/Button.purs+1
docs/src/Docs/Pages/InputControls.purs+2−1
@@ -33,7 +33,8 @@ button = L.componentDoc "nativeButton" "Yoga.React.Native.MacOS.Button (nativeBu
3333 , onPress: handler_ doSomething
3434 }"""
3535 [ propsTable
36− [ { name: "title", type_: "String", description: "Button label text" }
36+ [ { name: "title", type_: "String", description: "Button label text (mutually exclusive with sfSymbol)" }
37+ , { name: "sfSymbol", type_: "String", description: "SF Symbol icon (mutually exclusive with title)" }
3738 , { name: "bezelStyle", type_: "BezelStyle", description: "push | toolbar | texturedSquare | inline" }
3839 , { name: "destructive", type_: "Boolean", description: "Red destructive styling" }
3940 , { name: "primary", type_: "Boolean", description: "Primary action button" }
example-macos/macos/YogaReactExample-macOS/RCTMacOSControlsManager.m+24−1
@@ -24,6 +24,7 @@
2424@property (nonatomic, strong) NSButton *button;
2525@property (nonatomic, copy) RCTBubblingEventBlock onPress;
2626@property (nonatomic, copy) NSString *title;
27+@property (nonatomic, copy) NSString *sfSymbol;
2728@property (nonatomic, copy) NSString *bezelStyle;
2829@property (nonatomic, assign) BOOL destructive;
2930@property (nonatomic, assign) BOOL primary;
@@ -48,7 +49,28 @@
4849
4950- (void)setTitle:(NSString *)title {
5051 _title = title;
51− _button.title = title ?: @"";
52+ if (title.length > 0) {
53+ _button.image = nil;
54+ _button.title = title;
55+ } else {
56+ _button.title = @"";
57+ }
58+}
59+
60+- (void)setSfSymbol:(NSString *)sfSymbol {
61+ _sfSymbol = sfSymbol;
62+ if (sfSymbol.length > 0) {
63+ NSImage *img = [NSImage imageWithSystemSymbolName:sfSymbol accessibilityDescription:sfSymbol];
64+ if (img) {
65+ _button.image = img;
66+ _button.title = @"";
67+ _button.imagePosition = NSImageOnly;
68+ }
69+ } else {
70+ _button.image = nil;
71+ _button.title = _title ?: @"";
72+ _button.imagePosition = NSNoImage;
73+ }
5274}
5375
5476- (void)setBezelStyle:(NSString *)bezelStyle {
@@ -87,6 +109,7 @@
87109RCT_EXPORT_MODULE(NativeButton)
88110- (NSView *)view { return [[RCTNativeButtonView alloc] initWithFrame:CGRectZero]; }
89111RCT_EXPORT_VIEW_PROPERTY(title, NSString)
112+RCT_EXPORT_VIEW_PROPERTY(sfSymbol, NSString)
90113RCT_EXPORT_VIEW_PROPERTY(bezelStyle, NSString)
91114RCT_EXPORT_VIEW_PROPERTY(destructive, BOOL)
92115RCT_EXPORT_VIEW_PROPERTY(primary, BOOL)
example-macos/src/Demo/Chat.purs+1−1
@@ -366,7 +366,7 @@ chatDemo = component "ChatDemo" \dp -> React.do
366366 , style: tw "flex-1" <> Style.style { height: 28.0 }
367367 }
368368 , nativeButton
369− { title: ""
369+ { sfSymbol: "paperplane.fill"
370370 , bezelStyle: T.toolbar
371371 , onPress: handler_ (sendMessage rid inputText)
372372 , style: Style.style { height: 28.0, width: 36.0, marginLeft: 8.0 }
src/Yoga/React/Native/MacOS/Button.purs+1
@@ -13,6 +13,7 @@ nativeButton = createNativeElement_ buttonImpl
1313
1414type NativeButtonAttributes = BaseAttributes
1515 ( title :: String
16+ , sfSymbol :: String
1617 , bezelStyle :: BezelStyle
1718 , destructive :: Boolean
1819 , primary :: Boolean