MCPcopy Create free account
hub / github.com/callstack/react-native-paper / ThemeColorsTable

Function ThemeColorsTable

docs/src/components/ThemeColorsTable.tsx:108–140  ·  view source on GitHub ↗
({
  themeColorsData,
  componentName,
}: {
  themeColorsData: DataObject;
  componentName: string;
})

Source from the content-addressed store, hash-verified

106};
107
108const ThemeColorsTable = ({
109 themeColorsData,
110 componentName,
111}: {
112 themeColorsData: DataObject;
113 componentName: string;
114}): ReactNode | null => {
115 const uniqueKeys = getUniqueNestedKeys(themeColorsData);
116 const nestingLevel = getMaxNestedLevel(themeColorsData);
117 const isFlatTable = nestingLevel === 1;
118
119 const Table = isFlatTable ? FlatTable : TabbedTable;
120
121 return (
122 <>
123 <Table themeColorsData={themeColorsData} uniqueKeys={uniqueKeys} />
124 <Admonition type="tip">
125 <p>
126 If a dedicated prop for a specific color is not available or the{' '}
127 <code>style</code> prop does not allow color modification, you can
128 customize it using the <code>theme</code> prop. It allows to override
129 any color, within the component, based on the table above.
130 </p>
131 <p>
132 <i>Example of overriding </i>
133 <code>primary</code>
134 <i> color:</i>
135 </p>
136 <code>{`<${componentName} theme={{ colors: { primary: 'green' } }} />`}</code>
137 </Admonition>
138 </>
139 );
140};
141
142export default ThemeColorsTable;

Callers

nothing calls this directly

Calls 2

getUniqueNestedKeysFunction · 0.90
getMaxNestedLevelFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…