-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[CHORE] Update react-navigation to v5 #2154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 127 commits
Commits
Show all changes
132 commits
Select commit
Hold shift + click to select a range
f1e9d5d
react-navigation v5 installed
diegolmello 796c82a
compiling
diegolmello 3def144
Outside working
diegolmello 0cc510d
InsideStack compiling
diegolmello 3867e57
Switch stack
diegolmello e4de36d
Starting room
diegolmello f764527
RoomView header
diegolmello a895d41
SafeAreaView
diegolmello e03d423
Slide from right stack animation
diegolmello f59d8e0
stash
diegolmello ae459d1
Fix params
diegolmello 1ec094c
Create channel
diegolmello 57d13e9
inapp notification
diegolmello cef50fe
Custom status
diegolmello 3b93c11
Add server working
diegolmello 988d3a3
Refactor appStart
diegolmello 3347a67
Attachment
diegolmello 99e4dfc
in-app notification
diegolmello c60bdfb
AuthLoadingView
diegolmello 0bda859
Remove compat
diegolmello 5ca94ee
Navigation
diegolmello 06684cb
Outside animations
diegolmello cabf630
Fix new server icon
diegolmello c2a1173
block modal
diegolmello 40b38b7
AttachmentView header
diegolmello 739f885
Remove unnecessary code
diegolmello 69e2fe8
SelectedUsersView header
diegolmello 6c132cb
StatusView
diegolmello 97ae9bc
CreateDiscussionView
diegolmello 15e1897
RoomInfoView
diegolmello 816cb43
RoomInfoEditView style
diegolmello a1c2875
RoomMembersView
diegolmello 1f6bb5d
RoomsListView header
diegolmello 009de40
RoomView header
diegolmello ffda9e5
Share extension
diegolmello 4f010e5
getParam
diegolmello 452620c
Focus/blur
diegolmello ff5b5b3
Trying to fix inapp
diegolmello 0b0e768
Lint
diegolmello 7413d26
Merge branch 'develop' into update-rn-5
diegolmello 1e49d80
Simpler app container
diegolmello f721c96
Update libs
diegolmello 48e47f2
Revert "Simpler app container"
diegolmello 612a5d8
Load messages faster
diegolmello 69930cd
Fix safearea on ReactionsModal
diegolmello 945c096
Update safe area to v3
diegolmello 4d8a758
lint
diegolmello 790599f
Fix transition
diegolmello 2e247cc
stash - drawer replace working
diegolmello f08ef94
stash - modal nav
diegolmello e597a44
RoomActionsView as tablet modal
diegolmello 42225b6
RoomStack
diegolmello f6ea268
Stop showing RoomView header when there's no room
diegolmello 28e5b90
Custom Header and different navigation based on stack
diegolmello ed2ca11
Refactor setHeader
diegolmello 0e03328
MasterDetailContext
diegolmello 763f494
RoomView header
diegolmello 15ad611
Fix isMasterDetail rule
diegolmello a24b97b
KeyCommands kind of working
diegolmello 20b768f
Create channel on tablet
diegolmello 7dcb38b
RoomView sCU
diegolmello 98dc19d
Remove withSplit
diegolmello b7e634a
Settings opening as modal
diegolmello 383b060
Settings
diegolmello 631aa9c
StatusView headerLeft
diegolmello fa33770
Admin panel
diegolmello 8977bc2
TwoFactor style
diegolmello 06f2e58
DirectoryView
diegolmello 5f5461d
ServerDropdown and SortDropdown animations
diegolmello 28b68fa
ThreadMessagesView
diegolmello be5974c
Navigate to empty RoomView on server switch when in master detail
diegolmello 650ada5
ProfileView header
diegolmello a7df8a7
Fix navigation issues
diegolmello 7f7184a
Nav to any room info on tablet
diegolmello 4f970ac
Room info
diegolmello 69b4e33
Refactoring
diegolmello 8e07b3c
Fix rooms search
diegolmello c6dcbd6
Roomslist commands
diegolmello 164c769
SearchMessagesView close modal
diegolmello c1d2445
Key commands
diegolmello 8e9066b
Fix undefined subscription
diegolmello b57284d
Disallow navigate to focused room
diegolmello 52d22ed
isFocused state on RoomsListView
diegolmello f8f629e
Blur text inputs when focus is lost
diegolmello e53bc36
Replace animation
diegolmello 38088d0
Default nav theme
diegolmello f0be483
Refactoring
diegolmello c66e286
Always open Attachment with close modal button
diegolmello 3466050
ModalContainer backdrop following themes
diegolmello faa0850
Screen tracking
diegolmello b0a5c94
Refactor get active route for in-app notification
diegolmello 5f79b90
Only mark room as focused when in master detail layout
diegolmello 6ba9036
Lint
diegolmello 01e7591
Open modals as fade from bottom on Android
diegolmello 0da8abf
typo
diegolmello 064ae52
Fixing tests
diegolmello 4ddae42
Fix in-app update
diegolmello 920f1a9
Merge branch 'develop' into update-rn-5
diegolmello c5fcde1
Fixing goRoom issues
diegolmello 7025ba3
Refactor stack names
diegolmello 60dbce9
Fix unreadsCount
diegolmello 8a4c0c0
Fix stack
diegolmello f80e798
Fix header animation
diegolmello 44c451d
Refactor ShareNavigation
diegolmello 45e86a3
Refactor navigation theme
diegolmello 4568de2
Make sure title is set
diegolmello 5497c7e
Fix create discussion navigation
diegolmello 251edd5
Remove unused variable
diegolmello 85a2804
Create discussions from actions fixed
diegolmello 63295c3
Layout animation
diegolmello 16c7a44
Screen lock on share extension
diegolmello 0f17f45
Unnecessary change
diegolmello 074dc2a
Admin border
diegolmello 171ef1f
Set header after state callback
diegolmello fd6ae51
Fix key commands on outside stack
diegolmello dbbad2c
Fix back button pressed
diegolmello 4839a35
Remove layout animations from Android
diegolmello ce934dc
Tweak animations on Android
diegolmello bbe1b7a
Disable swipe gesture to open drawer
diegolmello d373467
Fix current item on RoomsListView
diegolmello c3e0164
Fix add server
diegolmello 1d76b3e
Merge branch 'develop' into update-rn-5
diegolmello ac2fd40
Fix drawer
diegolmello 3cc29b1
Fix broadcast
diegolmello 868f78b
LayoutAnimation instead of Transitions
diegolmello edb7db8
Fix onboarding back press
diegolmello 798bbc8
Fix assorted tests
diegolmello 97acd69
Create discussion fix
diegolmello 8253145
Merge branch 'develop' into update-rn-5
diegolmello 2339933
RoomInfoView header
diegolmello 60288dc
Merge branch 'update-rn-5' of github.com:RocketChat/Rocket.Chat.React…
diegolmello ef81cec
Drawer active item
diegolmello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { NavigationContainer } from '@react-navigation/native'; | ||
| import { createStackNavigator } from '@react-navigation/stack'; | ||
| import { connect } from 'react-redux'; | ||
| import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context'; | ||
|
|
||
| import Navigation from './lib/Navigation'; | ||
| import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; | ||
| import { | ||
| ROOT_LOADING, ROOT_OUTSIDE, ROOT_NEW_SERVER, ROOT_INSIDE, ROOT_SET_USERNAME, ROOT_BACKGROUND | ||
| } from './actions/app'; | ||
|
|
||
| // Stacks | ||
| import AuthLoadingView from './views/AuthLoadingView'; | ||
|
|
||
| // SetUsername Stack | ||
| import SetUsernameView from './views/SetUsernameView'; | ||
|
|
||
| import OutsideStack from './stacks/OutsideStack'; | ||
| import InsideStack from './stacks/InsideStack'; | ||
| import MasterDetailStack from './stacks/MasterDetailStack'; | ||
| import { ThemeContext } from './theme'; | ||
| import { setCurrentScreen } from './utils/log'; | ||
|
|
||
| // SetUsernameStack | ||
| const SetUsername = createStackNavigator(); | ||
| const SetUsernameStack = () => ( | ||
| <SetUsername.Navigator screenOptions={defaultHeader}> | ||
| <SetUsername.Screen | ||
| name='SetUsernameView' | ||
| component={SetUsernameView} | ||
| /> | ||
| </SetUsername.Navigator> | ||
| ); | ||
|
|
||
| // App | ||
| const Stack = createStackNavigator(); | ||
| const App = React.memo(({ root, isMasterDetail }) => { | ||
| if (!root) { | ||
| return null; | ||
| } | ||
|
|
||
| const { theme } = React.useContext(ThemeContext); | ||
| const navTheme = navigationTheme(theme); | ||
|
|
||
| React.useEffect(() => { | ||
| const state = Navigation.navigationRef.current.getRootState(); | ||
| const currentRouteName = getActiveRouteName(state); | ||
| Navigation.routeNameRef.current = currentRouteName; | ||
| setCurrentScreen(currentRouteName); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <SafeAreaProvider initialMetrics={initialWindowMetrics}> | ||
| <NavigationContainer | ||
| theme={navTheme} | ||
| ref={Navigation.navigationRef} | ||
| onStateChange={(state) => { | ||
| const previousRouteName = Navigation.routeNameRef.current; | ||
| const currentRouteName = getActiveRouteName(state); | ||
| if (previousRouteName !== currentRouteName) { | ||
| setCurrentScreen(currentRouteName); | ||
| } | ||
| Navigation.routeNameRef.current = currentRouteName; | ||
| }} | ||
| > | ||
| <Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}> | ||
| <> | ||
| {root === ROOT_LOADING || root === ROOT_BACKGROUND ? ( | ||
| <Stack.Screen | ||
| name='AuthLoading' | ||
| component={AuthLoadingView} | ||
| /> | ||
| ) : null} | ||
| {root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? ( | ||
| <Stack.Screen | ||
| name='OutsideStack' | ||
| component={OutsideStack} | ||
| /> | ||
| ) : null} | ||
| {root === ROOT_INSIDE && isMasterDetail ? ( | ||
| <Stack.Screen | ||
| name='MasterDetailStack' | ||
| component={MasterDetailStack} | ||
| /> | ||
| ) : null} | ||
| {root === ROOT_INSIDE && !isMasterDetail ? ( | ||
| <Stack.Screen | ||
| name='InsideStack' | ||
| component={InsideStack} | ||
| /> | ||
| ) : null} | ||
| {root === ROOT_SET_USERNAME ? ( | ||
| <Stack.Screen | ||
| name='SetUsernameStack' | ||
| component={SetUsernameStack} | ||
| /> | ||
| ) : null} | ||
| </> | ||
| </Stack.Navigator> | ||
| </NavigationContainer> | ||
| </SafeAreaProvider> | ||
| ); | ||
| }); | ||
| const mapStateToProps = state => ({ | ||
| root: state.app.root, | ||
| isMasterDetail: state.app.isMasterDetail | ||
| }); | ||
|
|
||
| App.propTypes = { | ||
| root: PropTypes.string, | ||
| isMasterDetail: PropTypes.bool | ||
| }; | ||
|
|
||
| const AppContainer = connect(mapStateToProps)(App); | ||
| export default AppContainer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { APP } from './actionsTypes'; | ||
|
|
||
| export const ROOT_OUTSIDE = 'outside'; | ||
| export const ROOT_INSIDE = 'inside'; | ||
| export const ROOT_LOADING = 'loading'; | ||
| export const ROOT_NEW_SERVER = 'newServer'; | ||
| export const ROOT_SET_USERNAME = 'setUsername'; | ||
| export const ROOT_BACKGROUND = 'background'; | ||
|
|
||
| export function appStart({ root, ...args }) { | ||
| return { | ||
| type: APP.START, | ||
| root, | ||
| ...args | ||
| }; | ||
| } | ||
|
|
||
| export function appReady() { | ||
| return { | ||
| type: APP.READY | ||
| }; | ||
| } | ||
|
|
||
| export function appInit() { | ||
| return { | ||
| type: APP.INIT | ||
| }; | ||
| } | ||
|
|
||
| export function appInitLocalSettings() { | ||
| return { | ||
| type: APP.INIT_LOCAL_SETTINGS | ||
| }; | ||
| } | ||
|
|
||
| export function setMasterDetail(isMasterDetail) { | ||
| return { | ||
| type: APP.SET_MASTER_DETAIL, | ||
| isMasterDetail | ||
| }; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| export const MAX_SIDEBAR_WIDTH = 321; | ||
| export const MAX_CONTENT_WIDTH = '90%'; | ||
| export const MAX_SCREEN_CONTENT_WIDTH = '50%'; | ||
| export const MIN_WIDTH_SPLIT_LAYOUT = 700; | ||
| export const MIN_WIDTH_MASTER_DETAIL_LAYOUT = 700; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import { SafeAreaView } from 'react-native-safe-area-context'; | ||
| import { View, StyleSheet } from 'react-native'; | ||
| import { themes } from '../../constants/colors'; | ||
| import { themedHeader } from '../../utils/navigation'; | ||
| import { isIOS } from '../../utils/deviceInfo'; | ||
|
|
||
| // Get from https://github.com/react-navigation/react-navigation/blob/master/packages/stack/src/views/Header/HeaderSegment.tsx#L69 | ||
| export const headerHeight = isIOS ? 44 : 56; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| height: headerHeight, | ||
| flexDirection: 'row', | ||
| justifyContent: 'center', | ||
| elevation: 4 | ||
| } | ||
| }); | ||
|
|
||
| const Header = ({ | ||
| theme, headerLeft, headerTitle, headerRight | ||
| }) => ( | ||
| <SafeAreaView style={{ backgroundColor: themes[theme].headerBackground }} edges={['top', 'left', 'right']}> | ||
| <View style={[styles.container, { ...themedHeader(theme).headerStyle }]}> | ||
|
diegolmello marked this conversation as resolved.
|
||
| {headerLeft ? headerLeft() : null} | ||
| {headerTitle ? headerTitle() : null} | ||
| {headerRight ? headerRight() : null} | ||
| </View> | ||
| </SafeAreaView> | ||
| ); | ||
|
|
||
| Header.propTypes = { | ||
| theme: PropTypes.string, | ||
| headerLeft: PropTypes.element, | ||
| headerTitle: PropTypes.element, | ||
| headerRight: PropTypes.element | ||
| }; | ||
|
|
||
| export default Header; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.