Skip to content

Instantly share code, notes, and snippets.

View valdio's full-sized avatar
🎸
Code on!!

Valdio Veliu valdio

🎸
Code on!!
View GitHub Profile
@valdio
valdio / AnimatedHook.js
Last active September 16, 2020 17:27
Custom react hooks for Animated api. The following code serves only as an example of this approach. Change for your needs. **By default the animation will run on first render of the component and on every `resetAnimation` call.**
// ------------------------------------------------------------------------------------------
// Usage of the custom hook
// ------------------------------------------------------------------------------------------
import React from 'react'
import { Animated, View, TouchableOpacity, Text } from 'react-native'
import { useAnimation } from '/hooks'
function AwesomeComponent({ }) {
@valdio
valdio / StreamPackage.java
Last active September 4, 2021 14:56
React Native Bridge with Kotlin
package com.reactnative_kotlin_bridge.KotlinVideoStreaming
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import java.util.*
class StreamPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
@valdio
valdio / StreamManager.java
Last active January 21, 2018 19:04
React Native Bridge with Kotlin
package com.reactnative_kotlin_bridge.KotlinVideoStreaming
import android.content.Intent
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
class StreamManager(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
@valdio
valdio / VideoStreamingActivity.java
Last active January 21, 2018 19:04
React Native Bridge with Kotlin
package com.reactnative_kotlin_bridge.KotlinVideoStreaming
import android.media.MediaPlayer
import android.net.Uri
import android.os.Build
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.MediaController
import com.reactnative_kotlin_bridge.R
@valdio
valdio / activity_video_streaming.xml
Created January 21, 2018 12:27
React Native Bridge with Kotlin
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.reactnative_kotlin_bridge.KotlinVideoStreaming.VideoStreamingActivity">
<FrameLayout
@valdio
valdio / ApiEndpointInterface.java
Created October 6, 2016 21:35
Retrofit Multiple Query Parameter with custom QueryMap .... Example: ?tag[5]=12&tag[20]=3&tag[11]=5
public interface ApiEndpointInterface {
//Example of the implementation
@FormUrlEncoded
@POST("{token}/pay/cash?sandbox=1")
Call<ResponseBody> orderProducts(@Path("token") String token,
@QueryMap Map<String, String> map,
@Field("address") String addressId);
}