Skip to content

ScreenFooter - add zIndex to styles for proper stacking order#3995

Merged
M-i-k-e-l merged 4 commits into
masterfrom
fix/add-zindex-to-floatingbutton
May 6, 2026
Merged

ScreenFooter - add zIndex to styles for proper stacking order#3995
M-i-k-e-l merged 4 commits into
masterfrom
fix/add-zindex-to-floatingbutton

Conversation

@ZivSa1
Copy link
Copy Markdown
Collaborator

@ZivSa1 ZivSa1 commented May 5, 2026

Description

ScreenFooter's container had no zIndex, so any sibling rendered after it in the tree would intercept touches — button visible but not tappable. zIndex: 1 fixes it.

import React, {useState} from 'react';
import {ScrollView, StyleSheet} from 'react-native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {Colors, FloatingButton, Switch, Text, View} from 'react-native-ui-lib';

export default function PlaygroundScreen() {
  const [showSibling, setShowSibling] = useState(false);
  const [pressCount, setPressCount] = useState(0);

  return (
    <SafeAreaProvider>
      <View flex>
        <ScrollView contentContainerStyle={styles.scrollContent}>
          <View style={styles.eventHeader} bg-$backgroundNeutralMedium centerV centerH>
            <Text headingM>Summer Networking Event</Text>
            <Text bodyM $textNeutral>No cover image</Text>
          </View>

          <View padding-page>
            <Text headingM marginB-s4>Summer Networking Event</Text>

            <View marginB-s3>
              <Text bodyLBold>Thursday, June 19, 2025</Text>
              <Text bodyM $textNeutral>7:00 PM – 10:00 PM</Text>
            </View>

            <View marginB-s3>
              <Text bodyLBold>Wix Tel Aviv HQ</Text>
              <Text bodyM $textNeutral>40 Namal Tel Aviv St, Tel Aviv</Text>
            </View>

            <Text bodyM $textNeutral marginB-s5>142 going · 38 spots left</Text>

            <Text bodyLBold marginB-s2>About this event</Text>
            <Text bodyM $textNeutral marginB-s5>
              Join us for an evening of networking, demos, and great conversations with fellow developers and designers.
              Light refreshments will be served. Spots are limited!
            </Text>

            <View row centerV spread marginB-s3>
              <Text bodyM>Add elevated sibling</Text>
              <Switch value={showSibling} onValueChange={setShowSibling}/>
            </View>

            <Text bodyM>FloatingButton pressed: {pressCount}</Text>
          </View>
        </ScrollView>

        <FloatingButton
          visible
          withoutAnimation
          button={{label: 'RSVP', onPress: () => setPressCount(prev => prev + 1)}}
        />

        {showSibling && <View style={styles.sibling}/>}
      </View>
    </SafeAreaProvider>
  );
}

const styles = StyleSheet.create({
  scrollContent: {
    paddingBottom: 120
  },
  eventHeader: {
    height: 180,
    justifyContent: 'center',
    alignItems: 'center'
  },
  sibling: {
    position: 'absolute',
    bottom: 0,
    left: 0,
    right: 0,
    height: 100,
    zIndex: 10,
    backgroundColor: Colors.red70
  }
});

Changelog

ScreenFooter / FloatingButton - fix button not being tappable when a sibling View is rendered after it in the component tree.

Additional info

Slack thred

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

✅ PR Description Validation Passed

All required sections are properly filled out:

  • Description
  • Changelog
  • Additional info

Your PR is good for review! 🚀


This validation ensures all sections from the PR template are properly filled.

left: 0,
right: 0
right: 0,
zIndex: 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the user adds a zIndex to the component below?

@M-i-k-e-l M-i-k-e-l assigned ZivSa1 and unassigned M-i-k-e-l May 5, 2026
@ZivSa1 ZivSa1 assigned M-i-k-e-l and unassigned ZivSa1 May 5, 2026
hideDivider?: boolean;
/**
* Custom style for the outer container of the footer.
* Can be used to override zIndex or other container-level properties.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too specific

@M-i-k-e-l M-i-k-e-l assigned ZivSa1 and unassigned M-i-k-e-l May 6, 2026
@ZivSa1 ZivSa1 assigned M-i-k-e-l and unassigned ZivSa1 May 6, 2026
@M-i-k-e-l M-i-k-e-l merged commit 0b214d6 into master May 6, 2026
5 checks passed
@M-i-k-e-l M-i-k-e-l deleted the fix/add-zindex-to-floatingbutton branch May 6, 2026 09:46
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

Successfully merging this pull request may close these issues.

2 participants