Install Flatpickr with:
npm install --prefix assets flatpickrImport the Flatpickr CSS in your app.css file:
| import {useEffect} from 'react'; | |
| import {Text} from 'react-native'; | |
| import {useNetworkState} from 'expo-network'; | |
| import useIsInternetReachable from './useIsInternetReachable'; | |
| import { usePrevious } from "@uidotdev/usehooks"; | |
| export default function OnlineBadge() { | |
| const [isOnline, {check}] = useIsInternetReachable(); | |
| // Optional |
| // disable forced dark mode to prevent weird color changes | |
| // eslint-disable-next-line @typescript-eslint/no-var-requires | |
| const { createRunOncePlugin, withAndroidStyles, AndroidConfig } = require('expo/config-plugins') | |
| function setForceDarkModeToFalse(styles) { | |
| const newStyles = AndroidConfig.Styles.assignStylesValue(styles, { | |
| add: true, | |
| // ############# FOLLOW IF YOU'RE ON SDK 52 ############# | |
| // TODO: AndroidConfig.Styles.getAppThemeGroup() will be available in SDK 52 (or expo/config-plugins 9+), for now I just hardcoded AppTheme | |
| // parent: AndroidConfig.Styles.getAppThemeGroup(), |
| /* | |
| * This work is free. You can redistribute it and/or modify it under the | |
| * terms of the Do What The Fuck You Want To Public License, Version 2, | |
| * as published by Sam Hocevar. See the COPYING file for more details. | |
| */ | |
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { |
These snippets provide a foundation for starting and stopping supervision trees at runtime using feature flags (e.g. Launch Darkly).
Some things to note when adapting these snippets:
ld_key) specified.FeatureFlags module to be available that implements is_on?/2. Adjust as needed to accomodate your own feature flag setup.| CREATE SEQUENCE public.global_id_seq; | |
| ALTER SEQUENCE public.global_id_seq OWNER TO postgres; | |
| CREATE OR REPLACE FUNCTION public.id_generator() | |
| RETURNS bigint | |
| LANGUAGE 'plpgsql' | |
| AS $BODY$ | |
| DECLARE | |
| our_epoch bigint := 1314220021721; | |
| seq_id bigint; |
| import 'package:flutter/services.dart'; | |
| import 'package:intl/intl.dart'; | |
| class CurrencyPtBrInputFormatter extends TextInputFormatter { | |
| TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { | |
| if(newValue.selection.baseOffset == 0){ | |
| return newValue; | |
| } |
| def DjangoModel(models.Model): | |
| @classmethod | |
| def from_db(cls, db, field_names, values): | |
| instance = super().from_db(db, field_names, values) | |
| instance._state.adding = False | |
| instance._state.db = db | |
| instance._old_values = dict(zip(field_names, values)) | |
| return instance |
| import React from 'react' | |
| import axios, { post } from 'axios'; | |
| class SimpleReactFileUpload extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state ={ | |
| file:null | |
| } |