Skip to content

Commit

Permalink
merge #808, added capitalize prop for button and text
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivraj committed May 8, 2017
1 parent 56f9c6b commit 1a5f123
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 31 deletions.
13 changes: 6 additions & 7 deletions dist/src/basic/Button.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/basic/Button.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion dist/src/basic/Text.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/basic/Text.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ declare module 'native-base' {
/**
* see Widget CheckBox.js
*/
interface Radio extends ReactNative.TouchableOpacityProperties{
interface Radio extends ReactNative.TouchableOpacityProperties {
selected?: boolean
}
/**
Expand Down Expand Up @@ -575,31 +575,31 @@ declare module 'native-base' {
springFriction?: number
}

interface Tab{
interface Tab {
heading:TabHeading,

}
interface TabHeading{
interface TabHeading {
activeTabStyle?:ReactNative.ViewStyle,
textStyle?:ReactNative.TextStyle,
activeTextStyle?:ReactNative.TextStyle
}

interface Item {
fixedLabel?:boolean,
floatingLabel?:boolean,
inlineLabel?:boolean,
stackedLabel?:boolean,
placeholderLabel?:boolean,
bordered?:boolean,
underline?:boolean,
rounded?:boolean,
fixedLabel?: boolean,
floatingLabel?: boolean,
inlineLabel?: boolean,
stackedLabel?: boolean,
placeholderLabel?: boolean,
bordered?: boolean,
underline?: boolean,
rounded?: boolean,
disabled?: boolean,
error?: boolean,
placeholder?:string,
secureTextEntry?:boolean,
placeholder?: string,
secureTextEntry?: boolean,
success?: boolean,
last?:boolean,
last?: boolean,
}

interface Form{
Expand Down
11 changes: 5 additions & 6 deletions src/basic/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@


import React, { Component } from 'react';
import _ from 'lodash';
import { TouchableOpacity, Platform, View, TouchableNativeFeedback } from 'react-native';
import { connectStyle } from 'native-base-shoutem-theme';
import variables from './../theme/variables/platform';
import { Badge } from './Badge';
import { Text } from './Text';
import computeProps from '../Utils/computeProps';

Expand All @@ -31,14 +29,17 @@ class Button extends Component {
return computeProps(this.props, defaultProps);
}
render() {
const children = Platform.OS === 'ios'
? this.props.children
: React.Children.map(this.props.children, child => child.type === Text ? React.cloneElement(child, { capitalize: true, ...child.props }) : child);
if (Platform.OS==='ios' || variables.androidRipple===false || Platform['Version'] <= 21) {
return (
<TouchableOpacity
{...this.prepareRootProps()}
ref={c => this._root = c}
activeOpacity={(this.props.activeOpacity) ? this.props.activeOpacity : 0.5}
>
{this.props.children}
{children}
</TouchableOpacity>
);
}
Expand All @@ -49,7 +50,7 @@ class Button extends Component {
background={(this.props.androidRippleColor) ? TouchableNativeFeedback.Ripple(this.props.androidRippleColor) : TouchableNativeFeedback.Ripple(variables.androidRippleColor)}
{...this.prepareRootProps()}>
<View {...this.prepareRootProps()}>
{this.props.children}
{children}
</View>
</TouchableNativeFeedback>
);
Expand All @@ -74,8 +75,6 @@ Button.propTypes = {
large: React.PropTypes.bool,
small: React.PropTypes.bool,
active: React.PropTypes.bool,
badgeColor: React.PropTypes.string,
badgeValueStyle: React.PropTypes.object,
};

Button.defaultProps = {
Expand Down
Loading

0 comments on commit 1a5f123

Please sign in to comment.