segmented-control
segmented-control copied to clipboard
apportionsSegmentWidthsByContent
Is there any possibility to use apportionsSegmentWidthsByContent from UISegmentedControl to adjust segment widths based on their content widths?
+1 To this. It would especially be useful when there is limited horizontal space and some labels are shorter than others.
+1, for now we added with the patch below
diff --git a/index.d.ts b/index.d.ts
index aa8d5f54d135e16952d630084571e872329dc26b..4b4bf423288413dbbc17b0db33deabf7e2c79179 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -116,6 +116,8 @@ export interface SegmentedControlProps extends ViewProps {
* Style properties for the Animated.View component
*/
sliderStyle?: ViewStyle;
+
+ apportionsSegmentWidthsByContent?: boolean;
}
/**
diff --git a/ios/RNCSegmentedControlManager.m b/ios/RNCSegmentedControlManager.m
index 553bc1f35d40fa196fb70dfff3e3a82924262cc6..70081e2c01a87a72cc6eea177fd0531106baded0 100644
--- a/ios/RNCSegmentedControlManager.m
+++ b/ios/RNCSegmentedControlManager.m
@@ -25,6 +25,7 @@ RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(momentary, BOOL)
RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
+RCT_EXPORT_VIEW_PROPERTY(apportionsSegmentWidthsByContent, BOOL)
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(appearance, NSString)
RCT_EXPORT_VIEW_PROPERTY(testIDS, NSArray)