1. Summary
onLongPress property not working in Button component
App Name:
FrndlyTv App
Bug Severity
Select one that applies
- Impacts operation of app
3. Observed Behaviour
In the login screen, when performing a long press on the Clear button, the onLongPress callback does not trigger.
Instead, the onPress event fires immediately, resulting in only a single character being cleared.
Because onLongPress never fires, the intended functionality—clearing the entire text in the TextInput—is not working.
4. Expected Behavior
If the user presses and holds the button for more than 250 ms, the onLongPress event should trigger, allowing the app to clear all the entered text as expected.
6. Environment
Please fill out the fields related to your bug below:
- SDK Version: o0.20.3351
7. Example Code Snippet / Screenshots / Screengrabs
Include any relevant code or component setup in React Native that can help reproduce the bug.
import { Button } from '@amzn/kepler-ui-components';
{othrbtns.map((item, index) => (
<Button
key={index}
label={
item === 'x' || item === 'space' ? '' : item
}
iconSource={
item === 'x'
? backspaceIcon
: item === 'space'
? spaceIcon // <-- Use your custom space icon here
: undefined
}
iconSize={'sm'}
iconPosition="start"
style={[
styles.key,
styles.twocol_btn,
item === 'x' && { width: 235 },
(item === '!#$' || item === 'abc') && { width: 176 },
item === 'space' && { width: 400 }
]}
focusedStyle={[{
width: 126,
height: 72,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#00AD50',
margin: 4,
borderWidth: 0,
borderRadius: 0,
},
item === 'x' && { width: 235 },
(item === '!#$' || item === 'abc') && { width: 176 },
item === 'space' && { width: 400 }
]}
onPress={() =>
item === 'x'
? handleBackspace()
: item === '!#$' || item === 'abc'
? handleSpecialChar()
: item === 'space'
? onKeyPress(' ')
: onKeyPress(item)
}
onLongPress={()=>{console.log("triggering long Press");
}}
variant={'primary'}
/>
))}
const handleBackspace = () => {
if (emailArrowVisible) {
setEmailTextInputValue((prevValue: string) => prevValue.slice(0, -1));
} else {
setpassword(prevValue => prevValue.slice(0, -1));
}
setPswErrorBorderVisible(false);
setemailErrorBorderVisible(false);
};