Skip to content

Instantly share code, notes, and snippets.

View watanabeyu's full-sized avatar
🥟
餃子

Yu Watanabe watanabeyu

🥟
餃子
View GitHub Profile
@watanabeyu
watanabeyu / App.js
Created August 13, 2019 07:07
performance check test react-native-store / expo-sqlite / expo-sqlite-orm
import React, { useEffect } from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import { SQLite } from 'expo-sqlite'
import { BaseModel, types } from 'expo-sqlite-orm';
import DatabaseLayer from 'expo-sqlite-orm/src/DatabaseLayer';
import Store from 'react-native-store';
const DB = {
'foo': Store.model('foo'),
'bar': Store.model('bar')
@watanabeyu
watanabeyu / config.yml
Last active February 26, 2019 06:32
expoの.circleciでブランチごとにOTA
version: 2
references:
container_config: &container_config
docker:
- image: circleci/node:latest
install_expo_cli: &install_expo_cli
run:
name: install-expo-cli
command: sudo npm install -g expo-cli
import { GLView } from 'expo';
import Expo2DContext from 'expo-2d-context';
import React from 'react';
import { View, Button } from 'react-native';
export default class App extends React.Component {
render() {
return [
<GLView
ref={ref => {
this.gl = ref;
@watanabeyu
watanabeyu / config.yml
Created November 22, 2018 09:19
if submitted pr, comment expo qr.
version: 2
references:
container_config: &container_config
docker:
- image: circleci/node:latest
environment:
EXPO_ACCOUNT: "expo_account_name"
EXPO_PASSWORD: "expo_account_password"
APP_SLUG: "expo_app_slug"
#!/bin/bash
max=3000000
maxWidth=2000
maxHeight=1000
for file in `\find ./docs -maxdepth 2 -name '*.png'`; do
hoge=$(identify -format "%w %h" $file)
IFS=' '
import uuid from 'uuid';
import * as firebase from 'firebase';
import 'firebase/firestore';
firebase.initializeApp(config);
firebase.firestore().settings({ timestampsInSnapshots: true });
const uploadFileAsync = async (uri) => {
const ext = uri.split('.').slice(-1)[0];
const path = `file/${this.uid}/${uuid.v4()}.${ext}`;
import * as React from 'react';
import { Text, View, StyleSheet,TouchableOpacity,CameraRoll,Linking } from 'react-native';
import { Constants,FileSystem,Permissions } from 'expo';
export default class App extends React.Component {
onPress = async () => {
const filePath = `${FileSystem.documentDirectory}share-movie.mp4`;
const res = await FileSystem.downloadAsync('http://techslides.com/demos/sample-videos/small.mp4', filePath);
// const i = await FileSystem.getInfoAsync(res.uri);
// console.log(i);
import React from 'react';
import { BottomTabBar } from 'react-navigation-tabs';
const TabBar = (props) => {
const { navigation = {} } = props;
const { state = {} } = navigation;
let newProps = props;
if (state.index === 0) {
newProps = Object.assign(
@watanabeyu
watanabeyu / progress-fetch.js
Last active October 3, 2018 09:54
progress fetch
const progressFetch = (url, options = {}, onProgress = {}) => new Promise((res, rej) => {
const xhr = new XMLHttpRequest();
xhr.open(options.method || 'post', url);
Object.keys(options.headers || {}).forEach((k) => {
xhr.setRequestHeader(k, options.headers[k]);
});
xhr.onload = e => res(e.target.responseText);
xhr.onerror = rej;
import React from 'react';
import { TextInput as Input } from 'react-native';
export default class TextInput extends React.Component {
static defaultProps = {
onFocus: () => { },
}
constructor(props) {
super(props);