mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-03 22:43:35 +08:00
Summary: Fixes #534:  ```jsx <SegmentedControlIOS tintColor="#ff0000" values={['One', 'Two', 'Three', 'Four']} selectedtIndex={0} momentary={false} enabled={true} onValueChange={ (value) => console.log(value) } /> ``` This only supports string-based segments, not images. Also doesn't support full customization (no separator images etc); I figure this is a good MVP to lock-down a basic API I also included a snapshot test case, but the images keep coming out funky. When I look at the sim, I see that the text labels show up for the selected segment, but the snapshot keeps coming out with no text on those segments. I tried forcing a delay, but same result. Is that explainable? Obviously happy to change anything about the API, code-style nitpicks, etc Closes https://github.com/facebook/react-native/pull/564 Github Author: Clay Allsopp <clay.allsopp@gmail.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
21 lines
458 B
Objective-C
21 lines
458 B
Objective-C
//
|
|
// RCTSegmentedControl.h
|
|
// React
|
|
//
|
|
// Created by Clay Allsopp on 3/31/15.
|
|
// Copyright (c) 2015 Facebook. All rights reserved.
|
|
//
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
@class RCTEventDispatcher;
|
|
|
|
@interface RCTSegmentedControl : UISegmentedControl
|
|
|
|
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
|
|
|
|
@property (nonatomic, copy) NSArray *values;
|
|
@property (nonatomic, assign) NSInteger selectedIndex;
|
|
|
|
@end
|