taiki-t's diary

React Native, Rails そして雑多な記録: The world is waiting for you to give it a meaning.

Tips

一括ダウンロードがないページで無理やり全部ダウンロードするchrome console スニペット

プロローグ 一括ダウンロードしたいけど一括ダウンロードボタンがない時がある。 ログインが必要ない画面だったらwgetなりで引っ張ってくればいいんだけど、管理画面とかだとちょっとしたそういうのがめんどくさい。 chrome consoleからやればページさえ開け…

ターミナルでgit grep して一括置換するコマンド

$ git grep -l 'search word' | xargs sed -i '' -e 's/search word/replacing word/g' こんな感じ。 search word, replacing wordはそれぞれgrepする語、置換後の語を指定。 git grep -lで対象の語が含まれるファイル一覧を取得、 | xargsでそれを sedコマ…

React Native Tab View with default index to 1

When Using React Native Tav View with defalut index to 1, I happened to face a strange behaviour; automatically swipes to index 0 sometimes when opening the scene. So what I did was to set initialLayout and it fixed it. Like this: const in…

React NativeのImageを使うときの注意

React Native のImageを使うときの注意 とりあえずImage要素にサイズ(widthとheight)は指定する。じゃないと表示されない。 バージョン: 0.44.0 追記: 2017/07/07: 0.47.0以降のバージョンでこの制約は消えそう。Using <Image> with nested content now causes warn</image>…

React Native のTouchableなんとか使うときの注意

TouchableWithoutFeedbackとか使うとき、 とりあえず内部の要素はTextだろうがImageだろうがViewでラップしておくのが無難。 余計なハマりポイントを回避できる。 バージョン: 0.44.0

React NativeでiOSのランディングスクリーンに画像を設定する方法

という記事を書いた。 taiki-t.hatenablog.com だいたい図にした。constrainsの設定の時だけ、対象のオブジェクトからviewへcontrol + click してドラッグというのがわかりにくいかも。

React Native から S3に画像アップロード

という記事を雑にかいた。 taiki-t.hatenablog.com コードは参考になると良いと思う。

Presigned post to aws s3 from React Native

It took a longtime to figure out how to upload images to aws s3 using presigned post from React Native. The key part is to use FormData to construct a payload and post it with POST http method. PUTing FormData payload with pre-signed URL d…

Make commit messages great again.

github.com github.com github.com https://github.com/search?p=1&q=make+again&ref=searchresults&type=Commits&utf8=%E2%9C%93

Relay: containerのinitialVariablesに値を渡す

追記: 2017/08/31 これはRelay Classicの時に書いたものです。 Introduction 非同期処理で何かごにょごにょした後、Relayにその値を使ってサーバーにリクエストを投げてほしかった。 やり方 Relay.createContainerを関数でラップする 雑な実装例: componentD…

React Nativeの画像キャッシュ

追記 2017-11-27: 結局今はFastImageを使っている。GitHub - DylanVann/react-native-fast-image: FastImage, performant React Native image component. 最高。 プロローグ React Native使ってみた。Imageコンポーネント、毎回ネットワークから取得してる…

Show an image on launch screen in React Native iOS app

My long attempts to show an image on launch screen (or splash screen) in iOS app with React Native have failed so far and here is a solution I finally found. The key is to make use of LaunchScreen.xib and not to use bunch of launch screen …

React Native で文字を truncate

プロローグ Railsって色々ヘルパーが用意されていて便利。ActionView::Helpers::TextHelper#truncateもその一つ。これは、文字列を切り詰めて末尾に...と付けてくれる。そういうヘルパーみたいなのがRNにもあったら便利だな?と思った。そしたら、あった。 n…

S3のログから日付とアクセス元を漁るコマンドライン

プロローグ S3のログ、見たいと思ったんだよね。アクセス時間と、アクセス元を。 やったこと ターミナル開く aws-cliをいれて設定などする brew aws-cli, aws configure 詳しくは: http://docs.aws.amazon.com/ja_jp/streams/latest/dev/kinesis-tutorial-cl…

Twitterの検索結果からtweetのurl一覧を取得

$$('.time > a').map(v => v.href) ↑これをChrome の console に貼り付けてEnter consoleは、macだったら Shift + Command + C で開くと思う。 やってるのは、<time>要素内の<a>各要素からhrefを取得してる。マークアップに依存してるので、いつ使えなくなってもおか</a></time>…