我正在使用react-native-paper的List.Item组件。
我有以下代码:
<List.Item
title={<FirstNameInput />}
right={props => <List.Icon {...props} icon="pencil" />}
style={{ backgroundColor: customTheme.colors.background, justifyContent: 'center' }}
/>
但图标仍位于顶部。无论 title
的高度如何,如何使其保持垂直对齐?
最佳答案
您可以使用 Flex 对齐 List.Item
:
<List.Item
title={<FirstNameInput />}
right={props => <List.Icon {...props} icon="pencil" />}
style={{
backgroundColor: customTheme.colors.background,
justifyContent: 'center',
alignSelf: 'center',
alignItems:'center',
}}
/>
关于react-native - 如何垂直对齐 expo React-native List.Item 中的图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61855547/