【发布时间】:2021-05-25 14:04:29
【问题描述】:
首先,我不确定写成Bottom Bar是否正确。
无论如何,我将在底部放置一个按钮,但由于电话原因,它无法按预期工作。
第一个是 iphone 11,第二个是 iphone 8。
所以我想从底部留出一些空隙,所以第一张图片看起来不错。这就是我想要的,但第二张图片不是。 (注意:我使用的是 SafeAreaView)
我已经附上了组件的代码。 (黄色按钮)
import React, {memo} from 'react';
import {TouchableOpacity, Image, StyleSheet} from 'react-native';
const NextButton = ({goNext, ...props}) => (
<TouchableOpacity onPress={goNext} style={[styles.container, props]}>
<Image style={styles.image} source={require('../assets/arrow_next.png')} />
</TouchableOpacity>
);
const styles = StyleSheet.create({
container: {
position: 'absolute',
bottom: 0,
right: 0,
},
image: {
width: 48,
height: 48,
backgroundColor: '#d0cf22',
borderRadius: 10,
},
});
export default memo(NextButton);
【问题讨论】:
-
您至少能告诉我们它在哪些方面不起作用吗?您期望哪种行为?而你观察到的是哪种行为?为什么你已经预料到它不工作了?
-
@PatrickBeynio 我已经编辑过了。我想让它像第一张图片,而不是第二张。
标签: react-native