//@ts-nocheck import React, { Component } from 'react' import { View, Text, StyleSheet, Image, TouchableOpacity, ScrollView, Animated, Easing, DeviceEventEmitter } from 'react-native'; import { px2dp, onePx, colors, deepCopy, toast, toastShort, handleDismissKeyboard, getLocalTime, validResponseCode, isEmpty, comErrorMsg } from '../../utils'; interface Props { onChange: Function } export default class SlopeDirectionToast extends Component{ constructor(props) { super(props); this.state = { title: '', opacity: new Animated.Value(0), direction: "", }; this.show = this.show.bind(this); this.active = false; } componentWillUnmount() { this.delayHide && clearTimeout(this.delayHide) this.setState = (state, callback) => { return; } } public handler = null; public toast = null; show = (value) => { this.setState({ direction: value }) handleDismissKeyboard(); this.toast.setNativeProps({ style: { zIndex: 998, width: '100%', height: '100%' } }) Animated.timing( this.state.opacity, { toValue: 0.32, duration: 250, easing: Easing.in(), useNativeDriver: true } ).start(); } hide = () => { this.active = false; handleDismissKeyboard(); requestAnimationFrame(() => { Animated.timing( this.state.opacity, { toValue: 0, duration: 100, easing: Easing.in(), useNativeDriver: true } ).start(); this.delayHide = setTimeout(() => { this.toast.setNativeProps({ style: { zIndex: -999, width: 0, height: 0 } }) this.setState({ config: {}, valueText: "" }) }, 100); }) } confirmToSave(value) { this.hide(); let option = { name: value }; const { onChange } = this.props; onChange && onChange(option); }; render() { const { type } = this.props; const { direction } = this.state; return ( this.toast = c} style={styles.toastContainer}> 请选择坡向 this.confirmToSave("北")} > 北 this.confirmToSave("东北")} > 东北 this.confirmToSave("东")} > 东 this.confirmToSave("东南")} > 东南 this.confirmToSave("南")} > 南 this.confirmToSave("西南")} > 西南 this.confirmToSave("西")} > 西 this.confirmToSave("西北")} > 西北 this.confirmToSave("无坡向")} > 无坡向 ) } } const styles = StyleSheet.create({ toastContainer: { position: 'absolute', width: 0, height: 0, justifyContent: 'center', alignItems: 'center', overflow: 'hidden', zIndex: -999, // backgroundColor:'#999' }, toastOverlay: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, width: '100%', height: '100%', backgroundColor: '#000' }, toastContent: { width: px2dp(300), backgroundColor: '#fff', borderRadius: px2dp(8), justifyContent: 'center', alignItems: 'center', overflow: 'hidden', }, toastHeader: { position: 'relative', width: '100%', justifyContent: 'center', alignItems: 'center', paddingVertical: px2dp(12), borderBottomColor: colors.borderColor, borderBottomWidth: onePx, }, closeBtn: { position: 'absolute', right: px2dp(12), top: px2dp(12), width: px2dp(32), height: px2dp(32), // backgroundColor: 'red', zIndex: 999 }, closeBtnContent: { width: px2dp(32), height: px2dp(32), justifyContent: 'center', alignItems: 'center' }, toastBody: { width: '100%', justifyContent: 'flex-start', alignItems: 'center', paddingHorizontal: px2dp(18), paddingTop: px2dp(12), paddingBottom: px2dp(0) }, buttonImage: { width: px2dp(260), height: px2dp(120), borderRadius: px2dp(8) }, buttonContent: { position: 'absolute', top: 0, left: 0, width: px2dp(260), height: px2dp(120), zIndex: 999, // backgroundColor: 'red', justifyContent: 'space-between', alignItems: 'center', paddingTop: px2dp(12) }, buttonText: { fontSize: 14, color: '#fff', opacity: 0.9, width: '100%', textAlign: 'left', paddingHorizontal: px2dp(10), paddingBottom: px2dp(4) }, buttonTitle: { fontSize: 24, color: '#fff', fontWeight: 'bold' }, title: { fontSize: 14, color: '#303133', fontWeight: '500', textAlign: 'center', letterSpacing: 0.8 }, toastFooter: { width: '100%', flexDirection: 'row', height: px2dp(52), borderTopColor: '#d2d2d2', borderTopWidth: onePx, justifyContent: 'space-around', alignItems: 'center', paddingHorizontal: px2dp(12) }, toastContentTop: { position: 'relative', width: '100%', paddingVertical: px2dp(56), flexDirection: 'row', justifyContent: 'center', alignItems: 'center', flexWrap: 'wrap', paddingHorizontal: px2dp(12), paddingBottom: px2dp(64), // backgroundColor: 'red' }, btn: { minWidth: px2dp(68), paddingHorizontal: px2dp(6), height: px2dp(32), backgroundColor: colors.themeColor, justifyContent: 'center', alignItems: 'center', borderRadius: px2dp(4), marginRight: px2dp(10), marginBottom: px2dp(10), // borderWidth: 1, // borderColor: colors.greenColor }, btnText: { fontSize: 14, color: '#fff' }, footerBtn: { width: px2dp(124), height: px2dp(32), backgroundColor: '#dfdcdf', justifyContent: 'center', alignItems: 'center', borderRadius: px2dp(4), }, toastRow: { width: '100%', backgroundColor: '#f6f6f6', height: px2dp(88), justifyContent: 'flex-start', alignItems: 'center', paddingHorizontal: px2dp(10), marginBottom: px2dp(12), borderRadius: px2dp(4), paddingVertical: px2dp(4) }, toastRowHeader: { width: '100%', height: px2dp(32), flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: px2dp(-4) }, toastRowInput: { width: '100%', fontSize: 15, color: '#303133', marginVertical: 0, marginTop: px2dp(-8) }, loadingContent: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', justifyContent: 'center', alignItems: 'center', paddingTop: px2dp(8), zIndex: 999 }, box: { width: '100%', justifyContent: 'center', alignItems: 'center' }, boxText: { fontSize: 14, color: '#303133', textAlign: 'center' }, smallBoxContent: { width: '100%', height: '100%', justifyContent: 'center', alignItems: 'center', // backgroundColor: 'red' }, smallBox1: { position: 'absolute', top: px2dp(52), left: px2dp(124), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox1: { position: 'absolute', top: px2dp(58), left: px2dp(124), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox2: { position: 'absolute', top: px2dp(96), right: px2dp(36), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox3: { position: 'absolute', top: px2dp(178), right: px2dp(8), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox4: { position: 'absolute', bottom: px2dp(28), left: px2dp(124), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox5: { position: 'absolute', bottom: px2dp(60), left: px2dp(36), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox6: { position: 'absolute', top: px2dp(178), left: px2dp(8), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox7: { position: 'absolute', top: px2dp(98), left: px2dp(36), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox8: { position: 'absolute', bottom: px2dp(60), right: px2dp(36), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, smallBox9: { position: 'absolute', bottom: px2dp(145), right: px2dp(126), width: px2dp(50), height: px2dp(42), backgroundColor: '#f2f5f8', zIndex: 999, borderRadius: px2dp(6), borderWidth: 1, borderColor: '#999', justifyContent: 'center', alignItems: 'center' }, closeBtn: { width: px2dp(36), height: px2dp(36), backgroundColor: 'rgba(255,255,255,0.9)', justifyContent: 'center', alignItems: 'center', marginTop: px2dp(20), borderRadius: px2dp(18) }, closeIcon: { width: px2dp(20), height: px2dp(20), tintColor: '#7f7f7f' }, })