-
Notifications
You must be signed in to change notification settings - Fork 7
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
Upgrade React Navigation from v4 to v6 #132
Comments
I'm refactoring the code currently, I should be finish soon. I opened the pull request because I might have question on specific files such as createAnimatedBottomTabNavigator.js About that, is there a specific reason for that file to be a plain JS file. Should I convert it a TSX file ? |
Hi ! Thank you for your work 👍 The project is 5 or 6 years old, I was not using typescript at the time, so some files are still in js, or using react class components. I'm not sure, but do you need any .env variables in order to run the project, or are you able to run it without it ? |
You're welcome. I'm able to run it without .env variables for now but I might need them later on. |
I ran into an issue trying to type Link.tsx. While I did succeed in typing in somewhat, the type of params isn't resolving properly from the given route name. Any idea how to fix this ? |
Is the problem because we're using a class component? |
I don't think so. Also, I completed the refactoring (mostly). You can go through testing to check if I didn't miss anything. I'll format everything with the linter also and remove unused code that was commented out. Type checking is far from perfect but I didn't want to fix it because it would make the pull request way to big. So unless you want to, I'll make the pull request ready for review after you checked everything was working. |
Size of the PR is not an issue, if you're keen to fix typings I'd be more than happy. |
J'ai trouvé quelques oublies que je suis entrain de corrigé actuellement. Mais je suis tombé sur un problème un peu épineux, peut-être lié à #153 . Problème 1Le // WebViewQuillEditor.tsx
<WebView
// useWebKit // This doesn't exist anymore
onLoad={onWebViewLoaded}
onLoadEnd={() => editorLoaded()} // fix loading issue here
onMessage={handleMessage}
originWhitelist={['*']}
ref={webViewRef}
source={{ html: studiesHTML }}
injectedJavaScript={injectFont()}
domStorageEnabled
allowUniversalAccessFromFileURLs
allowFileAccessFromFileURLs
allowFileAccess
keyboardDisplayRequiresUserAction={false}
renderError={renderError}
onError={onError}
bounces={false}
scrollEnabled={false}
hideKeyboardAccessoryView
onContentProcessDidTerminate={syntheticEvent => {
console.warn('Content process terminated, reloading...')
const { nativeEvent } = syntheticEvent
webViewRef.current?.reload()
Sentry.captureException(nativeEvent)
}}
onRenderProcessGone={syntheticEvent => {
webViewRef.current?.reload()
const { nativeEvent } = syntheticEvent
Sentry.captureException(nativeEvent)
}}
/> // QuillEditor.js
loadEditor = ({ fontFamily, language }) => {
dispatchConsole(fontFamily)
document.getElementById('editor').style.fontFamily = fontFamily
this.quill = new Quill('#editor', {
theme: 'snow',
modules: {
toolbar: BROWSER_TESTING_ENABLED,
'inline-verse': true,
'block-verse': true,
format: true,
},
placeholder:
language === 'fr' ? 'Créer votre étude...' : 'Create your study...',
readOnly: true,
})
dispatchConsole('loading editor')
this.quill.focus() // this throws error because this.quill doesn't exist yet
dispatchConsole('editor initialized')
dispatch('EDITOR_LOADED', {
type: 'success',
delta: this.quill.getContents(),
})
this.addTextChangeEventToEditor()
} Problème 2J'ai une question qui sera peut-etre un peu plus simple. Actuellement, si on essaie d'ouvrir une étude dans un nouvelle onglet, l'application crash car le // EditStudyScreen.tsx
const studyId = route.params.studyId // doesn't exist
const canEdit = route.params.canEdit
const hasBackButton = route.params.hasBackButton
const openedFromTab = route.params.openedFromTab Cela s'explique parce qu'on n'utilise pas // useOpenInNewTab.ts
const openInNewTab = (
data?: TabItem,
params: { autoRedirect?: true } = {}
) => {
const newTabId = `new-${Date.now()}`
dispatchTabs({
type: 'insert',
value: {
id: newTabId,
title: t('tabs.new'),
isRemovable: true,
type: 'new',
data: {}, // le studyId se trouve ici
...data,
},
})
if (!params.autoRedirect) {
Snackbar.show(t('tabs.created'), 'info', {
confirmText: t('common.goTo'),
onConfirm: () => {
navigation.navigate('AppSwitcher', route.params)
triggerSlideNewTab(newTabId)
},
})
} else {
console.log('params', route.params)
triggerSlideNewTab(newTabId)
navigation.navigate('AppSwitcher', route.params)
}
} Je ne comprends pas comment je puis récupérer le |
Problème 2Il y a 3 comportements pour le EditStudyScreen
C'est le HOC du EditStudyScreen qui s'occupe de créer le studyId pour l'écran, sois en récupéré donc le param depuis la navigation, depuis les props, ou alors en le créant si c'est une new study |
Problème 1Pour l'instant ça ne me parle pas, surtout si les fichiers web du WebViewQuillEditor n'ont pas été touchés, je regarderais |
Merci pour le deuxième problème, j'ai pu avancer. En effet, j'avais oublié le HOC et en reportant la logique dans le screen, ça à l'air de fonctionner correctement. |
Transitioning our app's navigation system from React Navigation v4 to v6. This upgrade will bring improved performance, latest features, and better compatibility with the latest React Native versions.
Tasks:
The text was updated successfully, but these errors were encountered: