Skip to content

Instantly share code, notes, and snippets.

View mortocks's full-sized avatar

Andrew Morton mortocks

View GitHub Profile
@mortocks
mortocks / useStatusBarStyle.js
Last active July 6, 2020 13:28
Sets the status bar style on navigation through hooks.#react-native
import { useCallback } from 'react';
import { StatusBar } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';
/**
* Sets the status bar style on navigation through hooks
* @param { String } style The status bar style light-content dark-content
*/
const useStatusBarStyle = style => {
useFocusEffect(
@mortocks
mortocks / useBackButtonEffect.js
Last active November 26, 2022 14:32
Override the back button action in React Navigations stack header. Useful if you want to pass parameters back to the previous screen #react-native #react-navigation
import { useLayoutEffect } from 'react';
import { HeaderBackButton } from '@react-navigation/stack';
/**
* Override the back button action in React Navigations stack header
* @param { Effect } The action to be triggered
*/
const useBackButtonEffect = effect => {
useLayoutEffect(() => {
<?php
/*
* uses tmhOauth from https://github.com/themattharris/tmhOAuth/
* and is mostly based on the oauth flow example from that library (thanks matt!)
*
* also need your own twitter api key / secret, and make sure it's got write access
* if you want to publish posts (extra step when making your api key on twitter)
*
*
*/