Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type State = {
initialTextWidth?: number,
};
class HeaderBackButton extends PureComponent {
static propTypes = {
onPress: PropTypes.func.isRequired,
title: PropTypes.string,
tintColor: PropTypes.string,
truncatedTitle: PropTypes.string,
width: PropTypes.number,
};
static defaultProps = {
tintColor: Platform.select({
ios: '#037aff',
}),
truncatedTitle: 'Back',
};
state = {};
_onTextLayout = (e) => {
if (this.state.initialTextWidth) {
return;
}
this.setState({
initialTextWidth: e.nativeEvent.layout.x + e.nativeEvent.layout.width,
});
};
},
iconRight: {
marginLeft: 10 * 2
},
small: {
padding: 12 * 2
},
smallFont: {
fontSize: normalize(14 * 2)
},
activityIndicatorStyle: {
marginHorizontal: 10,
height: 0
},
raised: {
...Platform.select({
ios: {
shadowColor: 'rgba(0,0,0, .4)',
shadowOffset: {height: 1, width: 1},
shadowOpacity: 1,
shadowRadius: 1
},
android: {
elevation: 2
}
})
}
});
export default Button;
}
{ !image && children}
;
const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
borderColor: colors.grey5,
borderWidth: 1,
padding: 15 * 2,
margin: 15 * 2,
marginBottom: 0,
...Platform.select({
ios: {
shadowColor: 'rgba(0,0,0, .2)',
shadowOffset: {height: 0, width: 0},
shadowOpacity: 1,
shadowRadius: 1
},
android: {
elevation: 1
}
})
},
imageTitle: {
fontSize: normalize(14 * 2),
marginBottom: 8 * 2,
color: colors.grey1,
fontWeight: '500'