Skip to content

Commit

Permalink
Merge branch 'master' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
sankhadeeproy007 committed Jan 4, 2017
2 parents fa577d6 + 293aa14 commit fd4931e
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 144 deletions.
76 changes: 76 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

# Contributing to NativeBase

Thank you for your interest in contributing to the [NativeBase](http://nativebase.io/) project!

In favor of active development, we accept contributions from everyone. NativeBase team is constantly marking issues and features that the community can implement. You can contribute by submitting a bug, creating pull requests or even by improving documentation. Beneath is the manual to be accompanied strictly earlier than submitting your pull requests / issues.

Take a look at [NativeBase on StackOverflow](http://stackoverflow.com/questions/tagged/native-base)


## Manual

1. [Coding Style](#1-coding-style)
2. [Git Flow](#2-git-flow)
- [Reporting Bugs](#a-reporting-bugs)
- [Request for New Feature](#b-request-for-new-feature)
- [Code Fixes and Enhancements](#c-code-fixes-and-enhancements)


### 1. Coding Style

To keep project away from disputes we make use of **ESLint**, which is really a handy linting tool that enforces strict coding styles and makes sure your files are free from dead code. Each module of NativeBase has bundled ESLint as a dev dependency.

In order to lint your code run following command.

```
cd AwesomeNativeBase
npm install eslint
```


### 2. Git Flow

NativeBase is an infant and growing rapidly, so we planned to stick to Git Flow. Below are the rules you need to follow:

#### a. Reporting Bugs

- Always update to the most recent `master` release; the bug may already be resolved.
- Search for similar issues in the issues list for this repo. It may already be an identified problem.
- If you want to contribute to an issue that is not part of this list, you are welcome to submit [new issue](https://github.com/GeekyAnts/NativeBase/issues/new) to our GitHub Repository.
- In that case, provide a short description of the visible symptoms. Include error messages, screen shots, and stack traces.
- If applicable, submit a step-by-step walkthrough of how to reproduce the issue.
- In any case, a **closed issue** is not necessarily the end of the story! If more info becomes available after an issue is closed, it can be reopened for further consideration.


#### b. Request for New Feature

- Use [Github Issues](https://github.com/GeekyAnts/NativeBase/issues) to submit feature requests.
- Search for a similar request and extend it if applicable. This way it would be easier for the NativeBase community to track the features.
- When a fresh new feature is requested, try to give as many details on your need as feasible. We prefer that you explain the need rather than explaining a technical solution for it. That might trigger a nice conversation on finding the best and broadest technical solution to a specific need.


####c. Code Fixes and Enhancements

- Before submitting a pull request, we appreciate if you create an issue first to discuss the change.
- Fork the repo you are planning to work on.
- Create a new branch from branch `master`.
- Example: `my-new-feature`
- Note: Please have your branch named apart from `master` and `development`.
- Work on your branch until you are confident enough to create a pull request.
- Conclude working on your branch and push to your forked repo.
- Create a pull request of your branch to NativeBase repo `master` branch.
- Provide a short description of the necessity and functionality of your PR. Include a step-by-step walkthrough of it with an use case example.
- Link the issues that are related to your PR in the body.
- If you have perfectly accompanied our contribution guide and that if your new feature / bug fixes sounds good to us, then we will merge the changes and you are free to delete your branch.
- After your contribution is merged, it’s not immediately available to all users. Your change will be shipped as part of the next release.


**Note:** NativeBase changes a lot and is in constant mutation. We usually merge multiple PRs per day, so sometimes when we are done reviewing, your code might not work with the latest `master` branch anymore. To prevent this, before you make any changes after your code has been reviewed, you should always rebase the latest changes from the `master` branch.






5 changes: 5 additions & 0 deletions Components/Themes/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ export default {
// Footer
footerHeight: 55,
footerDefaultBg: (Platform.OS === 'ios' ) ? '#F8F8F8' : '#4179F7',
footerBtnMargin: 1,


//FooterTab
tabBarTextColor: (Platform.OS === 'ios' ) ? '#6b6b6b' : '#b3c7f9',
tabBarActiveTextColor: (Platform.OS === 'ios' ) ? '#007aff' : '#fff',
tabActiveBgColor: (Platform.OS=='ios') ? '#cde1f9' : undefined,
tabActiveBorderRadius: (Platform.OS=='ios') ? 7 : undefined,
tabBarTextSize: (Platform.OS=='ios') ? 12.5 : 10,
tabBarActiveTextSize: (Platform.OS=='ios') ? 12.5 : 11,

//Tab
tabDefaultBg: (Platform.OS === 'ios' ) ? '#F8F8F8' : '#4179F7',
Expand Down Expand Up @@ -178,6 +181,7 @@ export default {
listItemPadding: (Platform.OS === 'ios' ) ? 12 : 16,
listNoteColor: '#808080',
listNoteSize: 13,
listMarginLeft: 15,


// Progress Bar
Expand Down Expand Up @@ -208,6 +212,7 @@ export default {
// Text
textColor: '#000',
inverseTextColor: '#fff',
textBgColor: 'transparent',


// Title
Expand Down
10 changes: 5 additions & 5 deletions Components/Widgets/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default class Button extends NativeBaseComponent {
iconPresent() {
var iconComponentPresent = false;
React.Children.forEach(this.props.children, function (child) {
if(child.type == Icon)
if(_.get(child, 'type', null) == Icon)
iconComponentPresent = true;
})
return iconComponentPresent;
Expand All @@ -160,7 +160,7 @@ export default class Button extends NativeBaseComponent {
return <Text style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? this.props.children : this.props.children.toUpperCase()}</Text>
}

else if(this.props.children.type == IconNB) {
else if(_.get(this.props.children, 'type', null) == IconNB) {
return React.cloneElement(this.props.children, this.getIconProps(this.props.children));
}

Expand All @@ -171,13 +171,13 @@ export default class Button extends NativeBaseComponent {

var iconElement = [];
iconElement = _.remove(childrenArray, function(item) {
if(item.type == IconNB) {
if(_.get(item, 'type', null) == IconNB) {
return true;
}
});

if(this.props.iconRight) {
if (childrenArray[0].type==undefined) {
if (_.get(childrenArray[0], 'type', null)==undefined) {
newChildren.push(<Text key='label' style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? childrenArray[0] : childrenArray[0].toUpperCase()}</Text>);
} else {
newChildren.push(<Text key='label' style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? childrenArray[0].props.children : childrenArray[0].props.children.toUpperCase()}</Text>);
Expand All @@ -189,7 +189,7 @@ export default class Button extends NativeBaseComponent {
else if(this.props.iconLeft || iconElement.length>0) {
newChildren.push(React.cloneElement(iconElement[0], this.getIconProps(iconElement[0])));

if (childrenArray[0].type==undefined) {
if (_.get(childrenArray[0], 'type', null)==undefined) {
newChildren.push(<Text key='label' style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? childrenArray[0] : childrenArray[0].toUpperCase()}</Text>);
} else {
newChildren.push(<Text key='label' style={this.getTextStyle()}>{(Platform.OS==='ios' || !this.props.capitalize) ? childrenArray[0].props.children : childrenArray[0].props.children.toUpperCase()}</Text>);
Expand Down
26 changes: 13 additions & 13 deletions Components/Widgets/CardItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default class CardItemNB extends NativeBaseComponent {
thumbnailPresent() {
let thumbnailComponentPresent = false;
React.Children.forEach(this.props.children, (child) => {
if (child && child.type === Thumbnail) {
if (child && _.get(child, 'type', null) === Thumbnail) {
thumbnailComponentPresent = true;
}
});
Expand All @@ -117,7 +117,7 @@ export default class CardItemNB extends NativeBaseComponent {
gravatarPresent() {
var gravatarComponentPresent = false;
React.Children.forEach(this.props.children, function (child) {
if(child.type == Gravatar)
if(_.get(child, 'type', null) == Gravatar)
gravatarComponentPresent = true;
})

Expand All @@ -127,7 +127,7 @@ export default class CardItemNB extends NativeBaseComponent {
imagePresent() {
let imagePresent = false;
React.Children.forEach(this.props.children, (child) => {
if (child && child.type === Image) {
if (child && _.get(child, 'type', null) === Image) {
imagePresent = true;
}
});
Expand All @@ -138,7 +138,7 @@ export default class CardItemNB extends NativeBaseComponent {
iconPresent() {
let iconComponentPresent = false;
React.Children.forEach(this.props.children, (child) => {
if (child && child.type === Icon) {
if (child && _.get(child, 'type', null) === Icon) {
iconComponentPresent = true;
}
});
Expand All @@ -149,7 +149,7 @@ export default class CardItemNB extends NativeBaseComponent {
buttonPresent() {
let buttonComponentPresent = false;
React.Children.forEach(this.props.children, (child) => {
if (child && child.type === Button) {
if (child && _.get(child, 'type', null) === Button) {
buttonComponentPresent = true;
}
});
Expand All @@ -165,7 +165,7 @@ export default class CardItemNB extends NativeBaseComponent {
let notePresent = false;

React.Children.forEach(this.props.children, (child) => {
if (child && (child.type === Text) && child.props.note) {
if (child && (_.get(child, 'type', null) === Text) && child.props.note) {
notePresent = true;
}
});
Expand All @@ -188,18 +188,18 @@ export default class CardItemNB extends NativeBaseComponent {

getChildProps(child) {
let defaultProps = {};
if (child.type === Image && !Array.isArray(this.props.children)) {
if (_.get(child, 'type', null) === Image && !Array.isArray(this.props.children)) {
defaultProps = {
resizeMode: 'cover',
style: this.getInitialStyle().fullImage
};
} else
if (child.type === Button) {
if (_.get(child, 'type', null) === Button) {
defaultProps = {
style: this.getInitialStyle().itemButton
};
} else
if (child.type === Text) {
if (_.get(child, 'type', null) === Text) {
if ((this.props.header) || (this.props.footer)) {
defaultProps = {
style: this.getInitialStyle().dividerItemText
Expand All @@ -217,19 +217,19 @@ export default class CardItemNB extends NativeBaseComponent {
style: this.getInitialStyle().itemText
};
}
} else if (child.type === Icon) {
} else if (_.get(child, 'type', null) === Icon) {
defaultProps = {
style: this.getInitialStyle().itemIcon
};
} else if (child.type === Thumbnail) {
} else if (_.get(child, 'type', null) === Thumbnail) {
defaultProps = {
style: this.getInitialStyle().thumbnail
};
} else if(child.type == Gravatar) {
} else if(_.get(child, 'type', null) == Gravatar) {
defaultProps = {
style: this.getInitialStyle().gravatar
};
} else if (child.type === Image) {
} else if (_.get(child, 'type', null) === Image) {
defaultProps = {
style: this.getInitialStyle().fullImage
};
Expand Down
8 changes: 4 additions & 4 deletions Components/Widgets/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export default class Container extends NativeBaseComponent {
renderHeader() {
if(Array.isArray(this.props.children)) {
return _.find(this.props.children, function(item) {
if(item && item.type == Header) {
if(item && _.get(item, 'type', null) == Header) {
return true;
}
});
}

else {
if(this.props.children && this.props.children.type == Header) {
if(this.props.children && _.get(this.props.children, 'type', null) == Header) {
return this.props.children;
}
}
Expand All @@ -37,7 +37,7 @@ export default class Container extends NativeBaseComponent {
if(Array.isArray(this.props.children)) {

return _.filter(this.props.children, function(item) {
if(item && (item.type == ViewNB || item.type == Content || item.type == Image || item.type == View || item.type == ScrollView || item.type == Fab )) {
if(item && (_.get(item, 'type', null) == ViewNB || _.get(item, 'type', null) == Content || _.get(item, 'type', null) == Image || _.get(item, 'type', null) == View || _.get(item, 'type', null) == ScrollView || _.get(item, 'type', null) == Fab )) {

return true;
}
Expand All @@ -53,7 +53,7 @@ export default class Container extends NativeBaseComponent {
renderFooter() {
if(Array.isArray(this.props.children)) {
return _.find(this.props.children, function(item) {
if(item && item.type == Footer) {
if(item && _.get(item, 'type', null) == Footer) {
return true;
}
});
Expand Down
Loading

0 comments on commit fd4931e

Please sign in to comment.