128 lines
4.8 KiB
TypeScript
128 lines
4.8 KiB
TypeScript
// Module ID: 7048
|
|
// Function ID: 7049
|
|
// Name: CountryCallingCodeSelect
|
|
// Dependencies: [32, 19, 17, 4776, 21, 4560, 576, 6944, 4777, 7049, 5517, 5605, 4556, 7050, 7053, 7054, 1114, 7055, 2]
|
|
// Exports: default
|
|
|
|
// Module 7048 (CountryCallingCodeSelect)
|
|
import ThemesDefault from "Themes" /* 576 */;
|
|
import closure_3 from "_slicedToArray" /* 32 */;
|
|
import closure_4 from "noop" /* 19 */;
|
|
import { View } from "get ActivityIndicator" /* 17 */;
|
|
import { getI18NCountryName } from "DEFAULT_COUNTRY_CODE_NAME" /* 4776 */;
|
|
import jsxProd from "jsxProd" /* 21 */;
|
|
import createCacheKey from "createCacheKey" /* 4560 */;
|
|
|
|
const require = arg1;
|
|
({ jsx: error, jsxs: closure_8 } = jsxProd);
|
|
let closure_9 = createCacheKey.createStyles((arg0) => {
|
|
let obj = { backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOW, paddingHorizontal: null, paddingTop: null, paddingBottom: null, flex: 1 };
|
|
const space = ThemesDefault.space;
|
|
obj[1] = arg0 ? space.PX_24 : space.PX_12;
|
|
obj[2] = ThemesDefault.space.PX_16;
|
|
const space2 = tmp(576).space;
|
|
obj = { container: obj, searchFieldContainer: null };
|
|
obj[3] = arg0 ? space2.PX_24 : space2.PX_16;
|
|
obj = { paddingBottom: tmp(576).space.PX_16 };
|
|
obj[1] = obj;
|
|
return obj;
|
|
});
|
|
const result = require("set").fileFinishedImporting("modules/phone/native/CountryCallingCodeSelect.tsx");
|
|
|
|
export default function CountryCallingCodeSelect(onCountrySelected) {
|
|
onCountrySelected = onCountrySelected.onCountrySelected;
|
|
const onClose = onCountrySelected.onClose;
|
|
let first;
|
|
let memo;
|
|
let rows;
|
|
let tmp3 = callback2(onClose(first[7])());
|
|
const tmp4 = memo(rows.useState(""), 2);
|
|
first = tmp4[0];
|
|
memo = rows.useMemo(() => onClose(first[8]).flatMap((alpha2) => {
|
|
alpha2 = alpha2.alpha2;
|
|
({ phoneCountryCodes, name: closure_1 } = alpha2);
|
|
closure_2 = arg1;
|
|
closure_3 = undefined;
|
|
closure_3 = callback(alpha2);
|
|
return phoneCountryCodes.map((code) => {
|
|
obj = { translatedName: closure_3, key: "" + closure_2 + "-" + code, country: obj };
|
|
obj = { code, alpha2, name: closure_1 };
|
|
return obj;
|
|
});
|
|
}), []);
|
|
const items = [memo, first];
|
|
const memo1 = rows.useMemo(() => {
|
|
rows = [];
|
|
const iter = memo[Symbol.iterator]();
|
|
const nextResult = iter.next();
|
|
while (iter !== undefined) {
|
|
let tmp3 = nextResult;
|
|
let str = first;
|
|
let startsWithResult = 0 === first.length;
|
|
if (!startsWithResult) {
|
|
let tmp5 = nextResult;
|
|
let str2 = tmp3.country.code;
|
|
let replaced = str2.replace(/\+|\s/g, "");
|
|
startsWithResult = replaced.startsWith(str.replace(/\+|\s/g, ""));
|
|
}
|
|
if (!startsWithResult) {
|
|
let tmp6 = onClose;
|
|
let tmp7 = first;
|
|
let tmp8 = onClose(first[10]);
|
|
let tmp10 = nextResult;
|
|
let str3 = tmp3.country.name;
|
|
let formatted = str.toLowerCase();
|
|
startsWithResult = tmp8(formatted, str3.toLowerCase());
|
|
}
|
|
if (!startsWithResult) {
|
|
let tmp11 = onClose;
|
|
let tmp12 = first;
|
|
let tmp13 = onClose(first[10]);
|
|
let tmp15 = nextResult;
|
|
let str4 = tmp3.translatedName;
|
|
let formatted1 = str.toLowerCase();
|
|
startsWithResult = tmp13(formatted1, str4.toLowerCase());
|
|
}
|
|
if (startsWithResult) {
|
|
let tmp16 = nextResult;
|
|
let arr = rows.push(tmp3);
|
|
}
|
|
continue;
|
|
}
|
|
const sections = [rows.length];
|
|
return { rows, sections };
|
|
}, items);
|
|
rows = memo1.rows;
|
|
const items1 = [onClose, onCountrySelected, rows];
|
|
let obj = { style: tmp3.container, children: null };
|
|
obj = { style: tmp3.searchFieldContainer, children: null };
|
|
const callback = rows.useCallback((arg0, arg1) => {
|
|
const country = tmp.country;
|
|
let obj = { start: 0 === arg1, end: arg1 === rows.length - 1, label: tmp.translatedName, trailing: null, onPress: null };
|
|
obj = { variant: "text-md/semibold", children: country.code };
|
|
obj[3] = closure_1_7(onCountrySelected(first[12]).Text, obj);
|
|
obj[4] = function onPress() {
|
|
country(country);
|
|
if (closure_1_1 != null) {
|
|
closure_1_1();
|
|
}
|
|
};
|
|
return closure_1_7(onCountrySelected(first[11]).TableRow, obj);
|
|
}, items1);
|
|
obj[1] = callback(onCountrySelected(first[13]).SearchField, { size: "md", onChange: tmp4[1] });
|
|
const items2 = [callback(View, obj), ];
|
|
if ("" !== first) {
|
|
if (0 === rows.length) {
|
|
obj = { source: null, text: null };
|
|
obj[0] = tmp(tmp2[15]);
|
|
const intl = tmp13(tmp2[16]).intl;
|
|
obj[1] = intl.string(tmp13(tmp2[16]).t.wEHnxW);
|
|
let tmp12Result = tmp12(tmp(tmp2[14]), obj);
|
|
const tmpResult = tmp(tmp2[14]);
|
|
}
|
|
items2[1] = tmp12Result;
|
|
obj[1] = items2;
|
|
return closure_8(View, obj);
|
|
}
|
|
tmp12Result = tmp12(tmp(tmp2[17]), { sections: memo1.sections, renderItem: callback, itemSize: onClose(first[9])(), estimatedListSize: "windowSize", keyboardShouldPersistTaps: "always" });
|
|
};
|