Skip to content

Instantly share code, notes, and snippets.

View hungtrn75's full-sized avatar
🎯
Focusing

Hung Tran hungtrn75

🎯
Focusing
View GitHub Profile
@hungtrn75
hungtrn75 / MapTracking.js
Created June 30, 2021 03:39
@react-native-mapbox-gl/maps
import BottomSheet from '@gorhom/bottom-sheet';
import MapboxGL, {Animated, Camera} from '@react-native-mapbox-gl/maps';
import * as turf from '@turf/turf';
import _ from 'lodash';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {Alert, Easing, StyleSheet, Image, View} from 'react-native';
import RNBootSplash from 'react-native-bootsplash';
import {
runOnJS,
useDerivedValue,
@hungtrn75
hungtrn75 / AnimatePolyline.js
Created June 30, 2021 03:34
react-native-maps
import React, {useRef, useState} from 'react';
import {
Dimensions,
Image,
InteractionManager,
Platform,
StyleSheet,
} from 'react-native';
import {AnimatedRegion, Marker, Polyline} from 'react-native-maps';
import Animated, {
const onChangeAvatar = () => {
const options = {
takePhotoButtonTitle: 'Take Photo',
chooseFromLibraryButtonTitle: 'Choose Photo',
customButtons: [{name: 'Delete Photo', title: 'Delete Photo'}],
storageOptions: {
skipBackup: true,
path: 'images',
},
@hungtrn75
hungtrn75 / View.js
Created June 19, 2021 15:14
Webview Android & @gorhom/bottom-sheet
import BottomSheet from '@gorhom/bottom-sheet';
import React from 'react';
import {StyleSheet, View} from 'react-native';
import RNBootSplash from 'react-native-bootsplash';
import {createNativeWrapper} from 'react-native-gesture-handler';
import WebView from 'react-native-webview';
import {dimensions} from '../../constants/theme';
const Wrapper = createNativeWrapper(WebView);
const WebViewTest = () => {
@hungtrn75
hungtrn75 / CBNative.h
Created April 13, 2021 06:46
Progress Dialog iOS Native Module
//
// CBNative.h
// ecoffice
//
// Created by Suni on 4/13/21.
//
#import <React/RCTBridgeModule.h>
@interface CBNative : NSObject <RCTBridgeModule>
@hungtrn75
hungtrn75 / CBNativeModule.java
Last active April 13, 2021 06:45
Progress Dialog Android Native Module
package com.ecoffice.modules;
import android.content.pm.PackageManager;
import com.ecoffice.utils.DeviceUtil;
import com.ecoffice.widgets.ProgressDialog;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@hungtrn75
hungtrn75 / CBLocation.h
Last active September 27, 2021 08:43
Native Locatio Module
//
// CBLocation.h
// ecoffice
//
// Created by Suni on 4/13/21.
//
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
@hungtrn75
hungtrn75 / AccessoryModule.java
Last active February 25, 2021 03:47
AccessoryPackage
package com.new_farm;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;
import 'package:flutter/material.dart';
class Ticket extends StatelessWidget {
final double margin;
final double borderRadius;
final double clipRadius;
final double smallClipRadius;
final double ticketHeight;
final int numberOfSmallClips;
final Widget child;
@hungtrn75
hungtrn75 / ContentView.swift
Created October 15, 2020 03:02
SwiftUI: ViewRepresentable
import SwiftUI
import UIKit
import PieCharts
struct ContentView: View {
@State private var shouldAnimate = false
var body: some View {