@expo/react-native-action-sheet
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -18,2 +18,3 @@ // @flow | ||
View, | ||
ScrollView, | ||
} from 'react-native'; | ||
@@ -27,3 +28,3 @@ | ||
textStyle: ?any, | ||
} | ||
}; | ||
@@ -38,3 +39,3 @@ type ActionGroupProps = { | ||
textStyle: ?any, | ||
} | ||
}; | ||
@@ -48,3 +49,3 @@ type ActionSheetState = { | ||
sheetOpacity: any, | ||
} | ||
}; | ||
@@ -54,3 +55,3 @@ type ActionSheetProps = { | ||
useNativeDriver: ?boolean, | ||
} | ||
}; | ||
@@ -97,11 +98,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,5 +113,3 @@ | ||
{iconElement} | ||
<Text style={[styles.text, {color}, textStyle]}> | ||
{options[i]} | ||
</Text> | ||
<Text style={[styles.text, { color }, textStyle]}>{options[i]}</Text> | ||
</TouchableNativeFeedbackSafe> | ||
@@ -125,5 +119,3 @@ ); | ||
if (i < startIndex + length - 1) { | ||
optionViews.push( | ||
<View key={`separator-${i}`} style={styles.rowSeparator} /> | ||
); | ||
optionViews.push(<View key={`separator-${i}`} style={styles.rowSeparator} />); | ||
} | ||
@@ -134,3 +126,3 @@ } | ||
<View style={styles.groupContainer}> | ||
{optionViews} | ||
<ScrollView>{optionViews}</ScrollView> | ||
</View> | ||
@@ -158,5 +150,10 @@ ); | ||
let overlay = isVisible ? ( | ||
<Animated.View style={[styles.overlay, { | ||
opacity: this.state.overlayOpacity, | ||
}]} /> | ||
<Animated.View | ||
style={[ | ||
styles.overlay, | ||
{ | ||
opacity: this.state.overlayOpacity, | ||
}, | ||
]} | ||
/> | ||
) : null; | ||
@@ -167,3 +164,3 @@ | ||
return ( | ||
<View style={{flex: 1}}> | ||
<View style={{ flex: 1 }}> | ||
{React.Children.only(this.props.children)} | ||
@@ -187,6 +184,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}> | ||
@@ -263,3 +270,3 @@ <ActionGroup | ||
} | ||
} | ||
}; | ||
@@ -273,3 +280,3 @@ _onSelect = (index: number): boolean => { | ||
return this._animateOut(); | ||
} | ||
}; | ||
@@ -314,7 +321,7 @@ _animateOut = (): boolean => { | ||
return true; | ||
} | ||
}; | ||
} | ||
ActionSheet.defaultProps = { | ||
useNativeDriver: true | ||
useNativeDriver: true, | ||
}; | ||
@@ -333,3 +340,2 @@ | ||
class TouchableNativeFeedbackSafe extends React.Component { | ||
static SelectableBackground = TouchableComponent.SelectableBackground; | ||
@@ -343,13 +349,7 @@ static SelectableBackgroundBorderless = TouchableComponent.SelectableBackgroundBorderless; | ||
<TouchableComponent {...this.props} style={{}}> | ||
<View style={this.props.style}> | ||
{this.props.children} | ||
</View> | ||
<View style={this.props.style}>{this.props.children}</View> | ||
</TouchableComponent> | ||
); | ||
} else { | ||
return ( | ||
<TouchableComponent {...this.props}> | ||
{this.props.children} | ||
</TouchableComponent> | ||
); | ||
return <TouchableComponent {...this.props}>{this.props.children}</TouchableComponent>; | ||
} | ||
@@ -356,0 +356,0 @@ } |
'use strict'; | ||
import React from 'react'; | ||
import { | ||
ActionSheetIOS, | ||
View, | ||
} from 'react-native'; | ||
import { ActionSheetIOS, View } from 'react-native'; | ||
export default class ActionSheet extends React.Component { | ||
render() { | ||
return ( | ||
<View style={{flex: 1}}> | ||
{React.Children.only(this.props.children)} | ||
</View> | ||
); | ||
return <View style={{ flex: 1 }}>{React.Children.only(this.props.children)}</View>; | ||
} | ||
@@ -17,0 +10,0 @@ |
@@ -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), | ||
}; | ||
@@ -23,3 +24,3 @@ } | ||
return ( | ||
<ActionSheet ref={component => this._actionSheetRef = component}> | ||
<ActionSheet ref={component => (this._actionSheetRef = component)}> | ||
{React.Children.only(this.props.children)} | ||
@@ -29,2 +30,2 @@ </ActionSheet> | ||
} | ||
} | ||
} |
@@ -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": "0.4.0", | ||
"description": "A cross-platform ActionSheet for React Native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
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
13885
401
1