ApplyLocationScreen.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { StackScreenProps } from '@react-navigation/stack';
  2. import * as React from 'react';
  3. import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
  4. import { ScrollView } from 'react-native-gesture-handler';
  5. import { useCreation } from 'ahooks';
  6. import useModel from 'flooks';
  7. import { useTranslation } from 'react-i18next';
  8. import Login from './model';
  9. import User from '../stores/User';
  10. export default function ApplyLocationScreen({ navigation }: StackScreenProps) {
  11. const { t } = useTranslation();
  12. const { applyInfo, saveRiderApply } = useModel(Login, ['applyInfo']);
  13. const { area, longitude, latitude } = applyInfo;
  14. const { riderInfo } = useModel(User, ['riderInfo']);
  15. const canSubmit = useCreation(() => {
  16. if (area && longitude && latitude) {
  17. return true;
  18. } else {
  19. return false;
  20. }
  21. }, [area, longitude, latitude]);
  22. return (
  23. <Div bg="gray100" flex={1}>
  24. <ScrollView
  25. contentContainerStyle={{
  26. flexGrow: 1,
  27. backgroundColor: '#fff',
  28. }}
  29. >
  30. <Div borderTopWidth={10} borderColor="gray100" px={15}>
  31. <Div row py={10} overflow="hidden" alignItems="center">
  32. <Text w={120} textAlign="right">
  33. {t('gong-zuo-di-dian')}:
  34. </Text>
  35. <Button
  36. flex={1}
  37. bg="gray100"
  38. color="black"
  39. justifyContent="space-around"
  40. ml={10}
  41. onPress={() => navigation.navigate('SearchMap')}
  42. >
  43. <Div flex={1}>
  44. <Text fontSize="sm" color={area ? 'black' : 'gray300'}>
  45. {area || t('qing-xuan-ze-di-dian')}
  46. </Text>
  47. </Div>
  48. </Button>
  49. <Icon name="right" ml="md" />
  50. </Div>
  51. </Div>
  52. <Div alignSelf="center" py={20}>
  53. <Text fontSize="sm" color="gray400">
  54. {t('shuo-ming')}:
  55. </Text>
  56. <Text fontSize="sm" color="gray400">
  57. {t(
  58. 'qi-shou-de-gong-zuo-qu-yu-wei-yi-gong-zuo-di-dian-ban-jing-3km-de-qu-yu'
  59. )}
  60. </Text>
  61. </Div>
  62. <Button
  63. w={112}
  64. bg="yellow500"
  65. alignSelf="center"
  66. fontSize="sm"
  67. my={20}
  68. // disabled={!canSubmit}
  69. onPress={saveRiderApply}
  70. >
  71. {t('ti-jiao-shen-he')}
  72. </Button>
  73. </ScrollView>
  74. </Div>
  75. );
  76. }