この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 次のリビジョン | 前のリビジョン | ||
|
reactnative:react-native-swipeout [2019/02/10 16:55] ips 作成 |
reactnative:react-native-swipeout [2019/02/10 17:02] (現在) ips |
||
|---|---|---|---|
| ライン 3: | ライン 3: | ||
| [[https://www.npmjs.com/package/react-native-swipeout|react-native-swipeout]] | [[https://www.npmjs.com/package/react-native-swipeout|react-native-swipeout]] | ||
| - | deleteしたあとが更新されない。。。 | + | <code> |
| + | <FlatList | ||
| + | data={this.state.data} | ||
| + | execData={this.state.update} | ||
| + | renderItem={({item}) => | ||
| + | <Swipeout | ||
| + | autoClose={true} | ||
| + | sectionID={item.rowid} | ||
| + | rowID={item.rowid} | ||
| + | right={[{text:'DELETE',backgroundColor:'red', onPress:()=>this.swipeDelete(item.rowid)}]} | ||
| + | onOpen={(sectionID, rowId, direction)=>this.swipeOpen(sectionID, rowId, direction)}> | ||
| + | <View> | ||
| + | <Text style={{fontSize:20}}>{item.question}:{item.answer}</Text> | ||
| + | </View> | ||
| + | </Swipeout> | ||
| + | } | ||
| + | /> | ||
| + | </code> | ||
| + | {{:reactnative:pasted:20190210-165905.png}} | ||
| + | ====== deleteしたあと引き出したDELETEが残る ====== | ||
| + | <html>autoClose={true}</html>を追加したら解消した。 | ||
| + | |||
| + | 引き出しのアクションを複数つける | ||
| + | |||
| + | <code> | ||
| + | <Swipeout | ||
| + | sectionID={item.key} | ||
| + | rowID={item.name} | ||
| + | right={[ | ||
| + | { text:'done',backgroundColor:'blue' , onPress:()=>this.swipeDone() }, //ボタンは複数つけることができる | ||
| + | { text:'delete',backgroundColor:'red', onPress:()=>this.swipeDelete() } | ||
| + | ]} | ||
| + | onOpen={(sectionID, rowId, direction)=>this.swipeOpen(sectionID, rowId, direction)}> | ||
| + | <View> | ||
| + | <Text style={{fontSize:20}}>{item.name}</Text> | ||
| + | </View> | ||
| + | </Swipeout> | ||
| + | </code> | ||
| + | {{:reactnative:pasted:20190210-170208.png}} | ||