3

我想从 React Native Paper 中获得关于 Card 的输入。我尝试将 textInput 放入 card、card.title、card.content 或 card.actions 中,但它不起作用,我做错了什么?有什么解决办法吗?这是我正在处理的代码:

import React, {useState} from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import {
  TouchableRipple,
  Switch,
  Title,
  Card,
  TextInput,
  Paragraph,
  Button,
  Avatar,
} from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';

function Details() {
  return (
    <Card
      style={{
        elevation: 24,
        borderRadius: 24,
        marginTop: 70,
        backgroundColor: '#fafcff',
        padding: 18,
        margin: 18,
      }}><View>
           <TextInput label="Email"
          mode="outlined"
          dense={true}
          // ref={textInput.current.clear()}
          theme={{
            colors: {
              primary: '#00aaff',
            },
          }}
          
          style={{
            borderRadius: 20,
            borderColor: 'gray',
            borderLeftWidth: 1,
            borderBottomEndRadius: 30,
            borderBottomStartRadius: 30,
            borderTopStartRadius: 30,
            borderStyle: 'dashed',
            borderTopColor: 'gray',
            borderTopEndRadius: 0,
            borderTopWidth: 0,
            borderStartColor: 'green',
            borderEndColor: 'green',
            borderRightColor: 'green',
            borderLeftColor: 'green',
            fontSize: 25,
            opacity: 0.9,
            shadowColor: '#00aaff',
            shadowOffset: {
              width: 0,
              height: 12,
            },
            shadowOpacity: 0.58,
            shadowRadius: 16.0,

            elevation: 24,
          }}
          
          />
        </View>
      <Card.Content>
        <Title>Card title</Title>
          
      </Card.Content>
      {/* <Card.Cover source={{uri: 'https://picsum.photos/700'}} /> */}
      <Card.Actions>
        
     
         
          
      </Card.Actions>
    </Card>
  );
}

export default Details;

我可以看到标签电子邮件和文本框,但我不能在文本框上写任何文本,我该怎么办?这是上述代码的输出:

在此处输入图像描述

4

1 回答 1

2

尝试将您的 TextInput 包含在 Portal 中,例如:

<Card>
    ....
    <Portal>
        <TextInput />
    </Portal>
</Card>
于 2020-07-23T09:47:35.543 回答