Files
react-native/packages/rn-tester/js/components/RNTesterSettingSwitchRow.js
T
Ruslan Lesiutin 48db6be269 refactor(rn-tester): removed usage of AsyncStorage
Summary:
## Changelog:
[Internal][Changed] - removed usage of AsyncStorage inside rn-tester package

Reviewed By: NickGerleman, JTYim

Differential Revision: D40298838

fbshipit-source-id: fb08df690654f3b19e6f64f8893252092f0d8a27
2022-10-21 04:31:11 -07:00

44 lines
875 B
JavaScript

/**
* 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.
*
* @format
* @flow strict-local
*/
import * as React from 'react';
import {StyleSheet, Switch, Text, View} from 'react-native';
type Props = {
label: string,
onEnable: () => void,
onDisable: () => void,
active: boolean,
};
const styles = StyleSheet.create({
row: {
padding: 10,
flexDirection: 'row',
justifyContent: 'space-between',
},
});
const RNTesterSettingSwitchRow = ({
label,
onEnable,
onDisable,
active,
}: Props): React.Node => {
return (
<View style={styles.row}>
<Text>{label}</Text>
<Switch value={active} onValueChange={active ? onDisable : onEnable} />
</View>
);
};
export default RNTesterSettingSwitchRow;