reactjs

how to create a drawer using React Native?

假装没事ソ 提交于 2021-02-11 14:25:11
问题 I want to create a drawer that appears only on my homescreen, had tried using React Native side menu but that just hides the drawer behind then tried using createdrawernavigator but I have a bottomtabnavigator inside stacknavigator, and am stuck on how to implement drawer navigator on top of that below is my navigation.js const RootStack = createStackNavigator(); const Tab = createBottomTabNavigator(); const AuthStack = createStackNavigator(); // const Drawer = createDrawerNavigator();

How to pass data between 2 classes in ReactJS

笑着哭i 提交于 2021-02-11 14:24:30
问题 I am having an issue with what I believe is react hooks for a school assignment. In my app.js, I am using conditional rendering to render 2 different navbar's: 1 for a normal user and 1 for an admin. I am having trouble understanding how to change the app.js state where I render the navbar, from the login.js. Below is my code. Login.js handleLogon(){ try{ if(this.username == "user1" && this.password == "pass123"){ //send info to app.js } } catch{ this.setState({ message: "Incorrect

Change disable attribute in react select with material UI

烈酒焚心 提交于 2021-02-11 14:23:32
问题 I am trying to change disable attribute in select on button click in react application using material ui My button code is: <AsistButton variant="outlined" color="primary" className={classes.button}>X</AsistButton> and from select is: <NativeSelect value={person} className={classes.margin} onChange={handleChangeSelect} input={<BootstrapInput name="person" id="person-customized-native-simple"/>} disabled > <option value=""/> <option value={10}>Peter</option> <option value={20}>Alex</option>

Dynamically navigating between stacks with react-navigation 5

依然范特西╮ 提交于 2021-02-11 14:22:47
问题 I'm trying to dynamically navigate between stacks via a single fetch from a server, which reads a token from the device, and makes a server request to update isUserExists. if isUserExists is false, render AuthStack, otherwise render AppStack. My code: Example for AuthStack.js : import React from "react"; import { createStackNavigator } from "@react-navigation/stack"; import { Auth, Registration, Login, VerifyAuth } from "../../screens/auth"; const Stack = createStackNavigator(); const

Trying to add linear gradient to a martialUI icon

空扰寡人 提交于 2021-02-11 14:22:34
问题 I'm trying to add a linear gradient to a material UI icon using the background-clip property but it just doesn't show up? .social-icon{ background: linear-gradient(to right bottom, #FD297B, #FF5864, #FF655B); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } ''' <div className="social-icons"> <FacebookIcon className="social-icon" fontSize="large" /> <TwitterIcon className="social-icon" fontSize="large" /> <InstagramIcon className="social-icon" fontSize="large" />

Webpack Dev Server cannot find modules with Typescript if I use custom paths in tsconfig

 ̄綄美尐妖づ 提交于 2021-02-11 14:21:58
问题 I'm building a project from scratch on React + TypeScript and using the Webpack Dev server. I want to use relative paths to components, which will be not strict for a more flexible development. In my App.tsx, I'm trying to import component: import EntityTypes from "components/EntityTypes/EntityTypes"; and getting an error Module not found: Error: Can't resolve 'components/EntityTypes/EntityTypes' in '/home/eugene/prj/work/crud-react/src' File by this path exists (/src/components/EntityTypes

React Hooks, setTimeout in useEffect not triggering until end, because of state updates

自古美人都是妖i 提交于 2021-02-11 14:21:55
问题 Context : New messages are added (e.g. every two seconds, using setInterval). Messages have status, either old or new. Newly added messages have a 'new' flag. After every 5 seconds, all 'new' messages are designated 'old'. (setTimeout) Problem : Timeout is not triggering until the end. New messages are added, but they remain 'new' until all messages are added. I suspect that after every update the timeout is being reset/cleared and because the updates are occurring faster than the timeout,

How to use React Portal?

我只是一个虾纸丫 提交于 2021-02-11 14:16:56
问题 I am trying to use React Portal functionality, but can't seem to get it to work (am using React v16.2 and ReactDOM v16.2). In the example below, when I click the 'click me' link 'yey!' should appear but it doesn't: HTML: <div id="app-root"></div> <div id="toast-root"></div> JavaScript: const appRoot = document.getElementById('app-root'); const insertToast = (toastRoot) => ReactDOM.createPortal( 'yey!', toastRoot, ); class App extends React.Component { insertToasts() { const toastRoot =

NextJs: 404 page back button returns back to 404 page

微笑、不失礼 提交于 2021-02-11 14:16:11
问题 I have a condition inside my lifecycle method of user Page such that if the user enters an URL with certain parameters such as somePage.com/user/1 will fetch the data of the user with ID 1, however, if the user enters the URL as somePage.com/user/1ABC then im routing them to a custom 404 page. My issue is when im in the 404-page clicking on the back button will take me back to the page with URL somePage.com/user/1ABC and then will route back to the same 404-page as the URL param met a

Support for the experimental syntax 'classProperties' isn't currently enabled (8:16). Add @babel/plugin-proposal-class-properties

有些话、适合烂在心里 提交于 2021-02-11 14:15:07
问题 I'm trying to compile my React Native App and I'm getting the following error: SyntaxError: C:\Users\Ori\Desktop\Projects\React\my-app\node_modules@react-native-community\google-signin\src\GoogleSignin.js: Support for the experimental syntax 'classProperties' isn't currently enabled (8:16) Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation. If I understand correctly, since it is a react native app, the