getItemLayout
プロパティをSectionListに定義するために、jsoendermann/rn-section-list-get-item-layout npmパッケージを使用しています。 scrollToLocation()
を動作させるには、getItemLayout
プロパティを定義する必要があります。外部ライブラリに送信されたParamsは宣言されていますが使用されていません
ドキュメントは、それは次のように使用すべきであると述べている:
import sectionListGetItemLayout from 'react-native-section-list-get-item-layout'
// cut..
this.getItemLayout = sectionListGetItemLayout({
// The height of the row with rowData at the given sectionIndex and rowIndex
getItemHeight: (rowData, sectionIndex, rowIndex) =>
sectionIndex === 0 ? 100 : 50,
}
render() {
return (
<SectionList
{...otherStuff}
getItemLayout={this.getItemLayout}
/>
)
}
}
活字体(2.5.3)コンパイラは、この行文句:
getItemHeight:(rowData、sectionIndex、rowIndexに)= > sectionIndex === 0? 100:50、
error TS6133: 'rowData' is declared but never used. error TS6133: 'rowIndex' is declared but never used.
私はrowData
とrowIndex
の両方を推測するには、NPMパッケージに内部的に使用されているが、どのように私はTSコンパイラにそれを教えていますか?