react-native-camera-roll-picker icon indicating copy to clipboard operation
react-native-camera-roll-picker copied to clipboard

Image keep selected after reopen the screen

Open cnakh opened this issue 6 years ago • 4 comments

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.

cnakh avatar Mar 23 '18 10:03 cnakh

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 avatar Mar 29 '18 08:03 naoey

@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.

cnakh avatar Mar 29 '18 09:03 cnakh

@naoey thanks for your help. Anyway, I added selected={this.state.selected} it solved my issue.

cnakh avatar Mar 29 '18 10:03 cnakh

@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?

joshuapinter avatar Jul 15 '20 20:07 joshuapinter