Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

React Native Align button on top of keyboard for all devices

$
0
0

So I need to align a button Which is not at bottom om screen by design should be at middle of screen but it should align to be on top of the keyboard for all devices.

If you check this screenshot :

enter image description here

for Some devices I mange to do it, but in some others is not really aligned :

enter image description here

how can I manage this to work in all?

this is what I did so far :

<Padding paddingVertical={isKeyboardOpen ? Spacing.unit : Spacing.small}><Button      variant="solid"      label='Next'      style={styles.submitBtn}    /></Padding>

And isKeyboardOpen is just a method which will create a listner based on the platform return true if keyboard is open :

 Keyboard.addListener(  Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow',  true  );

And submitBrn css class is :

submitBtn: {  margin: Spacing.base,},

Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>