11
This commit is contained in:
		
							parent
							
								
									fc87ad0b3d
								
							
						
					
					
						commit
						cf03748a27
					
				| 
						 | 
				
			
			@ -106,6 +106,7 @@ const styles = StyleSheet.create({
 | 
			
		|||
    justifyContent: 'space-between',
 | 
			
		||||
    alignItems: 'center',
 | 
			
		||||
    padding: rpx(24),
 | 
			
		||||
    paddingTop: rpx(-20),
 | 
			
		||||
    height: '100%',
 | 
			
		||||
  },
 | 
			
		||||
  cont_left: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ import UnlockSetting from './device/UnlockSetting';
 | 
			
		|||
import BleDistance from './device/BleDistance';
 | 
			
		||||
import DeviceShare from './device/DeviceShare';
 | 
			
		||||
import AddShare from './device/AddShare';
 | 
			
		||||
import ShareQrcode from './device/shareQrcode'; 
 | 
			
		||||
// import BleBind from './bind/ble_bind';
 | 
			
		||||
import { getFocusedRouteNameFromRoute } from '@react-navigation/native';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +28,7 @@ type RootStackParamList = {
 | 
			
		|||
  UnlockSetting: undefined;
 | 
			
		||||
  DeviceShare: undefined;
 | 
			
		||||
  AddShare: undefined;
 | 
			
		||||
  ShareQrcode: undefined;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const Stack = createStackNavigator<RootStackParamList>();
 | 
			
		||||
| 
						 | 
				
			
			@ -54,12 +56,12 @@ type Props = {
 | 
			
		|||
export default function HomeStackNavigator({ navigation, route }: Props) {
 | 
			
		||||
  React.useEffect(() => {
 | 
			
		||||
    const routeName = getFocusedRouteNameFromRoute(route) ?? 'Home';
 | 
			
		||||
    const hideTabBarRoutes = ['DeviceList', 'BindIndex', 'SnBind', 'BleBind', 'ConfirmBind', 'DeviceMap', 'DeviceSet', 'UnlockSetting', 'BleDistance', 'DeviceShare']; // 添加新的路由名
 | 
			
		||||
    const shouldHideTabBar = hideTabBarRoutes.includes(routeName);
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    navigation.getParent()?.setOptions({
 | 
			
		||||
      tabBarStyle: shouldHideTabBar ? { display: 'none' } : undefined
 | 
			
		||||
    });
 | 
			
		||||
    // navigation.getParent()?.setOptions({
 | 
			
		||||
    //   tabBarStyle: shouldHideTabBar ? { display: 'none' } : undefined
 | 
			
		||||
    // });
 | 
			
		||||
  }, [navigation, route]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -122,6 +124,11 @@ export default function HomeStackNavigator({ navigation, route }: Props) {
 | 
			
		|||
        component={AddShare}
 | 
			
		||||
        options={createScreenOptions('添加共享人')}
 | 
			
		||||
      />  
 | 
			
		||||
      <Stack.Screen 
 | 
			
		||||
        name="ShareQrcode" 
 | 
			
		||||
        component={ShareQrcode}
 | 
			
		||||
        options={createScreenOptions('分享二维码')}
 | 
			
		||||
      />  
 | 
			
		||||
    </Stack.Navigator>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,8 +1,9 @@
 | 
			
		|||
import React, { useState } from 'react';
 | 
			
		||||
import { View, Text, StyleSheet, Image, TextInput, TouchableWithoutFeedback, Keyboard, TouchableOpacity, Modal } from 'react-native';
 | 
			
		||||
import { rpx } from '../../utils/rpx';
 | 
			
		||||
 | 
			
		||||
import { useNavigation } from '@react-navigation/native';
 | 
			
		||||
const AddShare = () => {
 | 
			
		||||
    const navigation = useNavigation();
 | 
			
		||||
    const [phone, setPhone] = useState('');
 | 
			
		||||
    const [name, setName] = useState('');
 | 
			
		||||
    const [time, setTime] = useState('');
 | 
			
		||||
| 
						 | 
				
			
			@ -12,6 +13,12 @@ const AddShare = () => {
 | 
			
		|||
    const [allowBleLocation, setAllowBleLocation] = useState(true);
 | 
			
		||||
    const handlePress = () => {
 | 
			
		||||
        setShowTimeModal(true);
 | 
			
		||||
    }
 | 
			
		||||
    const handleSubmit = () => {
 | 
			
		||||
      navigation.navigate('ShareQrcode' as never);
 | 
			
		||||
    }
 | 
			
		||||
    const handlePhone = () => { 
 | 
			
		||||
       
 | 
			
		||||
    }
 | 
			
		||||
    return (
 | 
			
		||||
        <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
 | 
			
		||||
| 
						 | 
				
			
			@ -23,10 +30,13 @@ const AddShare = () => {
 | 
			
		|||
                        value={phone}
 | 
			
		||||
                        onChangeText={setPhone}
 | 
			
		||||
                    />
 | 
			
		||||
                    <TouchableOpacity onPress={handlePhone} activeOpacity={1}>  
 | 
			
		||||
                    <Image
 | 
			
		||||
                        source={{ uri: 'https://lxnapi.ccttiot.com/bike/img/static/uMSABuH69gxKXIP0zqtl' }}
 | 
			
		||||
                        style={styles.phoneImg}
 | 
			
		||||
                    />
 | 
			
		||||
                    </TouchableOpacity>
 | 
			
		||||
                   
 | 
			
		||||
                </View>
 | 
			
		||||
                <View style={styles.IptBox}>
 | 
			
		||||
                    <TextInput
 | 
			
		||||
| 
						 | 
				
			
			@ -51,63 +61,10 @@ const AddShare = () => {
 | 
			
		|||
                        />
 | 
			
		||||
                    </View>
 | 
			
		||||
                </TouchableOpacity>
 | 
			
		||||
                <TouchableOpacity style={styles.bleInfo} onPress={() => setShowBleInfo(true)}>
 | 
			
		||||
                    <Image source={{ uri: 'https://lxnapi.ccttiot.com/bike/img/static/uvjPwfAKsL9kHD1Tb9aW' }} style={styles.bleImg}></Image>
 | 
			
		||||
                    <View style={styles.bleInfoBox}>
 | 
			
		||||
                        <Text style={styles.tit}>上次蓝牙连接位置</Text>
 | 
			
		||||
                        <Text style={[
 | 
			
		||||
                            styles.txt,
 | 
			
		||||
                            { color: allowBleLocation ? '#4297F3' : '#666' }
 | 
			
		||||
                        ]}>
 | 
			
		||||
                            {allowBleLocation ? '允许' : '不允许'}
 | 
			
		||||
                        </Text>
 | 
			
		||||
                    </View>
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
                <TouchableOpacity style={styles.submitButton} onPress={handleSubmit}>
 | 
			
		||||
                    <Text style={styles.submitButtonText}>确定</Text>
 | 
			
		||||
                </TouchableOpacity>
 | 
			
		||||
                <Modal visible={showBleInfo} transparent={true} animationType="slide">
 | 
			
		||||
                    <View style={styles.modalContainers}>
 | 
			
		||||
                        <View style={styles.modalContents}>
 | 
			
		||||
                            <Image
 | 
			
		||||
                                source={{ uri: 'https://lxnapi.ccttiot.com/bike/img/static/uwMP7N2hCLFdwwDPhHMm' }}
 | 
			
		||||
                                style={styles.bleLocationImg}
 | 
			
		||||
                            />
 | 
			
		||||
                            <Text style={styles.bleModalTitle}>
 | 
			
		||||
                                是否允许租赁人查看{'\n'}上次蓝牙连接位置
 | 
			
		||||
                            </Text>
 | 
			
		||||
 | 
			
		||||
                            <View style={styles.radioGroup}>
 | 
			
		||||
                                <TouchableOpacity
 | 
			
		||||
                                    style={styles.radioItem}
 | 
			
		||||
                                    onPress={() => setAllowBleLocation(true)}
 | 
			
		||||
                                >
 | 
			
		||||
                                    <Text style={styles.radioText}>允许</Text>
 | 
			
		||||
                                    <View style={styles.radioCircle}>
 | 
			
		||||
                                        {allowBleLocation && <View style={styles.radioSelected} />}
 | 
			
		||||
                                    </View>
 | 
			
		||||
                                   
 | 
			
		||||
                                </TouchableOpacity>
 | 
			
		||||
                                <View style={styles.line}></View>
 | 
			
		||||
                                <TouchableOpacity
 | 
			
		||||
                                    style={styles.radioItem}
 | 
			
		||||
                                    onPress={() => setAllowBleLocation(false)}
 | 
			
		||||
                                >
 | 
			
		||||
                                      <Text style={styles.radioText}>不允许</Text>
 | 
			
		||||
                                    <View style={styles.radioCircle}>
 | 
			
		||||
                                        {!allowBleLocation && <View style={styles.radioSelected} />}
 | 
			
		||||
                                    </View>
 | 
			
		||||
                                  
 | 
			
		||||
                                </TouchableOpacity>
 | 
			
		||||
                            </View>
 | 
			
		||||
 | 
			
		||||
                            <TouchableOpacity
 | 
			
		||||
                                style={styles.confirmButton}
 | 
			
		||||
                                onPress={() => setShowBleInfo(false)}
 | 
			
		||||
                            >
 | 
			
		||||
                                <Text style={styles.confirmButtonText}>确定</Text>
 | 
			
		||||
                            </TouchableOpacity>
 | 
			
		||||
                        </View>
 | 
			
		||||
                    </View>
 | 
			
		||||
                </Modal>
 | 
			
		||||
                <Modal
 | 
			
		||||
                    visible={showTimeModal}
 | 
			
		||||
                    transparent={true}
 | 
			
		||||
| 
						 | 
				
			
			@ -162,6 +119,20 @@ const AddShare = () => {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const styles = StyleSheet.create({
 | 
			
		||||
    submitButton: {
 | 
			
		||||
        width: rpx(688),
 | 
			
		||||
        height: rpx(88),
 | 
			
		||||
        backgroundColor: '#4297F3',
 | 
			
		||||
        borderRadius: rpx(16),
 | 
			
		||||
        justifyContent: 'center',
 | 
			
		||||
        alignItems: 'center',
 | 
			
		||||
        marginTop: rpx(50),
 | 
			
		||||
    },
 | 
			
		||||
    submitButtonText: {
 | 
			
		||||
        fontSize: rpx(32),
 | 
			
		||||
        color: '#fff',
 | 
			
		||||
        fontWeight: '500',
 | 
			
		||||
    },
 | 
			
		||||
    container: {
 | 
			
		||||
        flex: 1,
 | 
			
		||||
        backgroundColor: '#F3FCFF',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user