Files
react-native/packages/rn-tester/js/examples/Animated/utils/ToggleNativeDriver.js
T
Luna Wei 893aff2e20 Animated Transform Styles Example
Summary: Changelog: [Internal] - Add an example to demo all the transform properties.

Reviewed By: charlesbdudley

Differential Revision: D29865790

fbshipit-source-id: 79174457071de8fca9b0aab8bf8dcc543ea9a0a3
2021-07-26 17:17:58 -07:00

49 lines
1.0 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its 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 {View, Text, StyleSheet, Switch} from 'react-native';
import * as React from 'react';
type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
type Props = {
value: boolean,
onValueChange: $ElementType<
React.ElementConfig<typeof Switch>,
'onValueChange',
>,
style?: ?ViewStyleProp,
};
export default function ToggleNativeDriver({
value,
onValueChange,
style,
}: Props): React.Node {
return (
<View style={StyleSheet.compose(styles.row, style)}>
<Text>Use Native Driver</Text>
<Switch
testID="toggle-use-native-driver"
onValueChange={onValueChange}
value={value}
/>
</View>
);
}
const styles = StyleSheet.create({
row: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
});