11
This commit is contained in:
parent
fc87ad0b3d
commit
cf03748a27
|
@ -106,6 +106,7 @@ const styles = StyleSheet.create({
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: rpx(24),
|
padding: rpx(24),
|
||||||
|
paddingTop: rpx(-20),
|
||||||
height: '100%',
|
height: '100%',
|
||||||
},
|
},
|
||||||
cont_left: {
|
cont_left: {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import UnlockSetting from './device/UnlockSetting';
|
||||||
import BleDistance from './device/BleDistance';
|
import BleDistance from './device/BleDistance';
|
||||||
import DeviceShare from './device/DeviceShare';
|
import DeviceShare from './device/DeviceShare';
|
||||||
import AddShare from './device/AddShare';
|
import AddShare from './device/AddShare';
|
||||||
|
import ShareQrcode from './device/shareQrcode';
|
||||||
// import BleBind from './bind/ble_bind';
|
// import BleBind from './bind/ble_bind';
|
||||||
import { getFocusedRouteNameFromRoute } from '@react-navigation/native';
|
import { getFocusedRouteNameFromRoute } from '@react-navigation/native';
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ type RootStackParamList = {
|
||||||
UnlockSetting: undefined;
|
UnlockSetting: undefined;
|
||||||
DeviceShare: undefined;
|
DeviceShare: undefined;
|
||||||
AddShare: undefined;
|
AddShare: undefined;
|
||||||
|
ShareQrcode: undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Stack = createStackNavigator<RootStackParamList>();
|
const Stack = createStackNavigator<RootStackParamList>();
|
||||||
|
@ -54,12 +56,12 @@ type Props = {
|
||||||
export default function HomeStackNavigator({ navigation, route }: Props) {
|
export default function HomeStackNavigator({ navigation, route }: Props) {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const routeName = getFocusedRouteNameFromRoute(route) ?? 'Home';
|
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]);
|
}, [navigation, route]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,6 +124,11 @@ export default function HomeStackNavigator({ navigation, route }: Props) {
|
||||||
component={AddShare}
|
component={AddShare}
|
||||||
options={createScreenOptions('添加共享人')}
|
options={createScreenOptions('添加共享人')}
|
||||||
/>
|
/>
|
||||||
|
<Stack.Screen
|
||||||
|
name="ShareQrcode"
|
||||||
|
component={ShareQrcode}
|
||||||
|
options={createScreenOptions('分享二维码')}
|
||||||
|
/>
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View, Text, StyleSheet, Image, TextInput, TouchableWithoutFeedback, Keyboard, TouchableOpacity, Modal } from 'react-native';
|
import { View, Text, StyleSheet, Image, TextInput, TouchableWithoutFeedback, Keyboard, TouchableOpacity, Modal } from 'react-native';
|
||||||
import { rpx } from '../../utils/rpx';
|
import { rpx } from '../../utils/rpx';
|
||||||
|
import { useNavigation } from '@react-navigation/native';
|
||||||
const AddShare = () => {
|
const AddShare = () => {
|
||||||
|
const navigation = useNavigation();
|
||||||
const [phone, setPhone] = useState('');
|
const [phone, setPhone] = useState('');
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
const [time, setTime] = useState('');
|
const [time, setTime] = useState('');
|
||||||
|
@ -12,6 +13,12 @@ const AddShare = () => {
|
||||||
const [allowBleLocation, setAllowBleLocation] = useState(true);
|
const [allowBleLocation, setAllowBleLocation] = useState(true);
|
||||||
const handlePress = () => {
|
const handlePress = () => {
|
||||||
setShowTimeModal(true);
|
setShowTimeModal(true);
|
||||||
|
}
|
||||||
|
const handleSubmit = () => {
|
||||||
|
navigation.navigate('ShareQrcode' as never);
|
||||||
|
}
|
||||||
|
const handlePhone = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
||||||
|
@ -23,10 +30,13 @@ const AddShare = () => {
|
||||||
value={phone}
|
value={phone}
|
||||||
onChangeText={setPhone}
|
onChangeText={setPhone}
|
||||||
/>
|
/>
|
||||||
|
<TouchableOpacity onPress={handlePhone} activeOpacity={1}>
|
||||||
<Image
|
<Image
|
||||||
source={{ uri: 'https://lxnapi.ccttiot.com/bike/img/static/uMSABuH69gxKXIP0zqtl' }}
|
source={{ uri: 'https://lxnapi.ccttiot.com/bike/img/static/uMSABuH69gxKXIP0zqtl' }}
|
||||||
style={styles.phoneImg}
|
style={styles.phoneImg}
|
||||||
/>
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.IptBox}>
|
<View style={styles.IptBox}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
@ -51,63 +61,10 @@ const AddShare = () => {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</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>
|
</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
|
<Modal
|
||||||
visible={showTimeModal}
|
visible={showTimeModal}
|
||||||
transparent={true}
|
transparent={true}
|
||||||
|
@ -162,6 +119,20 @@ const AddShare = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
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: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#F3FCFF',
|
backgroundColor: '#F3FCFF',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user