Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image keep selected after reopen the screen #76

Open
cnakh opened this issue Mar 23, 2018 · 4 comments
Open

Image keep selected after reopen the screen #76

cnakh opened this issue Mar 23, 2018 · 4 comments

Comments

@cnakh
Copy link

cnakh commented Mar 23, 2018

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.

@naoey
Copy link

naoey commented Mar 29, 2018

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={[]}
/>

@cnakh
Copy link
Author

cnakh commented Mar 29, 2018

@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
Copy link
Author

cnakh commented Mar 29, 2018

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

@joshuapinter
Copy link

joshuapinter commented Jul 15, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants