【问题标题】:Retrieving the font size of reactive native navigation title检索反应原生导航标题的字体大小
【发布时间】:2020-12-06 21:48:03
【问题描述】:

我是新手...

我需要检索反应原生导航标题使用的字体大小,以便我可以在其他地方使用相同的字体大小。我看到很多关于如何设置字体大小的文档。我不需要自己设置。我只需要检索字体大小,默认使用。

我正在使用 react native navigation 4.0。

【问题讨论】:

    标签: reactjs react-native navigation font-size


    【解决方案1】:

    没有办法找回它,但是你可以查看视图并弄清楚,或者你也可以查看源代码(上帝保佑开源!)

    https://github.com/react-navigation/react-navigation/blob/a484c1d7834f195ac0cfccda6a9f905218bc2274/packages/stack/src/views/Header/HeaderTitle.tsx

    const styles = StyleSheet.create({
      title: Platform.select({
        ios: {
          fontSize: 17,
          fontWeight: '600',
        },
        android: {
          fontSize: 20,
          fontFamily: 'sans-serif-medium',
          fontWeight: 'normal',
        },
        default: {
          fontSize: 18,
          fontWeight: '500',
        },
      }),
    });
    

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 2012-03-26
      • 2018-04-23
      • 2021-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-30
      相关资源
      最近更新 更多