Skip to content

Instantly share code, notes, and snippets.

View narendrashetty's full-sized avatar

Narendra N Shetty narendrashetty

View GitHub Profile
{
'plugins': [
new CompressionPlugin({
test: /\.js$|\.css$|\.html$/
})
]
}
toolbox.router.get('(.*).js', toolbox.fastest, {
'origin':/.herokuapp.com|localhost|maps.googleapis.com/,
'mode':'cors',
'cache': {
'name': `js-assets-${VERSION}`,
'maxEntries': 50,
'maxAgeSeconds': 2592e3
}
});
res.setHeader("Expires", new Date(Date.now() + 2592000000).toUTCString());
import { Component } from 'react';
export default class SSOExample extends Component {
render () {
return (
<View style={styles.container}>
<TouchableHighlight onPress={() => {}}>
<View style={styles.button}>
<Text style={styles.buttonText}>Connect with Twitter</Text>
</View>
// TwitterSignin.h
#import "React/RCTBridge.h"
#import <Foundation/Foundation.h>
@interface TwitterSignin : NSObject <RCTBridgeModule>
@end
// TwitterSignin.m
#import <Fabric/Fabric.h>
#import <TwitterKit/TwitterKit.h>
#import "React/RCTEventDispatcher.h"
#import "TwitterSignin.h"
@implementation TwitterSignin
//specifing to use main-thread-only iOS API
import { Text, View, TouchableHighlight, NativeModules, Alert } from 'react-native';
const { TwitterSignin } = NativeModules;
...
onLoginClick() {
TwitterSignin.logIn((error, loginData) => {
if (error) {
// Login failed
Alert.alert('Error');
return;
}
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
// TwitterSignin.m
#import <Fabric/Fabric.h>
#import <TwitterKit/TwitterKit.h>
#import "React/RCTEventDispatcher.h"
#import "TwitterSignin.h"
@implementation TwitterSignin
//specifing to use main-thread-only iOS API
// TwitterSignin.m
#import <Fabric/Fabric.h>
#import <TwitterKit/TwitterKit.h>
#import "React/RCTEventDispatcher.h"
#import "TwitterSignin.h"
@implementation TwitterSignin
// To export a module named TwitterSignin