首页 > 解决方案 > 如何在反应原生的对象中访问父母的兄弟姐妹值?

问题描述

我想在标题默认中获取颜色有没有办法或者我应该为标题默认样式创建单独的组件?

import {Platform} from 'react-native';
export default {
    colors:{
        primaryColor: '#4a148c',
        accentColor: '#ff6f00'
    },
    headerDefault:{
        headerStyle: {
            backgroundColor: Platform.OS === 'android'? this.colors.primaryColor:'',
            height:100
          },
          headerTintColor:  Platform.OS === 'android'? 'white':this.colors.primaryColor,
          headerTitleStyle: {
            fontWeight: 'bold',
          },
          headerTitleAlign:'center'
    }
};

标签: javascriptreact-native

解决方案


推荐阅读