react-native - react-native-image-slider-box 与图像上方的 dotStyle 滑块不起作用
问题描述
在这个例子中,我在这里使用了 react-native-image-slider 我想在左侧底部图像滑块框中显示图像分页点如何做到这一点。
SliderBoxExample.js
import React, { Component } from 'react';
import {Image, Text, View, TouchableOpacity, StyleSheet } from 'react-native';
import { SliderBox } from "react-native-image-slider-box";
export default class SliderBoxExample extends Component {
constructor(props) {
super(props);
this.state = {
images: [
require('./../assets/images/cat.jpg'),
require('./../assets/images/dao.jpg'),
require('./../assets/images/monkey.jpg'),
]
};
}
render() {
const { navigation } = this.props
return (
<View style={styles.container}>
<SliderBox
ImageComponent={Image}
images={this.state.images}
sliderBoxHeight={200}
dotColor="red"
inactiveDotColor="#90A4AE"
paginationBoxVerticalPadding={20}
autoplay
circleLoop
resizeMethod={'resize'}
resizeMode={'cover'}
paginationBoxStyle={{
position: "absolute",
bottom: 0,
padding: 0,
alignItems: "center",
alignSelf: "center",
justifyContent: "center",
paddingVertical: 10
}}
dotStyle={{
width: 10,
height: 10,
borderRadius: 5,
marginHorizontal: 0,
padding: 0,
margin: 0,
backgroundColor: "rgba(128, 128, 128, 0.92)"
}}
ImageComponentStyle={{borderRadius: 15, width: '97%', marginTop: 25}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
如果您有任何解决方案,请提出任何建议。谢谢。图像滑块框下方左侧的图像更改分页..
解决方案
Windas_Coder!我不确定我是否明白了,但我的理解是你想将分页点移动到内容框的左下角。一个简单的方法是设置alignSelf
到flex-start
属性内部paginationBoxStyle
。像这样的东西:
paginationBoxStyle={{
alignSelf: "flex-start",
}}
因此,您可以在此处阅读更多信息,您可以:
将此属性应用于单个子项以更改其在其父项中的对齐方式。
或者换句话说,只改变分页框的位置,在SliderBox
usingflex
属性内。
推荐阅读
- docker - Vertx 泊坞窗集群
- java - Java(这段代码有什么问题)
- python - 用漂亮的汤刮和循环元标记
- android - writeDataToFile(String) 在 FindBugs 中检查异常时可能无法清理 java.io.Writer
- c# - c# - 如何将选中列表框中的选中项目打印到c#中的标签?
- css - 角度将参数传递给css动画
- python - isinstance() 方法在 Python 3 中返回错误答案
- wpf - 如何更改 MahApps Metro 滑块上的默认颜色
- javascript - 如何找出最接近的坐标?
- r - 如何在同一个面板中绘制两个图(ggplot2)