Skip to content

Instantly share code, notes, and snippets.

export const users: User[] = [
{ id: 1, name: "John New" },
{ id: 2, name: "Emauel joseph" },
{ id: 3, name: "Nuwan Theek" },
{ id: 4, name: "Rasik N" },
];
export type User = {
id: number;
name:string
src/
|--app/
| |--layout.tsx
| |--page.tsx
| |--api/
| | |--route.ts
| | | |users/
| | | |--route.ts
## Android
adb shell am start -W -a android.intent.action.VIEW -d "linkingmobile://settings" mobileApplicationID
adb shell am start -W -a android.intent.action.VIEW -d "https://yourDomain.com/Details" mobileApplicationID
## iOS
xcrun simctl openurl booted "linkingmobile://Settings"
xcrun simctl openurl booted "https://yourDomain.im/Settings"
<!-- Universal Links -->
<intent-filter android:autoVerify='true'>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme='https' android:host='nextcodingjs.com' />
</intent-filter>
<!-- Url Schemes -->
<intent-filter android:label='filter_react_native'>
<action android:name="android.intent.action.VIEW" />
//...
useEffect(() => {
// Get the deep link used to open the app
const getUrl = async () => {
const initialUrl = await Linking.getInitialURL();
if (initialUrl === null) {
return;
}
....
// iOS 9.x or newer
#import <React/RCTLinkingManager.h>
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<TeamID>.<BundleId>", // AA4CAZ576V.com.example.myapp
"paths": [ "*" ] // you can use wildcard to accept any route like ["*"]
}
]
}
import * as React from 'react';
import {View, Text, TouchableOpacity, Linking} from 'react-native';
import {NavigationContainer, createNavigationContainerRef, useNavigation} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import { useEffect } from 'react';
const Stack = createNativeStackNavigator();
const navigationRef = createNavigationContainerRef()
function HomeScreen() {
const navigation = useNavigation();
@pasindu1
pasindu1 / script.js
Last active July 5, 2023 16:49
eYQEVRY
let array = [2, 5, 8, 5, 2, 3, 4, 5, 4, 3, 5, 2, 7, 11]
let newArray = array.reduce((acc, curValue) => {
if (acc.indexOf(curValue) === -1) {
acc.push(curValue)
}
return acc
}, [])