React Native fixed footer
Off the top of my head you could do this with a ScrollView. Your top-level container could be a flex container, inside that have a ScrollView at the top and your footer at the bottom. Then inside the ScrollView just put the rest of your app as normal.
How to make sticky footer with react native scrollview?
You should move out the MyStickyFooter component from your ScrollView.
You should have something like this:
<View style={....}>
<ScrollView>
... components
</ScrollView>
<MyStickyFooter/>
</View>
React Native ScrollView dynamic footer
here is my solution which i found
<ScrollView>
<View style={{ minHeight: height - buttonHeight - safeAreaView }}>
<Text>Content</Text>
</View>
<Button text="Next" />
</ScrollView>
React / Partially sticky footer
try checking if you are at the bottom of the page and conditionally hide and show your footer.
const App = () => {
const [isBottom, setIsBottom] = React.useState(false);
const handleScroll = () => {
const bottom = Math.ceil(window.innerHeight + window.scrollY) >= document.documentElement.scrollHeight
if (bottom) {
setIsBottom(true)
} else {
setIsBottom(false)
}
};
React.useEffect(() => {
window.addEventListener('scroll', handleScroll, {
passive: true
});
return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);
return (
<div>content.....</div>
<footer className={isBottom ? "showFooter" : "hideFooter"}>M</footer>
)
};
Related Topics
Create a Newline for Every X Number of Characters
Regexp to Match Every Occurence After N Occurences
How to Prevent Drag on a Child, But Allow Drag on the Parent
Generate a Weighted Random Number
How to Push Value Pair into Object Using Method
How to Call the Same Method for Different Elements With Different Ids
Get the Value of Datepicker on Change in Jquery
Error: Permission Denied to Access Property "Document"
If Check Box Checked Disable Other, If Unchecked Enable All in React
React How to Fix Failed Prop Type - Invalid Prop of Type String Expected Object
Replace Unicode Matches in JavaScript
To Check If a String Is Alphanumeric in JavaScript
How to Send One Alert from My Node.Js to My JavaScript Client
Html - Clicking a Button to Obtain Table Cell Value
Get Count of True Values in Json With JavaScript