What could be causing the discrepancy in alignment between a web application running on Mac and Windows using ReactNative?

We have a web application built with react native. The alignment of the columns in the list is causing issues when running the app on Windows versus Mac, as illustrated in the screenshots. Interestingly, this problem only occurs with this specific list that was developed on Mac, while other lists created on Windows do not exhibit the same behavior.

https://i.sstatic.net/9JFKO.png alignment on windows

https://i.sstatic.net/kO7fM.png alignment on mac

FlatList:

<FlatList
                  data={pageList}
                  keyExtractor={(item, index) => 'ti_' + index}
                  renderItem={({item}) => <CompilerListItem data={item} isSelected={selectItems.includes(item.branchName)} _onSelectChanges={onSelectChanges} />}
                />

CompilerListItem:

<View style={styles.container}>
      <DataTable.Cell
        style={styles.checkBox}
        onPress={() => {
          setIsSelected(!isSelected)
        }}>
        <Checkbox status={isSelected ? 'checked' : 'unchecked'} />
      </DataTable.Cell>
      <FlatList //
        data={props.data.vwCompilerList}
        style={styles.arrayItem}
        keyExtractor={(item, index) => index.toString()}
        renderItem={({item}) => <CompilerListItemIssue data={item} />}
      />
</View>

CompilerListItemIssue:

<>
      <DataTable.Cell key={props.data.issueId} onPress={() => handleItemPress(props.data.issueId, false)} onLongPress={() => handleItemPress(props.data.issueId, true)}>
        <View style={styles.cellContainer}>
          <IssueCode style={[styles.issueCellItem, styles.issueCode]} issueCode={props.data.issueCode} priority={undefined} fontSize={17} />
          <View style={[styles.issueCellItem, styles.f2]}>
            <TableTitle numberOfLines={1}>{props.data.issueSummary}</TableTitle>
          </View>
          <View style={[styles.issueCellItem, styles.imageArea]}>
            <ProfileAvatarItem size={36} uri={props.data._assigneeUserImage} />
          </View>
          <View style={[styles.issueCellItem, styles.statusResult]}>
            <Table2ndText>{props.data.issueStatusStr}</Table2ndText>
          </View>
          <View style={[styles.issueCellItem, styles.testBoxesField]}>
            <View style={styles.testedApproveBox}>
              <Table2ndText style={{color: theme.colors.background}}>{props.data.testOnay ?? '?'}</Table2ndText>
            </View>

            <View style={styles.testedRejectedBox}>
              <Table2ndText style={{color: theme.colors.background}}>{props.data.testRed ?? '?'}</Table2ndText>
            </View>
          </View>
        </View>
      </DataTable.Cell>
      <Snackbar duration={3000} visible={snackVisible} onDismiss={() => setSnackVisible(false)} style={styles.snackbar}>
        {snackText}
      </Snackbar>
    </>

CompilerListItemIssue Styles:

issueCode: {
      minWidth: 110,
    },
    f2: {
      flex: 2,
    },
    cellContainer: {
      flex: 1,
      flexDirection: 'row',
      alignItems: 'center',
      paddingVertical: 5,
    },
    issueCellItem: {
      marginEnd: 10,
    },
    statusResult: {
      minWidth: 200,
    },
    checkBox: {
      justifyContent: 'center',
      maxWidth: 40,
      marginEnd: 10,
    },
    testBoxesField: {
      flexDirection: 'row',
      minWidth: 75,
    },
    testedApproveBox: {
      backgroundColor: theme.colors.valid,
      borderRadius: 5,
      height: 25,
      width: 25,
      alignItems: 'center',
      justifyContent: 'center',
      marginHorizontal: 3,
    },
    testedRejectedBox: {
      backgroundColor: theme.colors.error,
      borderRadius: 5,
      height: 25,
      width: 25,
      alignItems: 'center',
      justifyContent: 'center',
      marginHorizontal: 3,
    },
    imageArea: {
      flexDirection: 'row',
      alignItems: 'center',
      justifyContent: 'center',
      minWidth: 60,
      marginHorizontal: 10,
    },
    snackbar: {
      backgroundColor: theme.colors.error,
      alignSelf: 'center',
    },

Answer №1

I revamped the CompilerListItemIssue by ensuring the onPress functionality on the cell remains intact. I integrated

TouchableOpacity from 'react-native'
therefore, kindly include it at the top of the file.

CompilerListItemIssue:

    <>
      <TouchableOpacity style={styles.cellContainer} key={props.data.issueId} onPress={() => handleItemPress(props.data.issueId, false)} onLongPress={() => handleItemPress(props.data.issueId, true)}>
        <IssueCode style={[styles.issueCellItem, styles.issueCode]} issueCode={props.data.issueCode} priority={undefined} fontSize={17} />
        <View style={[styles.issueCellItem, styles.f2]}>
          <TableTitle numberOfLines={1}>{props.data.issueSummary}</TableTitle>
        </View>
        <View style={[styles.issueCellItem, styles.imageArea]}>
          <ProfileAvatarItem size={36} uri={props.data._assigneeUserImage} />
        </View>
        <View style={[styles.issueCellItem, styles.statusResult]}>
          <Table2ndText>{props.data.issueStatusStr}</Table2ndText>
        </View>
        <View style={[styles.issueCellItem, styles.testBoxesField]}>
          <View style={styles.testedApproveBox}>
            <Table2ndText style={{color: theme.colors.background}}>{props.data.testOnay ?? '?'}</Table2ndText>
          </View>

          <View style={styles.testedRejectedBox}>
            <Table2ndText style={{color: theme.colors.background}}>{props.data.testRed ?? '?'}</Table2ndText>
          </View>
        </View>
      </TouchableOpacity>

      <Snackbar duration={3000} visible={snackVisible} onDismiss={() => setSnackVisible(false)} style={styles.snackbar}>
        {snackText}
      </Snackbar>
    </>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to transfer the userId from the browser to protractor?

