Skip to content

Instantly share code, notes, and snippets.

View efstathiosntonas's full-sized avatar

Efstathios Ntonas efstathiosntonas

View GitHub Profile
@efstathiosntonas
efstathiosntonas / AudioManager.ts
Created May 17, 2024 07:40
Audio Player Chat Message with react-native-awesome-slider & react-native-audio-player-recorder
import AudioRecorderPlayer, { PlayBackType } from "react-native-audio-recorder-player";
import { isIOS } from "utils/utils";
type Callback = (args: { data?: PlayBackType; status: AudioStatus }) => void;
type Path = string | undefined;
export enum AudioStatus {
PAUSED = "PAUSED",
PLAYING = "PLAYING",
RESUMED = "RESUMED",
@efstathiosntonas
efstathiosntonas / AnimatedSection.tsx
Last active February 16, 2024 17:19
react-native CollapsibleView with reanimated@3
import React, { memo, ReactNode } from "react";
import { LayoutChangeEvent, StyleProp, StyleSheet, ViewStyle } from "react-native";
import Animated from "react-native-reanimated";
import isEqual from "react-fast-compare";
import type { State } from "./types";
type Props = {
animatedHeight: any;
children: ReactNode;
@efstathiosntonas
efstathiosntonas / getLocation.ts
Created June 7, 2023 07:29
ExpoGetLocationWithRetry.ts
const locationOptions: LocationOptions = {
accuracy: LocationAccuracy.Balanced,
distanceInterval: 250
};
const lastKnownLocationOptions: LocationLastKnownOptions = {
maxAge: 60000,
requiredAccuracy: 1000
};
@efstathiosntonas
efstathiosntonas / BubbleArrow.tsx
Created February 1, 2023 15:57
BubbleArrow for react native
import React, { memo, useMemo } from "react";
import { Platform, StyleSheet, View } from "react-native";
import Svg, { Path } from "react-native-svg";
import { moderateScale } from "react-native-size-matters";
import { useStyle } from "react-native-style-utilities";
import useThemeContext from "@themes/themeContext";
import { Chat_Message } from "@generated/graphql";
import { currentUser } from "@functions/auth";
@efstathiosntonas
efstathiosntonas / App.tsx
Last active December 19, 2022 19:57
React Native card swiper like iOS iMessage multiple images swiper
import React, {FC} from 'react';
import {Dimensions, StyleSheet, View} from 'react-native';
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
} from 'react-native-gesture-handler';
import Animated, {
Easing,
interpolate,
@efstathiosntonas
efstathiosntonas / react_native_pods.rb
Created April 7, 2021 12:52
patched react_native_pods.rb, fixes directory not found in rn 0.64.0 ios builds
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
def use_react_native! (options={})
# The prefix to react-native
prefix = options[:path] ||= "../node_modules/react-native"
# Include Fabric dependencies
@efstathiosntonas
efstathiosntonas / focus.js
Created February 5, 2021 08:16
Force TextInput to focus when using react-navigation
const [isFocused, setIsFocued] = React.useState(true)
const setFocus = React.useCallback(() => {
setIsFocued(true)
}, [])
const setBlur = React.useCallback(() => {
setIsFocued(false)
}, [])
@efstathiosntonas
efstathiosntonas / gist:ce4d8cea1936a65c99ef49bf75717c08
Created October 6, 2020 03:52
System and custom message react native gifted chat
import {
GiftedChat,
SystemMessage,
// ...all other imports
} from "react-native-gifted-chat
<GiftedChat
// ...all other stuff
@efstathiosntonas
efstathiosntonas / ReactNativeOneSignalNotificationsHandlerAsyncStorage.js
Last active September 19, 2019 10:09
OneSignal React Native Notifications Handler and AsyncStorage
import AsyncStorage from '@react-native-community/async-storage';
import {Navigation} from 'react-native-navigation';
import {uniqBy} from 'lodash';
// using uuid/v4 to generate unique keys for each notification for FlatList etc.
import uuidv4 from 'uuid/v4';
// AsyncStorage.clear();
export const handleNotifications = async (notification, condition, ref) => {
console.log('COMING FROM ', ref);
@efstathiosntonas
efstathiosntonas / greek_capital_cities_coordinates.json
Created September 4, 2019 14:05
Greek Capital Cities Coordinates JSON
[
{"name": "Αττικής", "location": [38.08333 ,23.5]},
{"name": "'Αγιος Νικόλαος Αθηνών'", "location": [38.005852, 23.729193]},
{"name": "Άγιος Ελευθέριος", "location": [38.021036, 23.729219]},
{"name": "Αθήνα κέντρο", "location": [37.980812, 23.724287]},
{"name": "Αμπελόκηποι", "location": [37.988734, 23.763039]},
{"name": "Αττική Αθηνών", "location": [37.997651, 23.721319]},
{"name": "Γκάζι", "location": [37.978538, 23.712526]},
{"name": "Γουδί", "location": [37.985828, 23.767172]},
{"name": "Ελαιώνας", "location": [38.007859, 23.667688]},