Skip to content

React Native Flickering Issue When position : absolute in iOS only #49057

Closed as not planned
@cd-ssrivastava

Description

@cd-ssrivastava

Description

On Play floating button 2 buttons in row on click, only bottom UI flickers,
I noticed this happens only when position:absolute and bottom:0 .
flickers dont happens if position:absolute and top: deviceHeight // from Dimensions , but using this on some Android Phone the Bottom UI goes beyond screen view,
Android works, only issue with iOS

<View>
<Dialog1 visible=false>
<Dialog2 visible=false>

<View>
 <FlatList> // removed this , still same issue
</View

   <View style={{
                        position: 'absolute',
                        //  bottom: 0,
                        width: '100%',
                        zIndex: 10,
                        height: 150,
                        alignItems: 'flex-end',
                        top: Platform.OS == 'android' ? '80%' : '80%',
                    }}>

                        <TouchableRipple style={styles.floatingButton} onPress={() => startScanning()}>
                            {isScanning ? <Image
                                    source={require("../../../assets/icons/ic_stop_scan.png")}
                                    resizeMode={'contain'}
                                    style={{
                                        height: 80,
                                        alignSelf: 'center',
                                        marginBottom: 0
                                    }}/> :
                                <Image
                                    source={require("../../../assets/icons/ic_start_scan.png")}
                                    resizeMode={'contain'}
                                    style={{
                                        height: 80,
                                        alignSelf: 'center',
                                        marginBottom: 0
                                    }}/>}
                        </TouchableRipple>
                        <View style={{
                            position: 'absolute',
                            width: '100%',
                            bottom: 0,
                        }}>

                            <View style={styles.bottomButtonContainer}>
                                <AppButton text={"Exit & go back"} type={ButtonType.outlined} style={{
                                    flex: 1,
                                    marginHorizontal: 8
                                }} onClick={() => {
                                    navigation.goBack();
                                }}/>
                                <AppButton text={"Ship"}
                                           style={{
                                               flex: 1,
                                               marginHorizontal: 8
                                           }}
                                           onClick={() => {
                                               updateNewOrder();
                                           }}/>
                            </View>
                        </View>


                    </View>

</View>


const styles = StyleSheet.create({
   bottomButtonContainer: {
        flexDirection: 'row',
        width: '100%',
        zIndex: 10,
        //  top: Platform.OS == 'android' ? (deviceHeight * 0.80) : (deviceHeight * 0.80),
        bottom: 0,
        left: 0,
        right: 0,
        paddingBottom: 8,
        paddingTop: 8,
        alignItems: 'flex-end',
        justifyContent: 'space-evenly',
    },

   floatingButton: {
        position: 'absolute',
        // top: Platform.OS == 'android' ? (deviceHeight * 0.70) : (deviceHeight * 0.70),
        // bottom: 80,

        backgroundColor: 'blue',
        width: 60,
        height: 60,
        borderRadius: 30,
        alignSelf: 'center',
        justifyContent: 'center',
        alignItems: 'center',
        elevation: 5, // For Android shadow
        shadowColor: '#000', // For iOS shadow
        shadowOffset: {width: 0, height: 2},
        shadowOpacity: 0.8,
        shadowRadius: 2,
        zIndex: 10,

    },
});

Steps to reproduce

  1. Set View at bottom of page, which container 2 button in row and Floating button at center , as per video,
  2. On Floating button click state Changes causing flickering
  3. I noticed this happens only when position:absolute and bottom:0 .
  4. flickers dont happens if position:absolute and top: deviceHeight // from Dimensions , but using this on some Android Phone the Bottom UI goes beyond screen view,

React Native Version

0.76.5

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M2 Pro
  Memory: 92.78 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.13.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 34.0.0
      - 35.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.5
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: 15.1.3
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No Log errors

Reproducer

Private repo

Screenshots and Videos

20250130_135859.mp4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions