TouchableOpacity onpress颜色 - 如何改变它?

时间:2017-07-31 11:24:42

标签: react-native

当我按下我的菜单时,opacity使按钮文字不可读?如何在onPress时更改按钮文字?

   const LYDTouchableAndroid = props => (
      <TouchableOpacity {...props}>
        {props.children}
      </TouchableOpacity>
    );

    return (
      <LYDTouchable
        style={[{ flex: 1 }, marginRightStyle]}
        onPress={() => this.props.onPress(square.scene)}>
        <LinearGradient
          style={styles.square}
          colors={theme.gradients.blueGradient}>
          <Text style={styles.squareLabel}>
            {square.label}
          </Text>
        </LinearGradient>
      </LYDTouchable>
    );
  };
}

LYDSquaredMenu.defaultProps = {
  gradient: theme.gradients.lightBlue,
};

export default LYDSquaredMenu;

const styles = StyleSheet.create({
  container: {
    backgroundColor: theme.colors.white,
  },
  row: {
    flexDirection: 'row',
    marginTop: theme.metrics.buttonsGap,
  },
  square: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  squareLabel: {
    ...theme.fontStyles.normal,
    color: theme.colors.white,
  },
});

0 个答案:

没有答案