/**
* 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
*/
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
import React from 'react';
import {useState} from 'react';
import {Image, ImageBackground, StyleSheet, Text, View} from 'react-native';
type Props = $ReadOnly<{
style: ViewStyleProp,
testID?: string,
}>;
function LayeredView(props: Props) {
return (
<>
Hello, World!
>
);
}
function LayeredImage(props: Props) {
return (
<>
{/* $FlowFixMe[incompatible-use] - ImageStyle is not compatible with ViewStyle */}
>
);
}
function LayeredViewWithState(props: Props): React.Node {
const [s, setS] = useState(true);
setTimeout(() => setS(!s), 5000);
return ;
}
function LayeredImageWithState(props: Props): React.Node {
const [s, setS] = useState(true);
setTimeout(() => setS(!s), 5000);
return (
);
}
const styles = StyleSheet.create({
commonImage: {
width: 200,
height: 100,
marginLeft: 3,
marginTop: 3,
},
container: {
flexDirection: 'row',
justifyContent: 'space-around',
},
duckContainer: {
alignSelf: 'center',
width: 150,
height: 165,
backgroundColor: 'lime',
},
duck: {
width: '100%',
height: '100%',
},
backdrop: {
height: 110,
width: 110,
},
commonView: {
backgroundColor: 'cyan',
height: 100,
width: 100,
marginTop: 5,
marginLeft: 5,
},
nestedView: {
backgroundColor: 'purple',
height: 50,
width: 50,
},
});
const mixBlendModes = [
'normal',
'multiply',
'screen',
'overlay',
'darken',
'lighten',
'color-dodge',
'color-burn',
'hard-light',
'soft-light',
'difference',
'exclusion',
'hue',
'saturation',
'color',
'luminosity',
] as const;
const examples: Array = mixBlendModes.map(mode => ({
title: mode,
description: `mix-blend-mode: ${mode}`,
name: mode,
render(): React.Node {
return (
);
},
}));
examples.push(
{
title: 'Text mix-blend-mode',
description: 'mix-blend-mode: Text mix-blend-mode',
name: 'text',
render(): React.Node {
return (
'OVERLAY' BLENDING ON TEXT
);
},
},
{
title: 'Spec Example 1',
description: 'mix-blend-mode: Spec Example 1',
name: 'spec-example-1',
render(): React.Node {
return (
);
},
},
{
title: 'Spec Example 2',
description: 'mix-blend-mode: Spec Example 2',
name: 'spec-example-2',
render(): React.Node {
return (
);
},
},
{
title: 'Spec Example 3',
description: 'mix-blend-mode: Spec Example 3',
name: 'spec-example-3',
render(): React.Node {
return (
);
},
},
{
title: 'mix-blend-mode with state updates',
description: 'Turn mix-blend-mode difference on and off every 5 seconds',
render(): React.Node {
return (
);
},
},
{
title: 'mix-blend-mode & filter',
description: 'mix-blend-mode & filter',
name: 'mix-blend-mode-filter',
render(): React.Node {
return (
);
},
},
);
exports.title = 'MixBlendMode';
exports.category = 'UI';
exports.description =
'A set of graphical effects that can be applied to a view.';
exports.examples = examples;