Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map((scene, index) => ({
...NavigationPropTypes.extractSceneRendererProps(this.props),
scene,
index,
navigation: addNavigationHelpers({
...this.props.navigation,
state: scene.route,
}),
}));
appBar = scenesProps.map(this._renderHeader, this);
} else {
appBar = this._renderHeader({
...NavigationPropTypes.extractSceneRendererProps(this.props),
position: new Animated.Value(this.props.scene.index),
progress: new Animated.Value(0),
});
}
// eslint-disable-next-line no-unused-vars
const { scenes, scene, style, position, progress } = this.props;
return (
);
}
}
constructor(props, context: any) {
super(props, context);
// The initial layout isn't measured. Measured layout will be only available
// when the component is mounted.
const layout = {
height: new Animated.Value(0),
initHeight: 0,
initWidth: 0,
isMeasured: false,
width: new Animated.Value(0),
};
this.state = {
layout,
position: new Animated.Value(this.props.navigation.state.index),
progress: new Animated.Value(1),
scenes: navigationScenesReducer([], this.props.navigation.state),
};
this._prevTransitionProps = null;
this._transitionProps = buildTransitionProps(props, this.state);
this._isMounted = false;
this._isTransitionRunning = false;
this._queuedTransition = null;
}
super(props, context);
// The initial layout isn't measured. Measured layout will be only available
// when the component is mounted.
const layout = {
height: new Animated.Value(0),
initHeight: 0,
initWidth: 0,
isMeasured: false,
width: new Animated.Value(0),
};
this.state = {
layout,
position: new Animated.Value(this.props.navigation.state.index),
progress: new Animated.Value(1),
scenes: navigationScenesReducer([], this.props.navigation.state),
};
this._prevTransitionProps = null;
this._transitionProps = buildTransitionProps(props, this.state);
this._isMounted = false;
this._isTransitionRunning = false;
this._queuedTransition = null;
}
constructor(props, context: any) {
super(props, context);
// The initial layout isn't measured. Measured layout will be only available
// when the component is mounted.
const layout = {
height: new Animated.Value(0),
initHeight: 0,
initWidth: 0,
isMeasured: false,
width: new Animated.Value(0),
};
this.state = {
layout,
position: new Animated.Value(this.props.navigation.state.index),
progress: new Animated.Value(1),
scenes: navigationScenesReducer([], this.props.navigation.state),
};
this._prevTransitionProps = null;
this._transitionProps = buildTransitionProps(props, this.state);
this._isMounted = false;
this._isTransitionRunning = false;
this._queuedTransition = null;
}
constructor(props, context: any) {
super(props, context);
// The initial layout isn't measured. Measured layout will be only available
// when the component is mounted.
const layout = {
height: new Animated.Value(0),
initHeight: 0,
initWidth: 0,
isMeasured: false,
width: new Animated.Value(0),
};
this.state = {
layout,
position: new Animated.Value(this.props.navigation.state.index),
progress: new Animated.Value(1),
scenes: navigationScenesReducer([], this.props.navigation.state),
};
this._prevTransitionProps = null;
this._transitionProps = buildTransitionProps(props, this.state);
this._isMounted = false;
import {createElement, Component, render, setNativeProps} from 'rax';
import View from 'rax-view';
import PanResponder from 'universal-panresponder';
import Animated from 'rax-animated';
class Drag extends Component {
state = {
pan: new Animated.ValueXY(),
scale: new Animated.Value(1),
};
componentWillMount() {
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder,
onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder,
onPanResponderGrant: this._handlePanResponderGrant,
onPanResponderMove: this._handlePanResponderMove,
onPanResponderRelease: this._handlePanResponderEnd,
onPanResponderTerminate: this._handlePanResponderEnd,
});
}
render() {
// Destructure the value of pan from the state
_handleMoveShouldSetPanResponder(e, gestureState) {
// Should we become active when the user moves a touch over the circle?
return true;
}
_handlePanResponderGrant = (e, gestureState) => {
this.state.pan.setOffset({x: this.state.pan.x._value, y: this.state.pan.y._value});
this.state.pan.setValue({x: 0, y: 0});
Animated.spring(
this.state.scale,
{ toValue: 1.1, friction: 3 }
).start();
};
_handlePanResponderMove = Animated.event([
null, {dx: this.state.pan.x, dy: this.state.pan.y},
]);
_handlePanResponderEnd = (e, gestureState) => {
this.state.pan.flattenOffset();
Animated.spring(
this.state.scale,
{ toValue: 1, friction: 3 }
).start();
};
}
var styles = {
container: {
flex: 1,
paddingTop: 64,
import {createElement, Component, render} from 'rax';
import Text from 'rax-text';
import View from 'rax-view';
import Image from 'rax-image';
import Animated from 'rax-animated';
class AnimatedSample extends Component {
state = {
bounceValue: new Animated.Value(0),
translateValue: new Animated.ValueXY({
x: 0,
y: 0
}),
rotateValue: new Animated.Value(0),
};
render() {
return (
componentWillMount() {
this._animations = {
xRotationPercentage: new Animated.Value(0),
yRotationPercentage: new Animated.Value(0),
xTranslationPercentage: new Animated.Value(0),
yTranslationPercentage: new Animated.Value(0)
};
this._panResponder = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => true,
onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
onMoveShouldSetPanResponder: (evt, gestureState) => true,
onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,
onPanResponderMove: (e, gestureState) => {
var {
pageX: x,
pageY: y
} = e.changedTouches[0];
this._animations.xRotationPercentage.setValue(calculatePercentage(y, height));
this._animations.yRotationPercentage.setValue(calculatePercentage(x, width) * -1);
this._animations.xTranslationPercentage.setValue(calculatePercentage(x, width));
import {createElement, Component, render} from 'rax';
import Text from 'rax-text';
import View from 'rax-view';
import Image from 'rax-image';
import Animated from 'rax-animated';
class AnimatedSample extends Component {
state = {
bounceValue: new Animated.Value(0),
translateValue: new Animated.ValueXY({
x: 0,
y: 0
}),
rotateValue: new Animated.Value(0),
};
render() {
return (