main
js 42 lines 1.25 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import * as React from 'react';
11 import {Fragment, useState} from 'react';
12 import {Button, Text, View} from 'react-native-web';
13
14 export default function ReactNativeWeb(): React.Node {
15 const [backgroundColor, setBackgroundColor] = useState('purple');
16 const toggleColor = () =>
17 setBackgroundColor(backgroundColor === 'purple' ? 'green' : 'purple');
18 return (
19 <Fragment>
20 <h1>ReactNativeWeb</h1>
21 <View>
22 <Text>auto (default) - english LTR</Text>
23 <Text>
24 {
25 '\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL'
26 }
27 </Text>
28 <Text style={{textAlign: 'left'}}>
29 left left left left left left left left left left left left left left
30 left
31 </Text>
32 <Button
33 color={backgroundColor}
34 onPress={toggleColor}
35 title={`Switch background color to "${
36 backgroundColor === 'purple' ? 'green' : 'purple'
37 }"`}
38 />
39 </View>
40 </Fragment>
41 );
42 }