在 React Native 中,为什么我的图标没有右对齐?
In React Native, why isn't my icon right aligned?
我使用 React Native 和 NativeBase 如下:
https://snack.expo.io/@deltanovember/tab-swipe
我正在尝试在此处实施 Advanced Deck Swiper:
http://docs.nativebase.io/Components.html#deckswiper-adv-headref
我的代码与示例几乎相同,但我的前进图标在按钮左侧对齐:
而根据示例,它应该与按钮的右侧对齐:
如何使对齐方式与示例(即按钮右侧的图标?)相匹配?
您放置的图标和文本的顺序不正确。我刚刚切换它们并且它有效:
<Text>Swipe Right</Text>
<Icon name="ios-arrow-forward" />
这个问题是因为您没有为您的 <Body />
标签设置样式
这应该可以正常工作
并尝试在项目中的任何地方看到它时使用样式
这是你的右键:
<Button
iconRight
onPress={() => this._deckSwiper._root.swipeRight()}>
<View style={{ flexDirection: 'row-reverse' }} >
<Icon name="ios-arrow-forward" />
<Text>Swipe Right</Text>
</View>
</Button>
也许只需切换图标和文本即可解决此问题,但最好保持正常:)
(祝你好运,这是我今天给你的第二个答案我的朋友:DDDD)
我使用 React Native 和 NativeBase 如下:
https://snack.expo.io/@deltanovember/tab-swipe
我正在尝试在此处实施 Advanced Deck Swiper:
http://docs.nativebase.io/Components.html#deckswiper-adv-headref
我的代码与示例几乎相同,但我的前进图标在按钮左侧对齐:
而根据示例,它应该与按钮的右侧对齐:
如何使对齐方式与示例(即按钮右侧的图标?)相匹配?
您放置的图标和文本的顺序不正确。我刚刚切换它们并且它有效:
<Text>Swipe Right</Text>
<Icon name="ios-arrow-forward" />
这个问题是因为您没有为您的 <Body />
标签设置样式
这应该可以正常工作
并尝试在项目中的任何地方看到它时使用样式
这是你的右键:
<Button
iconRight
onPress={() => this._deckSwiper._root.swipeRight()}>
<View style={{ flexDirection: 'row-reverse' }} >
<Icon name="ios-arrow-forward" />
<Text>Swipe Right</Text>
</View>
</Button>
也许只需切换图标和文本即可解决此问题,但最好保持正常:)
(祝你好运,这是我今天给你的第二个答案我的朋友:DDDD)