简体   繁体   English

React Native中的iOS TextInput样式

[英]iOS TextInput styles in React Native

Elements such as <Button/> and <TextInput/> get rendered with default styles on Android but on iOS they are pretty much unstyled. 诸如<Button/><TextInput/>元素在Android上使用默认样式呈现,但在iOS上它们几乎没有样式。 Is there a way to get platform styles (eg borders and padding) applied on iOS without reproducing them in CSS? 有没有办法在iOS上应用平台样式(例如边框和填充)而不用CSS复制它们?

For example 例如

<View style={{flex:1, justifyContent: 'center'}}>
    <Text>Please sign in</Text>
    <TextInput placeholder="Username"/>
    <TextInput placeholder="Password"/>
    <Button onPress={() => {}} title="Sign in"/>
</View>

Android屏幕截图

iOS萤幕撷取画面

https://github.com/tombenner/nui https://github.com/tombenner/nui

to apply them you can use platform.select 要应用它们,您可以使用platform.select

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM