Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const RadioButtons = enhance(({
- lastMessage: { options }, visibleModal, toggleModal,
- }) => {
- const len = options.length
- const buttonStyle = {
- justifyContent: 'center',
- margin: 1,
- backgroundColor: colors.disable,
- elevation: 0,
- width: '100%',
- }
- if (len <= 3) {
- const { width, flexDirection } = widthMap[len]
- return (
- <View
- style={[
- styles.containerForTwoElement,
- { flexDirection },
- ]}
- >
- {options.map((item) => (
- <Button
- text={item}
- full={false}
- style={{ ...buttonStyle, width }}
- />
- ))}
- </View>
- )
- }
- return (
- <React.Fragment>
- <Button
- text="Выбрать значение"
- full={false}
- style={buttonStyle}
- onPress={() => toggleModal(true)}
- />
- <Modal
- visible={visibleModal}
- onRequestClose={() => toggleModal(false)}
- >
- <Container>
- <Header>
- <Left style={{ flex: 0.2 }}>
- <TouchableOpacity
- onPress={() => toggleModal(false)}
- >
- <Icon
- name="close"
- style={styles.close}
- />
- </TouchableOpacity>
- </Left>
- <Body style={{ flex: 0.8 }}>
- <Title style={styles.title}>Выберите значение</Title>
- </Body>
- </Header>
- <Content>
- <List
- dataArray={options}
- renderRow={(text) => (
- <ListItem>
- <TouchableOpacity>
- <Text>{text}</Text>
- </TouchableOpacity>
- </ListItem>
- )}
- />
- </Content>
- </Container>
- </Modal>
- </React.Fragment>
- )
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement