Skip to content

Instantly share code, notes, and snippets.

import React, { Component } from 'react'
import { Animated, Dimensions, Image, StyleSheet, View } from 'react-native'
import MapView from 'react-native-maps'
import LinearGradient from 'react-native-linear-gradient'
import { Body, Card, CardItem, Header, Left, Text, Thumbnail, Title } from 'native-base'
import ContentComponent from './ContentComponent'
const {height: screenHeight, width: screenWidth} = Dimensions.get('window')
export default class MyApp extends Component {
@andigu
andigu / navigator.js
Last active February 26, 2023 18:02
import React, { Component } from 'react'
import { Animated, Easing, StyleSheet, View, Dimensions } from 'react-native'
import { Transitioner } from 'react-navigation'
const {height: screenHeight} = Dimensions.get('window');
export default class BubbleTransition extends Component {
renderScene = ({position}, {index, key, route}) => {
const Screen = this.props.router.getComponentForRouteName(route.routeName)
return <View style={StyleSheet.absoluteFill} key={key}>
import React, { Component } from 'react'
import { Animated, Dimensions, Easing, StyleSheet, View } from 'react-native'
import { Transitioner } from 'react-navigation'
const {width: screenWidth, height: screenHeight} = Dimensions.get('window')
export default class BubbleTransition extends Component {
renderScene = ({position}, {index, key, route}) => {
const Page = this.props.router.getComponentForRouteName(route.routeName)
return <View style={StyleSheet.absoluteFill} key={key}>
<Page navigation={this.props.navigation}/>
import React, { Component } from 'react'
import { presets, spring, StaggeredMotion } from 'react-motion'
import _ from 'lodash'
import { Dimensions, PanResponder, View } from 'react-native'
const {height: screenHeight, width: screenWidth} = Dimensions.get('window')
const colors = ['#F44336', '#9C27B0', '#2196F3', '#009688', '#FF9800', '#607D8B']
export class ReactMotion extends Component {
state = {
public class GeoLocationModule extends ReactContextBaseJavaModule {
public GeoLocationModule(ReactApplicationContext reactContext) {
super(reactContext);
BroadcastReceiver geoLocationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Location message = intent.getParcelableExtra("message");
GeoLocationModule.this.sendEvent(message);
}
};
public class GeoLocationService extends Service {
public static final String FOREGROUND = "com.app_name.location.FOREGROUND";
private static int GEOLOCATION_NOTIFICATION_ID = 12345689;
LocationManager locationManager = null;
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
GeoLocationService.this.sendMessage(location);
}
import React, {Component} from "react";
import PropTypes from "prop-types";
import {Card, CardItem, Container, Content, Grid, Header, Icon, Input, Item, Row, Text, View} from "native-base";
import {geocode, search} from "../../lib/Geo";
import {StyleSheet, TouchableOpacity} from "react-native";
import _ from "lodash";
export class AddressSearch extends Component {
static propTypes = {
onSelect: PropTypes.func,
public class AlarmService extends HeadlessJsTaskService {
static long lastActive = 0;
@Override
protected @Nullable
HeadlessJsTaskConfig getTaskConfig(Intent intent) {
long current = System.currentTimeMillis();
if ((current - lastActive) >= 30 * 1000) {
lastActive = current;
return new HeadlessJsTaskConfig(
@andigu
andigu / Alarm.java
Last active February 26, 2023 18:01
public class Alarm extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
final Intent service = new Intent(context, AlarmService.class);
HeadlessJsTaskService.acquireWakeLockNow(context);
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
context.startService(service);
@andigu
andigu / 3DAnimation.js
Last active February 26, 2023 17:59
Advanced demo for panresponder
import React, {Component} from "react";
import {Animated, Dimensions, Easing, PanResponder, StyleSheet, View} from "react-native";
import {Card} from "./Card";
const {width: screenWidth, height: screenHeight} = Dimensions.get("window");
export class Sliding extends Component {
bottomPadding = 10;
data = new Array(20).fill({
name: "John Smith",