Skip to content

Instantly share code, notes, and snippets.

View dilipsuthar97's full-sized avatar
:octocat:
Enjoying tech world

Dilip Suthar dilipsuthar97

:octocat:
Enjoying tech world
View GitHub Profile
class MainActivity : AppCompatActivity() {
companion object {
const val RC_CODE = 101
const val TAG = "debug_MainActivity"
const val SENT = "SMS_SENT"
const val DELIVERED = "SMS_DELIVERED"
}
// Views
fun main(args: Array<String>) {
print("dilip".lastChar())
}
fun String.lastChar() = this.get(this.length - 1)
@dilipsuthar97
dilipsuthar97 / MyLibraryModule.java
Last active May 11, 2020 08:35
Android Native Module wrapper for ReactNative -MyLibraryModule.java
package com.reactlibrary;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
@dilipsuthar97
dilipsuthar97 / index.ts
Created May 11, 2020 07:32
Android Native Module wrapper for ReactNative -index.ts
// @flow
import { NativeModules } from 'react-native';
const { MyLibrary } = NativeModules;
interface ToastOptions {
message: string;
duration?: number;
}
interface IToast {
@dilipsuthar97
dilipsuthar97 / MyLibraryPackage.java
Created May 11, 2020 08:31
Android Native Module wrapper for ReactNative -MyLibraryPackage.java
package com.reactlibrary;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
@dilipsuthar97
dilipsuthar97 / tsconfig.json
Last active May 11, 2020 08:41
ReactNative typescript configuration json file
{
"compilerOptions": {
/* Basic Options */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
"lib": ["ES2017", "ES7", "ES6", "DOM"],
"declaration": true,
"outDir": "lib", /* Add tthis only for library project otherwise comment this line */

Git Config Guid

Installation

  1. Download & Install git first

Config

  1. git config —global user.email "<your git email>"
  2. git config —global user.name "<your git username OR name>"

Create new repository

import React from 'react';
import {
StyleSheet,
Text,
View,
StatusBar,
Dimensions,
Image,
Animated,
findNodeHandle,
// --------------- LIBRARIES ---------------
import * as React from 'react';
import { View, TouchableOpacity, StyleSheet, Platform } from 'react-native';
import { FlatList } from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
const {
event,
Value,
import React from 'react';
import { Animated } from 'react-native';
import {
TapGestureHandler,
LongPressGestureHandler,
State,
} from 'react-native-gesture-handler';
export default ({
children,