Skip to content

Instantly share code, notes, and snippets.

@Jpoliachik
Jpoliachik / gist:00b76d1338c700c05274
Created January 31, 2016 21:25
Layout Animation Example Spring
// Called when a top button is pressed, with index corresponding to button title.
onPress(index) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
this.setState({index: index});
}
@Jpoliachik
Jpoliachik / index.ios.js
Created January 31, 2016 21:07
LayoutAnimation Example No Animation
// Called when a top button is pressed, with index corresponding to button title.
onPress(index) {
this.setState({index: index});
}
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@Jpoliachik
Jpoliachik / TopCropImageAndroid
Last active December 31, 2015 13:59
For Android:A subclass of ImageView that scales the image as 'TopCrop' The source image will be scaled to match the view and cropped so the top of the image remains fixed at the top of the view. The bottom will crop according to the view height.
/**
* @author Justin Poliachik
*
* This ImageView subclass allows a scale type of 'TopCrop'
* The src image will be scaled to match the view and cropped
* so that the top of the image remains fixed.
* The bottom will crop according to the view height.
*/
public class TopCropImage extends ImageView{
@Jpoliachik
Jpoliachik / BottomCrop ImageView
Created December 17, 2013 00:03
Android A subclass of ImageView that scales the image as 'BottomCrop' The source image will be scaled to match the view and cropped so the bottom of the image remains fixed at the bottom of the view. The top will crop according to the view height.
/**
* @author Justin Poliachik
*
* This ImageView subclass allows a scale type of 'BottomCrop'
* The src image will be scaled to match the view and cropped
* so that the bottom of the image remains fixed.
* The top will crop according to the view height.
*/
public class BottomCropImage extends ImageView {