Really enjoying the series so far. I really like hearing your thought process throughout the development cycle. Keep it up! :)
@brunohplemos5 жыл бұрын
About DevHub's navigation, the most "complex" file is ModalRenderer.tsx, which is like a "StackNavigator". It handles which modal will be visible and handle the animations between each modal transition (slide from left if big screen, from bottom if small screen, push transition between modal scerens, etc). It uses react-spring for the animations. If the project needs to be URL-based, maybe it's easier to use some existing solution. You can use a different navigator for web and mobile if you want the best of both worlds.
@bawad5 жыл бұрын
Yeah, I ended up going with react router because the web/native API is almost exactly the same. But react-navigation > react-router-native
@brunohplemos5 жыл бұрын
On a more complex project I would probably use react-router on web and react-native-navigation on mobile, and maybe write a thin layer to increase code sharing. This is fine because you can have some .web.tsx and .native.tsx files only with the navigation code. So no need to limit ourselves with bad cross platform solutions.
@bawad5 жыл бұрын
I agree that seems like the best way to go
@SogMosee5 жыл бұрын
Hello Ben, at 5:40 , what is the vim command you used to change the next three words? I know C changes the entire line, ce changes the entire word, and vi + #w, then c can select multiple words then change, but how did you instantly change the following 3 words preceding the closing tag?
@bawad5 жыл бұрын
c3w that would change 3 words but I probably used: ct< Which is change until you hit the "
@pankajmundra78142 жыл бұрын
Hi can you please create a video for How to make a sticky view in react native web....I tried scrollview stickyindices but it's not working.
@impzeropvp6 жыл бұрын
Why are the "WorkoutHistory" and "CurrentWorkout" screens put into the "modules" directory when they are actually screens? (in other words, why don't you rename the folder "modules" to "screens") Am I missing something?
@bawad6 жыл бұрын
screens is a good name too
@frankcooke5765 жыл бұрын
How about using an enum for the routes instead of that type?
@bawad5 жыл бұрын
I like that idea
@egoratrubnikov5 жыл бұрын
Why do you use 'useContext' hook and not 'useObservable' hook from 'mobx-react-lite'?
@bawad5 жыл бұрын
Because we just want to share the instance of our mobx class
@itsMapleLeaf6 жыл бұрын
Hey Ben, you should consider using the root store pattern (mobx.js.org/best/store.html#combining-multiple-stores ). Then you could have just _one_ context, then make a custom hook for accessing all stores through that context, e.g. `const { workoutStore } = useRootStore()`
@bawad6 жыл бұрын
Thanks for the tip! So would it be: const RootStoreContext = createContext({ navStore: new NavStore(), workoutStore: new WorkoutStore() }) const { workoutStore } = useContext(RootStoreContext)
@itsMapleLeaf6 жыл бұрын
@@bawad Precisely c: Though you might want to consider declaring the root store as a class, so you can pass "this" to each of the stores, for easy cross-store access. class RootStore { workoutStore = new WorkoutStore(this) navStore = new NavStore(this) } const RootStoreContext = React.createContext(new RootStore()) Might not be necessary here, but something to keep in mind for later if needed
@bawad6 жыл бұрын
Oh that's a nice trick 👌
@cunningham.s_law6 жыл бұрын
are you gonna be the next terry a davis?
@bawad6 жыл бұрын
maybe
@MrREALball5 жыл бұрын
You could've used something like const isWeb = Platform.OS === 'web'; const RouterPackage = isWeb ? require('react-router-dom') : require('react-router-native); const Router = isWeb ? RouterPackage.BrowserRouter : RouterPackage.NativeRouter; export Router; export default RouterPackage; I think its the best way for routing atm
@bawad5 жыл бұрын
I think I might of tried doing something like that, but couldn't get it to work.