/20180811 ペアプロ @saitox さん Secret
Created
September 11, 2018 00:45
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
前回: https://gist.github.com/ggtmtmgg/98913a902811a0ceb8ae1263fd4f0f66 | |
# 20180811 ペアプロ @saitox さん | |
振り返り | |
・ScrollViewのscrollContentHeightの高さが間違ってる | |
・RCTViewクラスがビューの高さを計算してそう | |
・再現されない: v0.55 Android(Expo), v0.55 iOS(Expo) | |
・再現される: v0.56 Android, v0.56 iOS, v0.57 iOS | |
↓ | |
次のアプローチを整理する | |
・ScrollViewのscrollContentHeightの高さが決まる瞬間を突き止める | |
・RCTViewクラスがビューの高さを計算を突き止める | |
↓ | |
ScrollViewのscrollContentHeightの高さが決まる瞬間を突き止める | |
e.nativeEvent.layoutからheightを取る | |
e.nativeEvent.layoutの実装にあたる部分を読む | |
typeを視たがとくにコメントアウトとかはない | |
“The + symbol in front of the property means the property is read-only” | |
↓ | |
YGNodeCalculateLayoutでyogaを呼んでいる | |
rctshadowview.mでYGNodeCalculateLayoutを呼んでいる | |
xcode上で上記メソッドを呼んでいる部分にbreakpointを張ってみたが、大量に呼ばれるのでdebugが難しかった | |
// 引数が3つの場合のObjective−Cの関数宣言 | |
- (戻り値の型)メソッド名:(引数の型)引数1 ラベル:(引数の型)引数2 ラベル:(引数の型)引数3 | |
Yoga.cpp上の以下↓をtrueにするとレイアウトのデバッグ情報がxcodeに出力される | |
bool gPrintTree = false; | |
bool gPrintChanges = false; | |
Viewでも複数の子view(marginTop: 1%を持つ)を持つ場合、高さがバグるのでは?→onLayout時点では正しい高さが計算されていた | |
↓ | |
ScrollViewに同じような小要素をもたせてみる | |
→ 再現した | |
render() { | |
let items = [{key:'0'},{key:'1'},{key:'2'},{key:'3'},{key:'4'},{key:'5'},{key:'6'},{key:'7'},{key:'8'},{key:'9'}]; | |
return ( | |
<View> | |
<ScrollView style={{height: 100}}> | |
{ | |
items.map((item, index) => ( | |
<View style={{marginTop: '1%'}}> | |
<View><Text>{index}. Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.</Text></View> | |
</View> | |
)) | |
} | |
</ScrollView> | |
</View> | |
); | |
} | |
↓ | |
FlatListの問題ではない。ScrollViewがContentHeightを取るタイミングで雇用そのheightが取れてなさそう問題によりフォーカスする。 | |
↓ | |
RCTScrollContentShadowViewの実装 | |
↓ | |
各々成田くんの記事で勉強する | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment