/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */
import React, { Component } from 'react';
import { Picker, Icon, View } from 'native-base';
import styles from './styles';

interface PickerComponentProps {
  jsonList: Array<any>;
  onSelectChange: (selected: any) => void;
  selectedValue: any;
}
const PickerComponent = (props: PickerComponentProps) => {
  const { jsonList } = props;
  return (
    <View style={[styles.picker]}>
      <Picker
        style={styles.pickerWidthHeight}
        placeholderStyle={styles.placeholder}
        textStyle={styles.textStyle}
        onValueChange={props.onSelectChange}
        selectedValue={props.selectedValue}
        iosIcon={<Icon name="md-arrow-dropdown" style={styles.iconVisu}></Icon>}
      >
        {jsonList.map((el, index) => (
          <Picker.Item key={index} label={el.dial_code} value={el.dial_code} />
        ))}
      </Picker>
    </View>
  );
};
export default PickerComponent;
