Skip to content

Instantly share code, notes, and snippets.

View narendrashetty's full-sized avatar

Narendra N Shetty narendrashetty

View GitHub Profile
...
onPress() {
this.circleTransition.animate();
}
render() {
return (
<TouchableWithoutFeedback onPress={this.onPress.bind(this)}>
<View style={styles.container}>
<CircleTransition
ref={(circle) => { this.circleTransition = circle }}
...
getLeftPosition () {
const halfSize = size / 2;
const halfWidth = width / 2;
let marginHorizontalTopLeft = -halfSize;
return marginHorizontalTopLeft + halfWidth;
}
getTopPosition () {
const halfSize = size / 2;
let marginVerticalTopLeft = -halfSize;
...
onPress() {
Animated.timing(this.state.scale, {
toValue: 4,
duration: 1000,
easing: Easing.linear
}).start(() => {
this.setState({
scale: new Animated.Value(0)
});
...
constructor(props) {
super(props);
this.state = {
scale: new Animated.Value(0)
};
}
componentDidMount() {
Animated.timing(this.state.scale, {
toValue: 4,
import React from 'react';
import { StyleSheet,
View,
Animated,
Dimensions
} from 'react-native';
const { width, height } = Dimensions.get('window');
const size = Math.min(width, height) - 1;
export default class App extends React.Component {
render() {
// 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
// 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
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;
}
// 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