Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SegmentedControl.propTypes = {
, onValueChange: React.PropTypes.func
, androidTint: React.PropTypes.string //Android Specific, overrides tintColor
, height: React.PropTypes.number //Android Specific
, androidTextActive: React.PropTypes.string //Android Specific
, androidTextColor: React.PropTypes.string //Android Specific
};

SegmentedControl.defaultProps = {
Expand Down Expand Up @@ -105,4 +107,4 @@ const styles = StyleSheet.create({
, marginBottom: 5
}
});
```
```
27 changes: 16 additions & 11 deletions android/segmentedControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
, TouchableWithoutFeedback
, Dimensions
} from 'react-native';
import PropTypes from 'prop-types';

class SegmentedControl extends Component {

Expand Down Expand Up @@ -60,8 +61,8 @@ class SegmentedControl extends Component {
<Text
style={[styles.textValue, {
color: p.selectedIndex == i
? 'black'
: 'grey'
? this.props.androidTextActive
: this.props.androidTextColor
}]}>{v}</Text>
</View>
</TouchableWithoutFeedback>)}
Expand All @@ -70,20 +71,24 @@ class SegmentedControl extends Component {
}
}

SegmentedControl.propTypes = {
values: React.PropTypes.arrayOf(React.PropTypes.string).isRequired
, tintColor: React.PropTypes.string
, enabled: React.PropTypes.bool
, onChange: React.PropTypes.func
, onValueChange: React.PropTypes.func
, androidTint: React.PropTypes.string //Android Specific
, height: React.PropTypes.number //Android Specific
SegmentedControl.PropTypes = {
values: PropTypes.arrayOf(PropTypes.string).isRequired
, tintColor: PropTypes.string
, enabled: PropTypes.bool
, onChange: PropTypes.func
, onValueChange: PropTypes.func
, androidTint: PropTypes.string //Android Specific
, height: PropTypes.number //Android Specific
, androidTextActive: PropTypes.string //Android Specific
, androidTextColor: PropTypes.string //Android Specific
};

SegmentedControl.defaultProps = {
height: 38
, enabled: true
, tintColor: 'black'
, androidTextActive: 'black'
, androidTextColor: 'grey'
};

const styles = StyleSheet.create({
Expand All @@ -108,4 +113,4 @@ const styles = StyleSheet.create({
}
});

export default SegmentedControl;
export default SegmentedControl;
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/natdm/segmentedControl.git"
"url": "git+https://github.com/ClearScholar/segmentedControl.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/natdm/segmentedControl/issues"
"url": "https://github.com/ClearScholar/segmentedControl/issues"
},
"homepage": "https://github.com/natdm/segmentedControl#readme"
"homepage": "https://github.com/ClearScholar/segmentedControl#readme",
"devDependencies": {
"prop-types": "^15.6.2"
}
}