react-native-camera-roll-picker
react-native-camera-roll-picker copied to clipboard
Image keep selected after reopen the screen
I checked the component, it very nice.
I opened the screen and select images, then go back. When reopen the screen again the selected marker still available on image.
I want to clear the selected from the previous opened. Here is my segment of codes.
<CameraRollPicker callback={this._getSelectedImages.bind(this)} removeClippedSubViews={true} assetType={'Photos'} backgroundColor={'#f6f8f9'} selectedMarker={ <View style={styles.selectedPicker}> <Image style={styles.pickerIcon} source={require('../assets/icons/ic-image-picker-checked.png')} /> </View> } maximum={10}/>
How can I clear it? Thanks for your help.
As a workaround, passing the selected
prop with an empty array seems to fix this. But I think this should be the normal behaviour without the prop because the docs state that the default value is []
. Ex.:
<CameraRollPicker
callback={this.onCameraRollSelection}
emptyText="No saved photos"
selected={[]}
/>
@naoey thanks for your reply.
I added selected={[]}
, it clear the previous selected image, but can only select single image at once and the picker icon not display.
I try to add selectSingleItem={false}
to make it can select multiple images, but it doesn't work.
@naoey thanks for your help. Anyway, I added selected={this.state.selected}
it solved my issue.
@naoey thanks for your help. Anyway, I added
selected={this.state.selected}
it solved my issue.
Where did you add this? And how is this.state.selected
being changed?