Using *ngFor in my angular2 component to render users has been successful. <ul> <li *ng-for="let user of users"> <input [(ng-model)]="user.name"> <button (click)="remove(user._id)">Remove</button> ...

What is preventing me from using the "@" symbol to substitute the lengthy relative path in my __tests__ directory?

https://i.sstatic.net/U1uW3.png When I initialized my Vue project using vue-cli, I encountered an issue where the use of @ in my src folder was functioning correctly, but not in my __tests__ folder. I have already added configurations to my tsconfig.json ...

Setting up React Context API with TypeScript: A Step-by-Step Guide

I recently updated my app.js file to app.tsx for improved functionality. However, I encountered an error with the current value. app.tsx import React, { createContext, useState } from "react"; import SelectPage from "./pages/select/select& ...

The package.json entry for "abc-domains" is not functioning correctly even though it is set to "latest" version

Unique Scenario Imagine there's a package called xyz-modules that I've developed. The package.json file in my project looks like this: ... "devDependencies": { "@company/xyz-modules": "latest", ... } ... After ...

Implementing Autocomplete feature in Reactjs with Ant Design Library

In my React application, I created an autocomplete feature with a list of options for the user to select from. Example in Action: Click here to see the demo List of available options: const options = [ { label: "hello", value: "1" ...

Is there a way to selectively transfer attributes and behaviors from an interface to a fresh object in typescript?

Is there a way in javascript to selectively copy properties from one object to another? I am familiar with using Object.assign() for this purpose. Specifically, I am looking to extract only the properties defined within the following interface: export in ...

Avoid invoking a TypeScript class like a regular function - _classCallCheck prevention

I am currently developing a TypeScript library that needs to be compatible with all versions of JavaScript. I have noticed that when calling a class in TS without using new, it does not compile properly, which is expected. In ES6/Babel, a class automatica ...

DotLottie file loading issues

While using dotlottie/react-player, webpack 4, and react 16, I encountered module parse failed errors during compilation. "@dotlottie/react-player": "^1.6.5" "webpack": "^4.44.2", "react": "16.14.0&qu ...

Issues arising from an aging Angular project

I'm currently facing an issue with installing node and typescript for an older angular project that I have inherited. This project is using angular 2.4.10 After downloading and installing node version 6.9.5 from the executable file, I proceeded to in ...

Modify data in a table using Dialog Component in Angular Material

I need to implement a Material Dialog feature that allows users to update entries in a table by clicking on the "Change Status" button. Check out this functional snippet: https://stackblitz.com/edit/angular-alu8pa I have successfully retrieved data fr ...

Encountering a clash in Npm dependencies

I have been involved in a Vue project where I utilized Vue Cli and integrated the Typescript plugin. However, I encountered multiple vulnerabilities that need to be addressed. When I executed npm audit fix, it failed to resolve the dependency conflict: npm ...

Mastering the integration of NestJS with Redis for microservices

Currently, I am diving into the world of nestjs microservices. I am curious, what commands are available for me to use? const pattern = { cmd: 'get' }; this.client.send<any>(pattern, data) Additionally, how do I go about retrieving data ...

Utilizing Sequelize with Typescript for referential integrity constraints

After defining these two Sequelize models: export class Users extends Model<Users> { @HasMany(() => UserRoles) @Column({ primaryKey: true, allowNull: false, unique: true }) UserId: string; @Column({ allowNull: false, unique: tru ...

Monitor changes in a dynamic child component using Angular fire and TypeScript only (no HTML)

Currently, I am developing a component using TypeScript and passing inputs to my child component from there. In the parent TypeScript file: this.childComponent = this.viewContainerRef.createComponent(this.data.body).instance; this.childComponent['chi ...

Exploring the relationship between Typescript, RxJS, Ajax, undefined values

This particular question stands out due to the fact that despite similar issues being previously addressed, none of the existing solutions have proven effective. The problem at hand is as follows: There's a Typescript class that initiates an RxJS.aja ...

Encountering an issue with core.js:15723 showing ERROR TypeError: Unable to access property 'toLowerCase' of an undefined value while using Angular 7

Below, I have provided my code which utilizes the lazyLoading Module. Please review my code and identify any errors. Currently facing TypeError: Cannot read property 'toLowerCase' of undefined in Angular 7. Model Class: export class C_data { ...

What are the steps for integrating Angularfire2 into an Angular application?

Trying to integrate Angularfire2 into a fresh Angular project, but encountered an issue while following the official documentation. This is the guide I followed Upon reaching step 7 - Inject AngularFirestore, console errors were displayed: If anyone has ...

To implement a filter in MongoDB, make sure to specify a function argument before

Utilizing TypeScript, Node.js, Mongoose, and MongoDB in my project. I have a function that resembles the following: async function getAllBooks(title?: string, authorName?: string, sortBy?) { const books = await bookModel.find().sort(); return book ...

Typedoc does not create documentation for modules that are imported

Whenever I generate documentation with TypeDoc, I am encountering an issue where imported files come up empty. If I add a class to the file specified in entryPoints, I get documentation for that specific class. However, the imported files show no document ...

Limit the selected values to calculate a partial sum

Imagine two distinct classes called professor and student: professor.ts export class Professor { id: number name: string } student.ts import { Professor } from "./professor" export class Student { ...