Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import {
Animated,
Dimensions,
Platform,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import { withNavigation, HeaderBackButton } from 'react-navigation';
import { getInset, getStatusBarHeight } from 'react-native-safe-area-view';
import { isIphoneX } from 'react-native-iphone-x-helper';
// @todo: make this work properly when in landscape
const hasNotch = isIphoneX();
const APPBAR_HEIGHT = Platform.OS === 'ios' ? 50 : 56;
const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
@withNavigation
export default class Header extends React.PureComponent {
constructor(props) {
super(props);
// @todo: this is static and we don't know if it's visible or not on iOS.
// need to use a more reliable and cross-platform API when one exists, like
// LayoutContext. We also don't know if it's translucent or not on Android
// and depend on react-native-safe-area-view to tell us.
const ANDROID_STATUS_BAR_HEIGHT = getStatusBarHeight
? getStatusBarHeight()
: StatusBar.currentHeight;
const SafeView = ({ children }) => {
const isiphoneX = isIphoneX();
if (isiphoneX) {
return {children};
}
return children;
};
renderNav() {
return (
renderNavBar() {
return (
{
this.setState({ imageData: {} });
Actions.pop({ duration: 0 });
}}
>
{t('lbl_nav_cancel')}
))}
)}
{!isCommentsScreen && (
}
onChangeAssetAmount={this.onChangeAssetAmount}
onChangeNativeAmount={this.onChangeNativeAmount}
onResetAssetSelection={this.onResetAssetSelection}
selected={selected}
txSpeedRenderer={
isIphoneX() && (
)
}
/>
)}
);
}
}
onPress={() => {
Alert.alert(
t('txt_logout'),
t('txt_want_to_logout'),
[
{ text: t('txt_no'), onPress: () => {}, style: 'cancel' },
{ text: t('txt_yes'),
onPress: () => {
this._service.logout();
},
},
],
{ cancelable: false },
);
}}
style={[styles.logout, { paddingBottom: isIphoneX() ? 50 : null }]}
>
);
}
}
width: event.nativeEvent.layout.width,
},
});
}}
/>
{this.renderSendButton()}
);
}
return (
render() {
return (
);
}
}
render() {
const recT = this.state.recordTime;
const recM = (recT - (recT % 60)) / 60;
const recS = (recT % 60);
return (