@expo/react-native-action-sheet
Advanced tools
Comparing version 0.3.1 to 1.0.0
@@ -6,3 +6,3 @@ // @flow | ||
Animated, | ||
BackAndroid, | ||
BackHandler, | ||
Easing, | ||
@@ -27,3 +27,3 @@ PixelRatio, | ||
textStyle: ?any, | ||
} | ||
}; | ||
@@ -38,3 +38,3 @@ type ActionGroupProps = { | ||
textStyle: ?any, | ||
} | ||
}; | ||
@@ -48,3 +48,3 @@ type ActionSheetState = { | ||
sheetOpacity: any, | ||
} | ||
}; | ||
@@ -54,3 +54,3 @@ type ActionSheetProps = { | ||
useNativeDriver: ?boolean, | ||
} | ||
}; | ||
@@ -97,11 +97,6 @@ const OPACITY_ANIMATION_TIME = 150; | ||
let iconElement = undefined | ||
let iconElement = undefined; | ||
if (icons && icons[i]) { | ||
iconElement = ( | ||
<Image | ||
source={icons[i]} | ||
style={styles.icon} | ||
/> | ||
) | ||
iconElement = <Image source={icons[i]} style={styles.icon} />; | ||
} | ||
@@ -117,3 +112,3 @@ | ||
{iconElement} | ||
<Text style={[styles.text, {color}, textStyle]}> | ||
<Text style={[styles.text, { color }, textStyle]}> | ||
{options[i]} | ||
@@ -155,7 +150,12 @@ </Text> | ||
let { isVisible } = this.state; | ||
let overlay = isVisible ? ( | ||
<Animated.View style={[styles.overlay, { | ||
opacity: this.state.overlayOpacity, | ||
}]} /> | ||
) : null; | ||
let overlay = isVisible | ||
? <Animated.View | ||
style={[ | ||
styles.overlay, | ||
{ | ||
opacity: this.state.overlayOpacity, | ||
}, | ||
]} | ||
/> | ||
: null; | ||
@@ -165,3 +165,3 @@ let sheet = isVisible ? this._renderSheet() : null; | ||
return ( | ||
<View style={{flex: 1}}> | ||
<View style={{ flex: 1 }}> | ||
{React.Children.only(this.props.children)} | ||
@@ -185,6 +185,16 @@ {overlay} | ||
needsOffscreenAlphaCompositing={this.state.isAnimating} | ||
style={[styles.sheetContainer, { | ||
opacity: this.state.sheetOpacity, | ||
transform: [{scale: this.state.sheetOpacity.interpolate({inputRange: [0, 0.5, 1], outputRange: [0.6, 1, 1]})}], | ||
}]}> | ||
style={[ | ||
styles.sheetContainer, | ||
{ | ||
opacity: this.state.sheetOpacity, | ||
transform: [ | ||
{ | ||
scale: this.state.sheetOpacity.interpolate({ | ||
inputRange: [0, 0.5, 1], | ||
outputRange: [0.6, 1, 1], | ||
}), | ||
}, | ||
], | ||
}, | ||
]}> | ||
<View style={styles.sheet}> | ||
@@ -248,3 +258,6 @@ <ActionGroup | ||
BackAndroid.addEventListener('actionSheetHardwareBackPress', this._selectCancelButton); | ||
BackHandler.addEventListener( | ||
'actionSheetHardwareBackPress', | ||
this._selectCancelButton | ||
); | ||
} | ||
@@ -262,3 +275,3 @@ | ||
} | ||
} | ||
}; | ||
@@ -272,3 +285,3 @@ _onSelect = (index: number): boolean => { | ||
return this._animateOut(); | ||
} | ||
}; | ||
@@ -280,3 +293,6 @@ _animateOut = (): boolean => { | ||
BackAndroid.removeEventListener('actionSheetHardwareBackPress', this._selectCancelButton); | ||
BackHandler.removeEventListener( | ||
'actionSheetHardwareBackPress', | ||
this._selectCancelButton | ||
); | ||
@@ -314,7 +330,7 @@ this.setState({ | ||
return true; | ||
} | ||
}; | ||
} | ||
ActionSheet.defaultProps = { | ||
useNativeDriver: true | ||
useNativeDriver: true, | ||
}; | ||
@@ -324,3 +340,5 @@ | ||
TouchableComponent = Platform.Version <= 20 ? TouchableOpacity : TouchableNativeFeedback; | ||
TouchableComponent = Platform.Version <= 20 | ||
? TouchableOpacity | ||
: TouchableNativeFeedback; | ||
@@ -334,3 +352,2 @@ if (TouchableComponent !== TouchableNativeFeedback) { | ||
class TouchableNativeFeedbackSafe extends React.Component { | ||
static SelectableBackground = TouchableComponent.SelectableBackground; | ||
@@ -337,0 +354,0 @@ static SelectableBackgroundBorderless = TouchableComponent.SelectableBackgroundBorderless; |
'use strict'; | ||
import React from 'react'; | ||
import { | ||
ActionSheetIOS, | ||
View, | ||
} from 'react-native'; | ||
import { ActionSheetIOS, View } from 'react-native'; | ||
@@ -12,3 +9,3 @@ export default class ActionSheet extends React.Component { | ||
return ( | ||
<View style={{flex: 1}}> | ||
<View style={{ flex: 1 }}> | ||
{React.Children.only(this.props.children)} | ||
@@ -15,0 +12,0 @@ </View> |
@@ -6,3 +6,3 @@ import React from 'react'; | ||
static propTypes = { | ||
children: React.PropTypes.any | ||
children: React.PropTypes.any, | ||
}; | ||
@@ -16,3 +16,4 @@ | ||
return { | ||
showActionSheetWithOptions: (...args) => this._actionSheetRef.showActionSheetWithOptions(...args), | ||
showActionSheetWithOptions: (...args) => | ||
this._actionSheetRef.showActionSheetWithOptions(...args), | ||
}; | ||
@@ -28,2 +29,2 @@ } | ||
} | ||
} | ||
} |
@@ -5,5 +5,9 @@ import hoistStatics from 'hoist-non-react-statics'; | ||
export default function connectActionSheet(WrappedComponent) { | ||
const ConnectedActionSheet = (props, context) => { | ||
return <WrappedComponent {...props} showActionSheetWithOptions={context.showActionSheetWithOptions} />; | ||
return ( | ||
<WrappedComponent | ||
{...props} | ||
showActionSheetWithOptions={context.showActionSheetWithOptions} | ||
/> | ||
); | ||
}; | ||
@@ -10,0 +14,0 @@ |
{ | ||
"name": "@expo/react-native-action-sheet", | ||
"version": "0.3.1", | ||
"version": "1.0.0", | ||
"description": "A cross-platform ActionSheet for React Native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
14032
422
0
1