我需要将错误消息与警告图标的中心对齐。它来自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>
)
}
<View style={{flexDirection:'row', alignItems:'center'>
<Icon/>
<Text>{warningmessage}</Text>
</View>
行上的此alignItems将解决您的问题。
<View style={{flexDirection:'row'}}>
<Icon/>
<Text style={{textAlignVertical:"center"}}>{warningmessage}</Text>
</View>
它将使文本垂直居中。添加textAlign: 'center'
,它将使文本居中[[水平。