【问题标题】:Need help styling react-native-elements input component需要帮助样式化 react-native-elements 输入组件
【发布时间】:2019-05-25 20:16:19
【问题描述】:

我正在尝试弄清楚如何使用 react-native-elements 设置输入样式,就像文档中显示的图片一样...我希望输入看起来像带有白色背景的顶部,但我没有想法我将如何去做。我坚持的主要问题是在输入容器上得到尖锐的边缘。有什么帮助吗?
(来源:github.io

【问题讨论】:

    标签: css reactjs react-native styling react-native-elements


    【解决方案1】:

    我不知道怎么做,但我认为ImageBackground 可以解决这个问题。我用它作为问题的图片,因为我没有image

    import * as React from 'react';
    import { Text, View, StyleSheet,TextInput,ImageBackground } from 'react-native';
    import Constants from 'expo-constants';
    
    export default class App extends React.Component {
      render() {
        return (
          <View style={styles.container}>
            <Text style={styles.paragraph}>
              Use ImageBackground
            </Text>
            <ImageBackground style={{height: 40 , width:"100%"}} source={require("./test.png")}>
            <TextInput style={{height: 40,color:"red",paddingHorizontal:120}} />
            </ImageBackground>
          </View>
        );
      }
    }
    
    const styles = StyleSheet.create({
      container: {
        flex: 1,
        justifyContent: 'center',
        paddingTop: Constants.statusBarHeight,
        backgroundColor: '#ecf0f1',
        padding: 8,
      },
      paragraph: {
        margin: 24,
        fontSize: 18,
        fontWeight: 'bold',
        textAlign: 'center',
      },
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-25
      相关资源
      最近更新 更多