Skip to content

Instantly share code, notes, and snippets.

View kaushal9678's full-sized avatar

Kaushal yadav kaushal9678

  • New Delhi India
View GitHub Profile
@kaushal9678
kaushal9678 / AndroidManifest.xml
Created April 2, 2021 08:16
Deeplinking configuration for Android
<intent-filter android:label="@string/filter_title_viewproducts" android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Handle urls starting with "http://www.kyadav.com/users/" -->
<!-- Note: In Android you have to define every DeepLink path in pathPrefix variable
like I have /users/
if you have more like /profile/test/
then add one more data tag <data android:scheme="https"
@kaushal9678
kaushal9678 / job.tsx
Created April 2, 2021 07:58
for terminated app
useEffect(() => {
AppState.addEventListener("change", _handleAppStateChange);
Linking.getInitialURL().then((url) => {
if (url) {
const route = url.replace(/.*?:\/\//g, '').split('?');
//if app is open first time and deep link path is initial route
if(url.includes('/jobs-') && appState.current === "active"){
const job = route[0].substring(route[0].lastIndexOf('/') + 1)
@kaushal9678
kaushal9678 / DeepLinkNavigation.ts
Last active April 2, 2021 07:25
A file where I handle all incoming DeepLink url's
const navigation = container.get<INavigationServices>(TYPES.INavigationServices);
export const manageRoutes = (url: string) => {
const route = url.replace(/.*?:\/\//g, '').split('?');
if(url.includes('/jobs-')){
const job = route[0].substring(route[0].lastIndexOf('/') + 1)
const jobSearch = job.split('-').join(" ")
@kaushal9678
kaushal9678 / App.tsx
Last active April 2, 2021 07:13
stack navigations and BottomTabNavigation for DeepLinking using react-navigation-5.0
import linking from "./src/navigation/Linking";
import {
Colors,
} from 'react-native/Libraries/NewAppScreen';
import { navigationRef } from './src/navigation/RootNavigaton'
axios.defaults.baseURL =
'https://europe-west1-socialape-d081e.cloudfunctions.net/api';
const App = (props:any) => {
const isDarkMode = useColorScheme() === 'dark';
import { LinkingOptions } from "@react-navigation/native";
const config = {
screens: {
BottomTabs: {
path: 'bottom_tabs',
screens: {
Jobs: {
path: 'jobs',
exact: true,