in sync-api-docs/propFormatter.js [201:241]
function formatDefaultColumn(prop) {
if (prop?.rnTags?.default) {
// Parse from @default annotation
let tableRows = '';
prop.rnTags.default.forEach(tag => {
const isMatch = tag.match(/{@platform [a-z]*}/);
if (isMatch) {
const platform = isMatch[0].match(/ [a-z]*/);
tag = tag.replace(/{@platform [a-z]*}/g, '');
// Checks component for NativeColorValue in default
let colorBlock = '';
prop?.flowType?.elements.some(elem => {
if (elem.name === 'NativeColorValue' && !tag.includes('null')) {
colorBlock = `<ins style={{background: '${tag.replace(
/'/g,
''
)}'}} className="color-box" />`;
return true;
}
});
tag =
colorBlock +
(!tag.includes('null') ? '`' + tag + '`' : tag) +
formatMultiplePlatform(platform[0].split(','));
} else if (!tag.includes('`')) {
tag = '`' + tag + '`';
}
tableRows = tableRows + tag + '<hr/>';
});
tableRows = tableRows.replace(/<hr\/>$/, '');
return {Default: tableRows};
} else {
// Parse defaultValue if @default annotation not provided
return prop?.defaultValue?.value
? {Default: stringToInlineCodeForTable(prop?.defaultValue?.value)}
: '';
}
}