react-native-progress-steps icon indicating copy to clipboard operation
react-native-progress-steps copied to clipboard

Is there a way to hide the button row behind the keyboard? Or in the end of the scroll.

Open guilhermemoretto12 opened this issue 4 years ago • 2 comments

I would like that the previous and next buttons to stay behind the keyboard, instead of above it. Thats because the next button can confuse the user while he's filling a form whit many TextFields, and it also takes some space.

Is there a way to make the button row to behave like content of the steps, only showing in the end of the scroll?

guilhermemoretto12 avatar Jan 19 '21 18:01 guilhermemoretto12

I was able to accomplish this behavior by adding an event listener to the core Keyboard component to toggle the ProgressStep prop removeBtnRow. https://github.com/colbymillerdev/react-native-progress-steps#progress-step-component

Something like:

       function SomeComponent() {
          const [buttonsVisible, setButtonsVisible] = useState(false)
          useEffect(() => {
              const showSubscription = Keyboard.addListener("keyboardDidShow", () => {
                setButtonsVisible(true);
              })
              const hideSubscription = Keyboard.addListener("keyboardDidHide", () => {
                setButtonsVisible(false)
              })
          
              return () => {
                showSubscription.remove();
                hideSubscription.remove();
              }
      }, [])
            
              return (
                    <ProgressStep removeBtnRow={buttonsVisible}></ProgressStep>
              )
      } 

Hope this helps!

neilbateman avatar May 28 '21 20:05 neilbateman

Thanks @neilbateman, This worked for me

Ketan2010 avatar Jun 28 '21 13:06 Ketan2010