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

buttonDeleteComponent not deleting the pincode #174

Open
pepemiso16 opened this issue Mar 8, 2021 · 3 comments
Open

buttonDeleteComponent not deleting the pincode #174

pepemiso16 opened this issue Mar 8, 2021 · 3 comments

Comments

@pepemiso16
Copy link

pepemiso16 commented Mar 8, 2021

I have set up the props buttonDeleteComponent, however, it seems that there's no definition or documentation of how we can be able to delete the pin code every time we click the new component for the delete icon.

buttonDeleteComponent={() => {
          return (
            <TouchableHighlight>
              <View>
                <Icon
                  name={'backspace'}
                />
                <Text>Test Delete</Text>
              </View>
            </TouchableHighlight>
          )
}}
@jeremy-farnault
Copy link
Contributor

jeremy-farnault commented Mar 14, 2021

Hey,

Yes it's missing sorry.
Atm it's doing this:

this.props.buttonDeleteComponent(() => {
  if (this.state.password.length > 0) {
    const newPass = this.state.password.slice(0, -1);
    this.setState({ password: newPass });
    if (this.props.getCurrentLength)
      this.props.getCurrentLength(newPass.length);
    }
})
                

@joaocosta9
Copy link

joaocosta9 commented Apr 9, 2021

@Haskkor sorry, im having this same problem, but I didn't understand what we need to do with that code you put there. Can you explain please?

@joaocosta9
Copy link

joaocosta9 commented Apr 12, 2021

Ok I already figured it out, for anyone wondering you just need to pass a variable to your component that will result in the function @Haskkor mentioned, and then call it in your button.
Something like this

buttonDeleteComponent={(eraseCharacter) => ( <TouchableOpacity onPress={() => eraseCharacter()}> <DeleteIcon /> <Text style={{color: globals.colors.ghost}}>Delete</Text> </TouchableOpacity> )}

I named it eraseCharacter, but you can name it whatever you want

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