import React, { Component } from 'react'; import { StyleSheet, View, TouchableOpacity, Text } from 'react-native'; import Interactable from '../../Interactable'; export default class ChangePosition extends Component { constructor(props) { super(props); this.state = {}; } render() { const snapPoints = [ { x: -140, y: -250 }, { x: 140, y: -250 }, { x: -140, y: -120 }, { x: 140, y: -120 }, { x: -140, y: 0 }, { x: 140, y: 0 }, { x: -140, y: 120 }, { x: 140, y: 120 }, { x: -140, y: 250 }, { x: 140, y: 250 }, ]; const blueDestination = snapPoints[3]; return ( { this.refs['blue'].changePosition(blueDestination); }}> {'ChangePosition to ' + JSON.stringify(blueDestination)} { this.refs['green'].changePosition({ x: (Math.random() - 0.5) * 280, y: (Math.random() - 0.5) * 500, }); }}> ChangePosition to random ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'white', }, });