Answers for "react native how to change programmatically view style"

0

react native how to change programmatically view style

const Sample3 = (props) => {
  const [dir, setDirection] = useState("row");
  return (
    <div
      style={{
        display: "flex",
        flexDirection: "dir",
        alignItems: "center",
        width: 150,
        height: 250,
        backgroundColor: "grey",
        justifyContent: "flex-start",
        flexWrap: "wrap",
      }}
    >
      <button
        onClick={() => {
          if (dir === "row") {
            setDirection("column");
          } else {
            setDirection("row");
          }
        }}
      >
        Click
      </button>
    </div>
  );
};
Posted by: Guest on June-30-2020

Code answers related to "react native how to change programmatically view style"

Code answers related to "Javascript"

Browse Popular Code Answers by Language