3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

line-bot-sdk-nodejsのFlex Massageがアップデートされてた

Posted at

はじめに

久しぶりにline-bot-sdk-nodejsのレポジトリをみたらFlex message update 3 #329というプルリクがマージされていてFlex Massageコンポーネント用の型にいくつかアップデートがあった。3ヶ月くらい前ののものだけど少し見ていこうと思います。

Videoコンポーネントが追加された

Videoコンポーネントが新たに追加されました。Videoコンポーネントを使うことでFlex Messageのヒーローブロックに動画を表示することができます。

ソースをみるかぎりaltContentを含むすべてのプロパティが網羅されています。

BoxコンポーネントにmaxWidth maxHeightが追加された

BoxコンポーネントmaxWidth, maxHeightが追加されました。コメントではWe can specifiy maxHeight and maxHeight in box component.と書いてあってmaxHeightがかぶってますが正しくはmaxWidth and maxHeightですね。

maxWidth, maxHeightともにstringflexBox.maxWidth ='120px'のように指定します。

TextコンポーネントにlineSpacingが追加された

TextコンポーネントlineSpacingが追加されました。テキストの行間を広げるやつです。flexTextBase.lineSpacing = '20px'のように指定します。

おわりに

地味なアップデートの紹介でしたが個人的にはFlex Massageの型付けが厳密になるのはとても歓迎です。Bot開発の中でもFlex Messageのレイアウトが複雑になってくるとデバッグが難しくなってくるからです。何がどう入れ子になってるとか。

Flex Massageのレイアウトにあたってはできるだけ細かいハマりどころがなくなればストレスが減るのでこのあたりは積極的にアップデートされていくとありがたいですね。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?