showing results for - "react native how to change programmatically view style"
Hortense
08 Aug 2017
1const Sample3 = (props) => {
2  const [dir, setDirection] = useState("row");
3  return (
4    <div
5      style={{
6        display: "flex",
7        flexDirection: "dir",
8        alignItems: "center",
9        width: 150,
10        height: 250,
11        backgroundColor: "grey",
12        justifyContent: "flex-start",
13        flexWrap: "wrap",
14      }}
15    >
16      <button
17        onClick={() => {
18          if (dir === "row") {
19            setDirection("column");
20          } else {
21            setDirection("row");
22          }
23        }}
24      >
25        Click
26      </button>
27    </div>
28  );
29};