Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const onPress = () => {
const event = navigation.emit({
type: 'tabPress',
target: route.key,
});
if (!focused && !event.defaultPrevented) {
navigation.dispatch({
...CommonActions.navigate(route.name),
target: state.key,
});
}
};
reset: (type: string) => {
if (type === 'Onboarding') {
dispatch(
CommonActions.reset({
routes: [{ name: Routes.Onboarding.GetStarted }],
}),
)
dispatch(CommonActions.navigate(Routes.Main.Home))
} else {
dispatch(
CommonActions.reset({
routes: [{ name: Routes.Main.Home }],
}),
)
dispatch(CommonActions.navigate(Routes.Onboarding.GetStarted))
}
},
navigate: {
reset: (type: string) => {
if (type === 'Onboarding') {
dispatch(
CommonActions.reset({
routes: [{ name: Routes.Onboarding.GetStarted }],
}),
)
dispatch(CommonActions.navigate(Routes.Main.Home))
} else {
dispatch(
CommonActions.reset({
routes: [{ name: Routes.Main.Home }],
}),
)
dispatch(CommonActions.navigate(Routes.Onboarding.GetStarted))
}
},
navigate: {
onPress={() => {
if (conversationPublicKey) {
dispatch(
CommonActions.navigate({
name: Routes.Chat.OneToOne,
params: {
convId: conversationPublicKey,
},
}),
)
}
}}
>
onSwipeLeft={() =>
isSwipe &&
dispatch(
CommonActions.navigate({
name: Routes.Chat.MultiMemberSettings,
params: { convId: params?.convId },
}),
)
}
onSwipeLeft={() =>
isSwipe &&
dispatch(
CommonActions.navigate({
name: Routes.Chat.OneToOneSettings,
params: { convId: params?.convId },
}),
)
}
onPress={() =>
!conv
? data.state === beapi.messenger.Contact.State.IncomingRequest
? navigate.main.contactRequest({ contactId: data.publicKey })
: null
: dispatch(
CommonActions.navigate({
name:
conv.type === beapi.messenger.Conversation.Type.ContactType
? Routes.Chat.OneToOne
: Routes.Chat.Group,
params: {
convId: convPk,
scrollToMessage: kind === SearchResultKind.Interaction && inte ? inte.cid : null,
},
}),
)
}
: () =>
dispatch(
CommonActions.navigate({
name: Routes.Chat.OneToOne,
params: {
convId: publicKey,
},
}),
)
}