【问题标题】:Can I able to align the error message as center which is from aws-amplify-react-native我可以将来自 aws-amplify-react-native 的错误消息对齐为中心吗
【发布时间】:2020-06-30 09:37:39
【问题描述】:

我需要将错误消息与警告图标的中心对齐。它来自 aws-amplify-react-native。

有什么方法可以自定义吗?我正在使用与 aws-react-native 相同的屏幕。

    import {
      Authenticator,
      AmplifyTheme,
      Greetings,
      SignIn,
      ConfirmSignIn,
      RequireNewPassword,
      SignUp,
      ConfirmSignUp,
      VerifyContact,
      ForgotPassword,
      AuthPiece,
    } from "aws-amplify-react-native";


render(){
      return(
           <Authenticator errorMessage={map}
                  hideDefault
                  amplifyConfig={awsmobile}
                  signUpConfig={signUpConfig}>
                    <Loading/>
                    <SignIn/>
                    <ConfirmSignIn/>
                    <VerifyContact/>
                    <SignUp signUpConfig={signUpConfig}/>
                    <ConfirmSignUp/>
                    <ForgotPassword/>
                    <RequireNewPassword />
                </Authenticator>
)
}

【问题讨论】:

    标签: react-native stylesheet aws-amplify aws-amplify-cli


    【解决方案1】:
      <View style={{flexDirection:'row'}}>
        <Icon/>
        <Text style={{textAlignVertical:"center"}}>{warningmessage}</Text>
        </View>
    

    它将使文本垂直居中。添加textAlign: 'center',它将使文本水平居中

    【讨论】:

    • 我没有图标或文本来在我的代码中制作这种样式。我在上述问题中添加了我的导入
    【解决方案2】:
    <View style={{flexDirection:'row', alignItems:'center'>
    <Icon/>
    <Text>{warningmessage}</Text>
    </View>
    
    

    这个 alignItems on row 将解决您的问题。

    【讨论】:

    • 在我的代码中没有图标或文本来制作这种样式。我在上面的问题中添加了我的导入。我直接在我的屏幕中使用包导入。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-28
    • 2022-12-12
    • 1970-01-01
    • 1970-01-01
    • 2018-07-13
    • 2017-04-07
    • 1970-01-01
    相关资源
    最近更新 更多