react-native-material-ui
Advanced tools
Comparing version 1.13.0 to 1.14.0
{ | ||
"name": "react-native-material-ui", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "React Native Material Design Components", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -60,2 +60,6 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
/** | ||
* Set ripple color | ||
*/ | ||
rippleColor: PropTypes.string, | ||
/** | ||
* You can overide any style for this button | ||
@@ -76,2 +80,3 @@ */ | ||
hidden: false, | ||
rippleColor: '#AAF', | ||
}; | ||
@@ -303,3 +308,3 @@ const contextTypes = { | ||
<RippleFeedback | ||
color="#AAF" | ||
color={this.props.rippleColor} | ||
onPress={() => this.onPress('main-button')} | ||
@@ -323,3 +328,3 @@ onLongPress={onLongPress} | ||
<RippleFeedback | ||
color="#AAF" | ||
color={this.props.rippleColor} | ||
onPress={() => this.onPress(key)} | ||
@@ -370,3 +375,3 @@ delayPressIn={20} | ||
<RippleFeedback | ||
color="#AAF" | ||
color={this.props.rippleColor} | ||
onPress={() => this.onPress(key)} | ||
@@ -408,3 +413,3 @@ delayPressIn={20} | ||
return ( | ||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> | ||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }} pointerEvents="box-only"> | ||
{result} | ||
@@ -411,0 +416,0 @@ </View> |
@@ -110,3 +110,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
<RippleFeedback onPress={onPress}> | ||
<View style={styles.container}> | ||
<View style={styles.container} pointerEvents="box-only"> | ||
{iconElement} | ||
@@ -113,0 +113,0 @@ <Text style={styles.label}>{label}</Text> |
@@ -192,3 +192,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
const content = ( | ||
<View style={styles.container}> | ||
<View style={styles.container} pointerEvents="box-only"> | ||
{this.renderIcon(styles)} | ||
@@ -195,0 +195,0 @@ <Text style={styles.text}> |
@@ -56,3 +56,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
return ( | ||
<RippleFeedback onPress={onPress}> | ||
<RippleFeedback onPress={onPress} pointerEvents="box-only"> | ||
{content} | ||
@@ -59,0 +59,0 @@ </RippleFeedback> |
@@ -93,3 +93,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
const content = ( | ||
<View style={styles.container}> | ||
<View style={styles.container} pointerEvents="box-only"> | ||
<IconToggle | ||
@@ -96,0 +96,0 @@ key={`${value}-${checked}`} |
@@ -44,3 +44,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
<RippleFeedback onPress={onPress} > | ||
<View style={styles.container}> | ||
<View style={styles.container} pointerEvents="box-only"> | ||
{children} | ||
@@ -47,0 +47,0 @@ </View> |
@@ -28,2 +28,6 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
onPressValue: PropTypes.any, | ||
/** | ||
* Called when list item is long pressed. | ||
*/ | ||
onLongPress: PropTypes.func, | ||
numberOfLines: PropTypes.oneOf([1, 2, 3, 'dynamic']), | ||
@@ -56,2 +60,6 @@ style: PropTypes.object, | ||
onRightElementPress: PropTypes.func, | ||
/** | ||
* Children passed into the `ListItem`. | ||
*/ | ||
children: PropTypes.node, | ||
}; | ||
@@ -62,2 +70,3 @@ const defaultProps = { | ||
onPressValue: null, | ||
onLongPress: null, | ||
divider: false, | ||
@@ -70,2 +79,3 @@ leftElement: null, | ||
numberOfLines: 1, | ||
children: null, | ||
style: {}, | ||
@@ -243,2 +253,9 @@ }; | ||
}; | ||
onListItemLongPressed = () => { | ||
const { onLongPress, onPressValue } = this.props; | ||
if (onLongPress) { | ||
onLongPress(onPressValue); | ||
} | ||
}; | ||
onLeftElementPressed = () => { | ||
@@ -418,3 +435,3 @@ const { onLeftElementPress, onPress, onPressValue } = this.props; | ||
renderContent = styles => ( | ||
<View style={styles.contentViewContainer}> | ||
<View style={styles.contentViewContainer} pointerEvents="box-only"> | ||
{this.renderLeftElement(styles)} | ||
@@ -426,3 +443,3 @@ {this.renderCenterElement(styles)} | ||
render() { | ||
const { onPress } = this.props; | ||
const { onPress, onLongPress } = this.props; | ||
@@ -434,5 +451,5 @@ const styles = getStyles(this.props, this.context, this.state); | ||
if (onPress) { | ||
if (onPress || onLongPress) { | ||
content = ( | ||
<RippleFeedback delayPressIn={50} onPress={this.onListItemPressed}> | ||
<RippleFeedback delayPressIn={50} onPress={this.onListItemPressed} onLongPress={this.onListItemLongPressed} > | ||
{content} | ||
@@ -439,0 +456,0 @@ </RippleFeedback> |
@@ -15,3 +15,3 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
searchValue: PropTypes.string.isRequired, | ||
searchable: PropTypes.object.isRequired, | ||
searchable: PropTypes.object, | ||
style: PropTypes.object, | ||
@@ -29,2 +29,3 @@ size: PropTypes.number, | ||
style: {}, | ||
searchable: null, | ||
}; | ||
@@ -31,0 +32,0 @@ const contextTypes = { |
@@ -160,11 +160,5 @@ /* eslint-disable import/no-unresolved, import/extensions */ | ||
const EMPTY_BACK_BUTTON_LISTENER = { remove: () => {} }; | ||
const getBackButtonListener = (callback, isSearchActive) => { | ||
// if search is active by default we need to listen back button | ||
if (isSearchActive) { | ||
return BackAndroid.addEventListener('closeRequested', callback); | ||
} | ||
const getBackButtonListener = callback => | ||
BackAndroid.addEventListener('hardwareBackPress', callback); | ||
return EMPTY_BACK_BUTTON_LISTENER; | ||
}; | ||
// const isSearchable = props => (props.searchable && props.isSearchActive) || false; | ||
@@ -189,6 +183,4 @@ // const getIsSearchActive = (props, state) => (props.searchable && state.isSearchActive) || false; | ||
const isSearchActive = props.isSearchActive || false; | ||
this.backButtonListener = getBackButtonListener( | ||
this.onSearchCloseRequested, | ||
isSearchActive, | ||
); | ||
this.backButtonListener = isSearchActive ? | ||
getBackButtonListener(this.onSearchCloseRequested) : null; | ||
@@ -254,3 +246,3 @@ this.state = { | ||
// on android it's typical that back button closes search input on toolbar | ||
this.backButtonListener = getBackButtonListener(this.onSearchCloseRequested, true); | ||
this.backButtonListener = getBackButtonListener(this.onSearchCloseRequested); | ||
}); | ||
@@ -292,4 +284,2 @@ } | ||
this.setState({ order: 'defaultFirst' }); | ||
// on android it's typical that back button closes search input on toolbar | ||
this.backButtonListener = getBackButtonListener(this.onSearchCloseRequested, false); | ||
@@ -304,3 +294,5 @@ this.onSearchClosed(); | ||
this.backButtonListener.remove(); | ||
if (this.backButtonListener) { | ||
this.backButtonListener.remove(); | ||
} | ||
@@ -307,0 +299,0 @@ if (searchable && isFunction(searchable.onSearchClosed)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
255803
5162