【问题标题】:Font Scaling and maxFontSizeMultiplier on Alerts警报上的字体缩放和 maxFontSizeMultiplier
【发布时间】:2020-04-10 15:52:11
【问题描述】:

我正在尝试在 react native Alert 组件上设置 maxFontSizeMultiplier,但我找不到任何方法。我不想为警报制作另一个组件。

我正在使用以下代码:

Alert.alert('Alert', 'My Message', alertActions, options);

有没有办法禁用字体缩放或为警报指定 maxFontSizeMultiplier?

【问题讨论】:

    标签: react-native alert


    【解决方案1】:

    您可以使用自定义库react-native-modalbox

    您将能够为模式设置样式:

            <Modal style={{background: 'red'}} ref={"modal"}>
              <Text style={{color: 'white'}}>your alert</Text>
              <Button onPress={this.toggleSwipeToClose} style={styles.btn}>Close({this.state.swipeToClose ? "true" : "false"})</Button>
            </Modal>
    

    您可以使用打开模式

    openModal(id) {
        this.refs.modal.open();
      }
    

    more options.

    【讨论】:

    • 所以目前没有办法仅使用 react-native 提供的原生 Alert 组件来处理这个问题对吗?
    猜你喜欢
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 2010-12-14
    • 1970-01-01
    • 1970-01-01
    • 2016-01-17
    • 1970-01-01
    相关资源
    最近更新 更多