| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- /* eslint-disable react/style-prop-object */
- import * as WebBrowser from 'expo-web-browser';
- import * as React from 'react';
- import { StatusBar } from 'expo-status-bar';
- import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
- import { Appbar } from 'react-native-paper';
- import { ScrollView } from 'react-native-gesture-handler';
- import { useCreation } from '@umijs/hooks';
- import { useTranslation } from 'react-i18next';
- import useModel from 'flooks';
- import HomeModel from './Home/model';
- import MapModel from '../Map/model';
- import HomeAddressCom from '../Address/HomeAddressCom';
- export default function AddressScreen({ navigation }) {
- const { locationInfo, getNowLocation, changeChooseInfo } = useModel(
- MapModel,
- ['locationInfo', 'getNowLocation']
- );
- const { t } = useTranslation();
- const addressName = useCreation(() => {
- if (locationInfo) {
- return locationInfo.addressName;
- } else {
- return '';
- }
- }, [locationInfo]);
- return (
- <>
- <Div bg="white" pb={10} borderBottomWidth={1} borderColor="gray200">
- <StatusBar backgroundColor="#fff" style="dark" translucent />
- <Appbar.Header
- theme={{ colors: { primary: '#fff' } }}
- style={{
- elevation: 0,
- shadowOffset: {
- width: 0,
- height: 0,
- },
- shadowOpacity: 0,
- zIndex: 2,
- }}
- >
- <Appbar.BackAction onPress={navigation.goBack} />
- <Appbar.Content
- title={t('xuan-ze-shou-huo-di-zhi')}
- titleStyle={{ textAlign: 'center', fontSize: 16 }}
- />
- <Button alignSelf="center" bg="hide" color="brand500" px={20}>
- {t('guan-li')}
- </Button>
- </Appbar.Header>
- <Button
- rounded="circle"
- block
- bg="gray200"
- mx={15}
- mt={10}
- onPress={() => navigation.navigate('SearchMap')}
- >
- <Div row alignItems="center">
- <Icon name="search1" color="gray500" />
- <Text color="gray500" fontSize="xs">
- {t('xiao-qu-xie-zi-lou-xue-xiao-deng')}
- </Text>
- </Div>
- </Button>
- </Div>
- <ScrollView
- contentContainerStyle={{
- flexGrow: 1,
- backgroundColor: '#fff',
- }}
- >
- <Div px={15} py={10}>
- <Text color="gray500" fontSize="sm">
- {t('dang-qian-ding-wei')}
- </Text>
- <Div row>
- <Button
- onPress={() => {
- navigation.navigate('Home');
- if (addressName) {
- changeChooseInfo(locationInfo);
- }
- }}
- block
- bg="hiden"
- p={0}
- flex={1}
- >
- <Div flex={1} row>
- <Icon name="navigation" color="brand500" fontFamily="Feather" />
- <Text
- numberOfLines={1}
- ellipsizeMode="tail"
- fontSize="xl"
- ml={5}
- fontWeight="bold"
- flex={1}
- >
- {getNowLocation.loading
- ? t('jia-zai-zhong')
- : addressName || t('ding-wei-shi-bai')}
- </Text>
- </Div>
- </Button>
- <Button onPress={getNowLocation} bg="hiden" color="brand500">
- {t('zhong-xin-ding-wei')}
- </Button>
- </Div>
- </Div>
- <HomeAddressCom />
- </ScrollView>
- </>
- );
- }
|