index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. import React, { FC, useCallback, useEffect, useState } from 'react';
  2. import { View, Text, Image, TouchableOpacity, Platform, FlatList } from 'react-native';
  3. import { styles } from '../RegionViewScreen/styles';
  4. import {
  5. Button,
  6. CustomImageViewer,
  7. HorizontalTabView,
  8. Loading,
  9. Modal as ReactModal
  10. } from 'src/components';
  11. import { CommonActions, useFocusEffect } from '@react-navigation/native';
  12. import { Colors } from 'src/theme';
  13. import { ScrollView } from 'react-native-gesture-handler';
  14. import { styles as ButtonStyles } from 'src/components/RegionPopup/style';
  15. import { usePostSetToggleItem } from '@api/series';
  16. import { NAVIGATION_PAGES } from 'src/types';
  17. import { API_HOST } from 'src/constants';
  18. import { StoreType, storage } from 'src/storage';
  19. import { ButtonVariants } from 'src/types/components';
  20. import { useRegion } from 'src/contexts/RegionContext';
  21. import formatNumber from '../../TravelsScreen/utils/formatNumber';
  22. import { PhotosData, Props, SeriesData, SeriesGroup, SeriesItem } from '../RegionViewScreen/types';
  23. import ImageCarousel from '../RegionViewScreen/ImageCarousel';
  24. import TravelSeriesList from '../RegionViewScreen/TravelSeriesList';
  25. import { fetchCountryUserData, useGetCountryDataQuery } from '@api/countries';
  26. import EditModal from '../../TravelsScreen/Components/EditSlowModal';
  27. import MarkIcon from 'assets/icons/mark.svg';
  28. import ChevronLeft from 'assets/icons/chevron-left.svg';
  29. import CaseSvg from 'assets/icons/briefcase.svg';
  30. import HouseSvg from 'assets/icons/house.svg';
  31. import EditSvg from 'assets/icons/travels-screens/pen-to-square.svg';
  32. import CheckSvg from 'assets/icons/travels-screens/circle-check.svg';
  33. import CheckRegularSvg from 'assets/icons/travels-screens/circle-check-regular.svg';
  34. import MapSvg from 'assets/icons/travels-screens/map-location.svg';
  35. import { useGetRegionQeQuery } from '@api/myRegions';
  36. const CountryViewScreen: FC<Props> = ({ navigation, route }) => {
  37. const countryId = route.params?.regionId;
  38. const disabled = route.params?.disabled;
  39. const token = storage.get('token', StoreType.STRING) as string;
  40. const [isLoading, setIsLoading] = useState(true);
  41. const [isModalVisible, setModalVisible] = useState(false);
  42. const [currentImageIndex, setCurrentImageIndex] = useState(0);
  43. const [activeIndex, setActiveIndex] = useState(0);
  44. const [indexSeries, setIndexSeries] = useState(0);
  45. const [routes, setRoutes] = useState<SeriesGroup[]>([]);
  46. const [series, setSeries] = useState<SeriesData[]>([]);
  47. const [photos, setPhotos] = useState<PhotosData[]>([]);
  48. const [name, setName] = useState('');
  49. const { data } = useGetCountryDataQuery(countryId, true, token && token);
  50. // const { mutateAsync: mutateCountriesData } = fetchCountryUserData();
  51. // const { data: regionsQe } = useGetRegionQeQuery(undefined, countryId, String(token), true);
  52. const { mutate: updateSeriesItem } = usePostSetToggleItem();
  53. const [isInfoModalVisible, setIsInfoModalVisible] = useState<boolean>(false);
  54. const [infoItem, setInfoItem] = useState<SeriesItem | null>(null);
  55. const [isEditSlowModalVisible, setIsEditSlowModalVisible] = useState<boolean>(false);
  56. // const [regionsData, setRegionsData] = useState<any>(null);
  57. // const [daresData, setDaresData] = useState<any>(null);
  58. // const [index, setIndex] = useState<number>(0);
  59. // const [countryRoutes] = useState([
  60. // { key: 'regions', title: 'NM regions' },
  61. // { key: 'dare', title: 'DARE places' },
  62. // { key: 'series', title: 'Series' }
  63. // ]);
  64. const {
  65. handleUpdateSlow: updateSlow,
  66. userData: regionData,
  67. setUserData: setRegionData,
  68. handleUpdateSlowList
  69. } = useRegion();
  70. useFocusEffect(() => {
  71. navigation.getParent()?.setOptions({
  72. tabBarStyle: {
  73. display: 'flex',
  74. ...Platform.select({
  75. android: {
  76. // height: 58
  77. }
  78. })
  79. }
  80. });
  81. });
  82. useFocusEffect(
  83. useCallback(() => {
  84. const fetchGroups = async () => {
  85. let staticGroups = [];
  86. const routesData = data?.data?.series?.map((item) => ({
  87. key: item.series_id?.toString(),
  88. title: item.series_name,
  89. series_id: item.series_id,
  90. icon: item.icon,
  91. items: item.items
  92. }));
  93. routesData && staticGroups.push(...routesData);
  94. setPhotos(
  95. data?.data?.photos?.slice(0, 100).map((item) => ({
  96. ...item,
  97. uriSmall: `${API_HOST}/ajax/pic/${item.id}/small`,
  98. uri: `${API_HOST}/ajax/pic/${item.id}/full`
  99. })) ?? []
  100. );
  101. setName(data?.data.name ?? '');
  102. setSeries(data?.data?.series || []);
  103. setRoutes(staticGroups);
  104. if (regionData?.id !== countryId) {
  105. setRegionData(data?.data || {});
  106. }
  107. setIsLoading(false);
  108. };
  109. // const fetchCountryData = async () => {
  110. // await mutateCountriesData(
  111. // { id: countryId, token },
  112. // {
  113. // onSuccess: (data) => {
  114. // setRegionData({ type: 'countries', id: countryId, ...data.data });
  115. // }
  116. // }
  117. // );
  118. // };
  119. if (data && data.result === 'OK') {
  120. fetchGroups();
  121. // fetchCountryData();
  122. }
  123. }, [data])
  124. );
  125. // useEffect(() => {
  126. // if (regionsQe && regionsQe.result === 'OK') {
  127. // setRegionsData(regionsQe.data.out_regs);
  128. // setDaresData(regionsQe.data.out_dare);
  129. // }
  130. // }, [regionsQe]);
  131. const handleCheckboxChange = useCallback(
  132. async (item: SeriesItem, double: boolean, seriesId: number) => {
  133. setSeries((currentData) => {
  134. const groupIndex = currentData.findIndex((group) => group?.series_id === seriesId);
  135. if (groupIndex === -1) return currentData;
  136. const newData = [...currentData];
  137. const newGroup = { ...newData[groupIndex] };
  138. newGroup.items = newGroup.items.map((subItem) =>
  139. subItem.id === item.id
  140. ? {
  141. ...subItem,
  142. ...(double
  143. ? { visited_double: subItem.visited_double === 0 ? 1 : 0 }
  144. : { visited: subItem.visited === 0 ? 1 : 0 })
  145. }
  146. : subItem
  147. );
  148. newData[groupIndex] = newGroup;
  149. return newData;
  150. });
  151. const itemData = {
  152. token: token,
  153. series_id: seriesId,
  154. item_id: item.id,
  155. checked: (item.visited === 1 ? 0 : 1) as 0 | 1,
  156. double: (double && !item.visited_double ? 1 : 0) as 0 | 1
  157. };
  158. try {
  159. updateSeriesItem(itemData);
  160. } catch (error) {
  161. console.error('Failed to update checkbox state', error);
  162. }
  163. },
  164. [token, updateSeriesItem]
  165. );
  166. const openModal = (index: number) => {
  167. setCurrentImageIndex(index);
  168. setModalVisible(true);
  169. };
  170. if (isLoading) return <Loading />;
  171. const handleUpdateSlowModal = (
  172. id: number,
  173. v: boolean,
  174. s11: boolean,
  175. s31: boolean,
  176. s101: boolean
  177. ) => {
  178. const updatedSlow = {
  179. ...regionData,
  180. visited: v,
  181. slow11: Number(s11) as 0 | 1,
  182. slow31: Number(s31) as 0 | 1,
  183. slow101: Number(s101) as 0 | 1
  184. };
  185. const updatedSlowData = {
  186. token,
  187. id,
  188. v,
  189. s11,
  190. s31,
  191. s101
  192. };
  193. route.params?.isTravelsScreen
  194. ? handleUpdateSlowList(id, v, s11, s31, s101)
  195. : updateSlow(id, v, s11, s31, s101);
  196. updatedSlow && setRegionData(updatedSlow);
  197. };
  198. const handleUpdateSlow = () => {
  199. route.params?.isTravelsScreen
  200. ? handleUpdateSlowList(
  201. countryId,
  202. !regionData?.visited,
  203. Boolean(regionData.slow11),
  204. Boolean(regionData.slow31),
  205. Boolean(regionData.slow101)
  206. )
  207. : updateSlow(
  208. countryId,
  209. !regionData?.visited,
  210. Boolean(regionData.slow11),
  211. Boolean(regionData.slow31),
  212. Boolean(regionData.slow101)
  213. );
  214. setRegionData({
  215. ...regionData,
  216. visited: !regionData?.visited
  217. });
  218. };
  219. // const renderScene = ({ route }: { route: any }) => {
  220. // return <View style={{ height: 0 }} />;
  221. // };
  222. const renderDurationIcon = (condition: 0 | 1) =>
  223. condition ? <CheckSvg fill={Colors.DARK_BLUE} /> : <CheckRegularSvg />;
  224. return (
  225. <View style={styles.container}>
  226. <TouchableOpacity
  227. onPress={() => {
  228. navigation.goBack();
  229. }}
  230. style={styles.backButton}
  231. >
  232. <View style={styles.chevronWrapper}>
  233. <ChevronLeft fill={Colors.WHITE} />
  234. </View>
  235. </TouchableOpacity>
  236. <ScrollView
  237. contentContainerStyle={{}}
  238. nestedScrollEnabled={true}
  239. showsVerticalScrollIndicator={false}
  240. >
  241. {photos.length > 0 ? (
  242. <ImageCarousel
  243. photos={photos}
  244. activeIndex={activeIndex}
  245. setActiveIndex={setActiveIndex}
  246. openModal={openModal}
  247. />
  248. ) : (
  249. <View style={styles.emptyImage}>
  250. <Image
  251. source={require('../../../../../assets/images/logo-opacity.png')}
  252. style={{ width: 100, height: 100 }}
  253. />
  254. <Text style={styles.emptyImageText}>No image available at this location</Text>
  255. </View>
  256. )}
  257. <TouchableOpacity
  258. onPress={() => {
  259. route.params?.isTravelsScreen || route.params?.isProfileScreen
  260. ? navigation.dispatch(
  261. CommonActions.reset({
  262. index: 1,
  263. routes: [
  264. {
  265. name: NAVIGATION_PAGES.IN_APP_MAP_TAB,
  266. state: {
  267. routes: [
  268. {
  269. name: NAVIGATION_PAGES.MAP_TAB,
  270. params: { id: countryId, type: 'countries' }
  271. }
  272. ]
  273. }
  274. }
  275. ]
  276. })
  277. )
  278. : navigation.goBack();
  279. }}
  280. style={styles.goToMapBtn}
  281. >
  282. <View style={styles.chevronWrapper}>
  283. <MapSvg fill={Colors.WHITE} />
  284. </View>
  285. </TouchableOpacity>
  286. <View style={{ gap: 16 }}>
  287. {regionData?.visited && !disabled && (
  288. <View style={[styles.durationContainer, styles.margin]}>
  289. <View style={styles.durationItem}>
  290. {renderDurationIcon(regionData.slow11)}
  291. <Text style={styles.visitDuration}>11+ days</Text>
  292. </View>
  293. <View style={styles.durationItem}>
  294. {renderDurationIcon(regionData.slow31)}
  295. <Text style={styles.visitDuration}>31+ days</Text>
  296. </View>
  297. <View style={styles.durationItem}>
  298. {renderDurationIcon(regionData.slow101)}
  299. <Text style={styles.visitDuration}>101+ days</Text>
  300. </View>
  301. </View>
  302. )}
  303. <View style={[styles.nameContainer, styles.margin]}>
  304. <Text style={styles.title}>{name}</Text>
  305. <View style={ButtonStyles.btnContainer}>
  306. {/* {regionData?.visited && !disabled ? (
  307. <TouchableOpacity
  308. // onPress={() => setIsEditSlowModalVisible(true)}
  309. onPress={() =>
  310. navigation.navigate(NAVIGATION_PAGES.EDIT_COUNTRY_DATA, {
  311. countryId: countryId,
  312. countryName: name,
  313. countryFlag: regionData?.flag,
  314. slow11: regionData?.slow11,
  315. slow31: regionData?.slow31,
  316. slow101: regionData?.slow101
  317. })
  318. }
  319. style={ButtonStyles.editBtn}
  320. >
  321. <EditSvg width={14} height={14} />
  322. </TouchableOpacity>
  323. ) : null} */}
  324. {!disabled ? (
  325. <TouchableOpacity
  326. style={[
  327. ButtonStyles.btn,
  328. regionData?.visited && !disabled
  329. ? ButtonStyles.visitedButton
  330. : ButtonStyles.markVisitedButton
  331. ]}
  332. onPress={
  333. regionData?.visited
  334. ? () =>
  335. navigation.navigate(NAVIGATION_PAGES.EDIT_COUNTRY_DATA, {
  336. countryId: countryId,
  337. countryName: name,
  338. countryFlag: regionData?.flag,
  339. slow11: regionData?.slow11,
  340. slow31: regionData?.slow31,
  341. slow101: regionData?.slow101,
  342. isSlowList: false
  343. })
  344. : handleUpdateSlow
  345. }
  346. >
  347. {regionData?.visited ? (
  348. <View style={ButtonStyles.visitedContainer}>
  349. <EditSvg width={16} height={16} />
  350. <Text style={ButtonStyles.visitedButtonText}>Edit</Text>
  351. </View>
  352. ) : (
  353. <Text style={[ButtonStyles.markVisitedButtonText]}>Mark Visited</Text>
  354. )}
  355. </TouchableOpacity>
  356. ) : null}
  357. </View>
  358. </View>
  359. <View style={[styles.divider, styles.margin]} />
  360. <View style={[styles.stats, styles.margin]}>
  361. {(data?.data.users_from_country_count ?? 0 > 0) ? (
  362. <TouchableOpacity
  363. style={[styles.statItem, { justifyContent: 'flex-start' }]}
  364. onPress={() =>
  365. navigation.navigate(
  366. ...([
  367. NAVIGATION_PAGES.USERS_LIST,
  368. {
  369. id: countryId,
  370. isFromHere: true,
  371. type: 'country'
  372. }
  373. ] as never)
  374. )
  375. }
  376. >
  377. <View style={styles.icon}>
  378. <HouseSvg />
  379. </View>
  380. <View
  381. style={{
  382. height: 12,
  383. width: 1,
  384. backgroundColor: Colors.DARK_BLUE,
  385. marginRight: 6
  386. }}
  387. />
  388. <View style={styles.userImageContainer}>
  389. {data?.data.users_from_country &&
  390. data?.data.users_from_country.length > 0 &&
  391. data?.data.users_from_country?.map((user, index: number) => (
  392. <Image
  393. key={index}
  394. source={{ uri: API_HOST + user }}
  395. style={styles.userImage}
  396. />
  397. ))}
  398. <View style={styles.userCountContainer}>
  399. <Text style={styles.userCount}>
  400. {formatNumber(data?.data?.users_from_country_count ?? 0)}
  401. </Text>
  402. </View>
  403. </View>
  404. </TouchableOpacity>
  405. ) : (
  406. <View style={[styles.statItem, { justifyContent: 'flex-start' }]} />
  407. )}
  408. {(data?.data.users_who_visited_country_count ?? 0 > 0) ? (
  409. <TouchableOpacity
  410. style={[styles.statItem, { justifyContent: 'flex-end' }]}
  411. onPress={() =>
  412. navigation.navigate(
  413. ...([
  414. NAVIGATION_PAGES.USERS_LIST,
  415. {
  416. id: countryId,
  417. isFromHere: false,
  418. type: 'country'
  419. }
  420. ] as never)
  421. )
  422. }
  423. >
  424. <View style={styles.icon}>
  425. <CaseSvg />
  426. </View>
  427. <View
  428. style={{
  429. height: 12,
  430. width: 1,
  431. backgroundColor: Colors.DARK_BLUE,
  432. marginRight: 6
  433. }}
  434. />
  435. <View style={styles.userImageContainer}>
  436. {data?.data.users_who_visited_country &&
  437. data?.data.users_who_visited_country.length > 0 &&
  438. data?.data.users_who_visited_country?.map((user, index) => (
  439. <Image
  440. key={index}
  441. source={{ uri: API_HOST + user }}
  442. style={[styles.userImage]}
  443. />
  444. ))}
  445. <View style={styles.userCountContainer}>
  446. <Text style={styles.userCount}>
  447. {formatNumber(data?.data.users_who_visited_country_count ?? 0)}
  448. </Text>
  449. </View>
  450. </View>
  451. </TouchableOpacity>
  452. ) : (
  453. <View style={[styles.statItem, { justifyContent: 'flex-end' }]} />
  454. )}
  455. </View>
  456. <View style={[styles.divider, styles.margin, { marginBottom: 8 }]} />
  457. {/* <TabView
  458. navigationState={{ index, routes: countryRoutes }}
  459. renderScene={renderScene}
  460. onIndexChange={(i) => {
  461. setIndex(i);
  462. }}
  463. lazy={true}
  464. renderTabBar={(props) => (
  465. <TabBar
  466. {...props}
  467. indicatorStyle={{ backgroundColor: Colors.DARK_BLUE }}
  468. style={styles.tabBar}
  469. tabStyle={styles.tabStyle}
  470. pressColor={'transparent'}
  471. renderLabel={({ route, focused }) => (
  472. <Text
  473. style={[
  474. styles.tabLabel,
  475. { color: Colors.DARK_BLUE, opacity: focused ? 1 : 0.4 }
  476. ]}
  477. >
  478. {route.title}
  479. </Text>
  480. )}
  481. />
  482. )}
  483. /> */}
  484. {/* {index === 0 && (
  485. <>
  486. {regionsData && regionsData.length > 0 ? (
  487. <FlatList
  488. data={regionsData}
  489. keyExtractor={(item) => `region-${item.id}`}
  490. showsVerticalScrollIndicator={false}
  491. initialNumToRender={15}
  492. contentContainerStyle={{ paddingBottom: 16, gap: 10 }}
  493. scrollEnabled={false}
  494. renderItem={({ item }) => {
  495. const [regionName, ...rest] = item.region_name?.split(/ – | - /);
  496. const subname = rest?.join(' - ');
  497. return (
  498. <TouchableOpacity
  499. style={styles.regionContainer}
  500. onPress={() =>
  501. navigation.navigate(
  502. ...([
  503. NAVIGATION_PAGES.REGION_PREVIEW,
  504. {
  505. regionId: item.id,
  506. type: 'nm',
  507. disabled
  508. }
  509. ] as never)
  510. )
  511. }
  512. >
  513. {item.flag_1 && (
  514. <Image
  515. source={{ uri: API_HOST + '/img/flags_new/' + item.flag_1 }}
  516. style={styles.img}
  517. />
  518. )}
  519. {item.flag_2 && (
  520. <Image
  521. source={{ uri: API_HOST + '/img/flags_new/' + item.flag_2 }}
  522. style={[
  523. styles.img,
  524. {
  525. marginLeft: -20
  526. }
  527. ]}
  528. />
  529. )}
  530. <View style={styles.textContainer}>
  531. <Text style={styles.regionTitle}>{regionName}</Text>
  532. <Text style={styles.subTitle}>{subname}</Text>
  533. </View>
  534. </TouchableOpacity>
  535. );
  536. }}
  537. />
  538. ) : null}
  539. </>
  540. )} */}
  541. {/* {index === 1 && (
  542. <>
  543. {daresData && daresData.length > 0 ? (
  544. <FlatList
  545. data={daresData}
  546. keyExtractor={(item) => `dare-${item.id}`}
  547. showsVerticalScrollIndicator={false}
  548. initialNumToRender={15}
  549. contentContainerStyle={{ paddingBottom: 16, gap: 10 }}
  550. scrollEnabled={false}
  551. renderItem={({ item }) => {
  552. const [regionName, ...rest] = item.name?.split(/ – | - /);
  553. const subname = rest?.join(' - ');
  554. return (
  555. <TouchableOpacity
  556. style={styles.regionContainer}
  557. onPress={() =>
  558. navigation.navigate(
  559. ...([
  560. NAVIGATION_PAGES.REGION_PREVIEW,
  561. {
  562. regionId: item.id,
  563. type: 'dare',
  564. disabled
  565. }
  566. ] as never)
  567. )
  568. }
  569. >
  570. {item.flag1 && (
  571. <Image
  572. source={{ uri: API_HOST + '/img/flags_new/' + item.flag1 }}
  573. style={styles.img}
  574. />
  575. )}
  576. {item.flag2 && (
  577. <Image
  578. source={{ uri: API_HOST + '/img/flags_new/' + item.flag2 }}
  579. style={[
  580. styles.img,
  581. {
  582. marginLeft: -20
  583. }
  584. ]}
  585. />
  586. )}
  587. <View style={styles.textContainer}>
  588. <Text style={styles.regionTitle}>{regionName}</Text>
  589. <Text style={styles.subTitle}>{subname}</Text>
  590. </View>
  591. </TouchableOpacity>
  592. );
  593. }}
  594. />
  595. ) : null}
  596. </>
  597. )} */}
  598. {/* {index === 2 && (
  599. <> */}
  600. {series.length > 0 ? (
  601. <>
  602. <Text style={[styles.travelSeriesTitle, styles.margin]}>TRAVEL SERIES</Text>
  603. <HorizontalTabView
  604. index={indexSeries}
  605. setIndex={setIndexSeries}
  606. routes={routes}
  607. renderScene={({ route }: { route: any }) => <View style={{ height: 0 }} />}
  608. />
  609. <View style={styles.margin}>
  610. <TravelSeriesList
  611. series={series}
  612. indexSeries={indexSeries}
  613. routes={routes}
  614. handleCheckboxChange={handleCheckboxChange}
  615. setIsInfoModalVisible={setIsInfoModalVisible}
  616. setInfoItem={setInfoItem}
  617. disabled={disabled}
  618. includeAll={false}
  619. />
  620. </View>
  621. </>
  622. ) : null}
  623. {/* </>
  624. )} */}
  625. </View>
  626. <CustomImageViewer
  627. images={photos}
  628. imageIndex={currentImageIndex}
  629. visible={isModalVisible}
  630. onRequestClose={() => setModalVisible(false)}
  631. onImageIndexChange={setActiveIndex}
  632. backgroundColor={Colors.DARK_BLUE}
  633. renderFooter={(imageIndex: number) => (
  634. <View style={styles.imageFooter}>
  635. <Text style={styles.imageDescription}>{photos[imageIndex].title}</Text>
  636. <TouchableOpacity
  637. onPress={() => {
  638. setModalVisible(false);
  639. navigation.navigate(
  640. ...([
  641. NAVIGATION_PAGES.PUBLIC_PROFILE_VIEW,
  642. { userId: photos[imageIndex].user_id, hideTabBar: true }
  643. ] as never)
  644. );
  645. }}
  646. disabled={disabled}
  647. style={styles.imageOwner}
  648. >
  649. <Text style={styles.imageOwnerText}>{photos[imageIndex].first_name}</Text>
  650. <Text style={styles.imageOwnerText}>{photos[imageIndex].last_name}</Text>
  651. </TouchableOpacity>
  652. </View>
  653. )}
  654. />
  655. <ReactModal
  656. visible={isInfoModalVisible}
  657. children={
  658. <View style={styles.modalView}>
  659. <Text style={styles.infoTitle}>{infoItem?.name}</Text>
  660. <Text style={styles.infoText}>{infoItem?.description}</Text>
  661. <Button
  662. variant={ButtonVariants.OPACITY}
  663. containerStyles={styles.btnContainer}
  664. textStyles={{
  665. color: Colors.DARK_BLUE
  666. }}
  667. onPress={() => setIsInfoModalVisible(false)}
  668. children={'Got it'}
  669. />
  670. </View>
  671. }
  672. onRequestClose={() => setIsInfoModalVisible(false)}
  673. headerTitle={'Info'}
  674. visibleInPercent={'auto'}
  675. />
  676. </ScrollView>
  677. <EditModal
  678. isVisible={isEditSlowModalVisible}
  679. onClose={() => setIsEditSlowModalVisible(false)}
  680. item={{ ...regionData, country_id: countryId }}
  681. updateSlow={(id, v, s11, s31, s101) => {
  682. handleUpdateSlowModal(id, v, s11, s31, s101);
  683. }}
  684. />
  685. </View>
  686. );
  687. };
  688. export default CountryViewScreen;