缩放属性不适用于android 7.0 react-native

时间:2018-07-31 15:49:33

标签: react-native react-redux react-native-android react-native-ios react-native-navigation

我正在尝试缩放圆圈,但不适用于android 7.0,它显示此提示,请参见附件图像。 Image

实际上我有两个圆圈,单击时我要缩放该圆圈,如果该圆圈已经缩放,则再缩放回该圆圈。 下面的代码在所有需要android 7.0的设备上都能正常工作

const ScaleCircle = (props) => {
const { circleStyle, } = style;
const { unSelected, selected } = customStyle;
const { txt, pressEvent } = props;
let isSelected = txt.isSelected ? selected : unSelected;
let { fontSize, ...optStyle } = isSelected;

return (
    <TouchableHighlight
        style={[circleStyle, optStyle]}
        onPress={pressEvent}
    >
        <Text style={[{ fontSize: fontSize }]}>
            {txt.txt}
        </Text>
    </TouchableHighlight>
);

};

导出{ScaleCircle}

这是样式代码

const customStyle = {
selected: {
    borderWidth: 4,
    zIndex: 2,
    fontSize: 25,
    marginLeft: 10,
    transform: [{ scale: 1.3 }],
    backgroundColor: LIGHTGREYCOLOR,
    position: 'relative'

},
unSelected: {
    marginLeft: 10,
    borderWidth: 2,
    fontSize: 20,
    zIndex: 1,
    position: 'relative',
    backgroundColor: WHITECOLOR,
    transform: [{ scale: 1 }]

},
circleStyle: {
    borderRadius: Math.round(SCREEN_WIDTH + SCREEN_HEIGHT) / 2,
    justifyContent: 'center',
    alignItems: 'center',
    borderWidth: 2,
    padding: 5,
    width: SCREEN_WIDTH * 0.4,
    height: SCREEN_WIDTH * 0.4
},

}

0 个答案:

没有答案