Navigation in React Native Web

  Рет қаралды 13,182

Ben Awad

Ben Awad

Күн бұрын

Пікірлер: 23
@Chocoholic1337
@Chocoholic1337 6 жыл бұрын
Really enjoying the series so far. I really like hearing your thought process throughout the development cycle. Keep it up! :)
@brunohplemos
@brunohplemos 5 жыл бұрын
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.
@bawad
@bawad 5 жыл бұрын
Yeah, I ended up going with react router because the web/native API is almost exactly the same. But react-navigation > react-router-native
@brunohplemos
@brunohplemos 5 жыл бұрын
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.
@bawad
@bawad 5 жыл бұрын
I agree that seems like the best way to go
@SogMosee
@SogMosee 5 жыл бұрын
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?
@bawad
@bawad 5 жыл бұрын
c3w that would change 3 words but I probably used: ct< Which is change until you hit the "
@pankajmundra7814
@pankajmundra7814 2 жыл бұрын
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.
@impzeropvp
@impzeropvp 6 жыл бұрын
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?
@bawad
@bawad 6 жыл бұрын
screens is a good name too
@frankcooke576
@frankcooke576 5 жыл бұрын
How about using an enum for the routes instead of that type?
@bawad
@bawad 5 жыл бұрын
I like that idea
@egoratrubnikov
@egoratrubnikov 5 жыл бұрын
Why do you use 'useContext' hook and not 'useObservable' hook from 'mobx-react-lite'?
@bawad
@bawad 5 жыл бұрын
Because we just want to share the instance of our mobx class
@itsMapleLeaf
@itsMapleLeaf 6 жыл бұрын
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()`
@bawad
@bawad 6 жыл бұрын
Thanks for the tip! So would it be: const RootStoreContext = createContext({ navStore: new NavStore(), workoutStore: new WorkoutStore() }) const { workoutStore } = useContext(RootStoreContext)
@itsMapleLeaf
@itsMapleLeaf 6 жыл бұрын
@@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
@bawad
@bawad 6 жыл бұрын
Oh that's a nice trick 👌
@cunningham.s_law
@cunningham.s_law 6 жыл бұрын
are you gonna be the next terry a davis?
@bawad
@bawad 6 жыл бұрын
maybe
@MrREALball
@MrREALball 5 жыл бұрын
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
@bawad
@bawad 5 жыл бұрын
I think I might of tried doing something like that, but couldn't get it to work.
Styling a Component in React Native Web
24:33
Ben Awad
Рет қаралды 4,9 М.
React Native для фронтов | Odessa Frontend Meetup #18
26:23
Odesa Frontend Community
Рет қаралды 10 М.
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
Introduction to react native navigation
10:45
Hitesh Choudhary
Рет қаралды 45 М.
Configuring React Native for Yarn Workspaces
12:06
Ben Awad
Рет қаралды 12 М.
React Native in 100 Seconds
2:17
Fireship
Рет қаралды 1 МЛН
What React Refs Can Do for You
17:56
React Conferences by GitNation
Рет қаралды 5 М.
Setting Up a React Native Web Monorepo
13:46
Ben Awad
Рет қаралды 22 М.
React Native Tutorial  #19 - React Navigation Setup
5:32
Net Ninja
Рет қаралды 312 М.
Jai vs Odin systems programming languages (Non-spicy takes!)
20:10
Context Free
Рет қаралды 83 М.
How to Roll Your Own Auth
13:05
Ben Awad
Рет қаралды 126 М.
I built a REAL Desktop App with both Tauri and Electron
12:22
Bufferhead
Рет қаралды 107 М.