android - 在我的 react native 项目中使用原生基础的 Button 组件,它在 android 文本中产生问题
问题描述
IOS:
在 IOS 中它工作正常,但 android 有问题根据上图,我将组件 ButtonWithText.js 的代码如下:
import React from 'react';
import {Text, View} from 'react-native';
import {Button} from 'native-base';
const ButtonWithText = props => {
const content = (
<Button transparent style={props.btnStyle} onPress={props.onButtonPress}>
<Text style={props.textStyle}>{props.title}</Text>
</Button>
);
return <View>{content}</View>;
};
export default ButtonWithText;
目前,从下面给出的父组件传递道具:
<ButtonWithText
title={'Want To Check Button Text'}
btnStyle={styles.medicationButton}
textStyle={styles.medicationButtonText}
onButtonPress={() => goMedicationRefill(this.props.componentId)}
/>
上面给出的样式如下:
medicationButton: {
height: 37,
width: '100%',
backgroundColor: '#41FD9A',
borderRadius: 18,
justifyContent: 'center',
},
medicationButtonText: {
color: '#fff',
fontWeight: '700',
fontSize: 16,
},
目前,我使用的是原生版本:2.13.7 和 react-native 版本:0.60.5
请帮我解决这个问题。
解决方案
推荐阅读
- c++ - 允许动态分配的 C 对象数组
- android - Flutter Using parsed JSON data in other widgets
- c++ - What does the clang compiler's `-Weverything` option include and where is it documented?
- babeljs - Babel Not working for imports from node_modules
- javascript - 如何将类型作为函数参数传递
- javascript - Wordpress - Adding shortcode via in JS but it doesn't render
- azure - 根据要求在 Azure 上自动安装
- sql - 删除代码字后的文本
- python-3.x - API.put_photo 已弃用。是否有使用 Python API 在 Facebook 上发布照片或图形的新方法?
- python - “tempfile.mkdtemp”会生成两个相同的文件吗?