Skip to content

Instantly share code, notes, and snippets.

View adhithiravi's full-sized avatar
🎯
Focusing

Adhithi Ravichandran adhithiravi

🎯
Focusing
View GitHub Profile
class Form extends React.Component {
constructor (props) {
super(props)
this.state = {
input: ''
}
}
handleChangeInput = (text) => {
class Form extends React.Component {
constructor (props) {
super(props)
this.state = {
input: ''
}
}
handleChangeInput = (text) => {
@adhithiravi
adhithiravi / MyComponentPropTypes.js
Last active April 30, 2018 21:40
Defining PropTypes for a component example.
import PropTypes from 'prop-types'
export default class MyComponent extends React.Component {
render() {
// Render Something
}
}
// You can declare that a prop is a specific JS type.
@adhithiravi
adhithiravi / MyComponentDefaultProps.js
Last active May 23, 2018 21:03
Showing use of defaultProps
import PropTypes from 'prop-types'
export default class MyComponent extends React.Component {
render() {
// Render Something
}
}
// You can declare that a prop is a specific JS type.
@adhithiravi
adhithiravi / VideoComponent.js
Created August 16, 2018 19:34
VideoComponent.js
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { View, StyleSheet } from 'react-native'
import Video from 'react-native-video'
export default class VideoComponent extends React.Component {
renderVideo () {
return(
<Video
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import React, { Component } from 'react';
import {
AlertIOS,
StyleSheet,
Text,
TouchableHighlight,
View,
NativeModules
} from 'react-native';
@adhithiravi
adhithiravi / TouchID.js
Last active September 19, 2018 04:28
Show an example usage of isSupported()
clickHandler() {
TouchID.isSupported()
.then(biometryType => {
// Success code
if (biometryType === 'FaceID') {
console.log('FaceID is supported.');
} else if (biometryType === 'TouchID'){
console.log('TouchID is supported.');
} else if (biometryType === true) {
// Touch ID is supported on Android
@adhithiravi
adhithiravi / FingerPrintComp.js
Last active September 19, 2018 04:35
Example showing authentication using touch id
'use strict';
import React, { Component } from 'react';
import {
AlertIOS,
StyleSheet,
Text,
TouchableHighlight,
View,
} from 'react-native';
import * as Keychain from 'react-native-keychain';
async () => {
const username = 'zuck';
const password = 'poniesRgr8';
// Store the credentials
await Keychain.setGenericPassword(username, password);
try {