Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuItem heigth not equal in debug and release #67

Open
dancixx opened this issue Apr 29, 2022 · 1 comment
Open

MenuItem heigth not equal in debug and release #67

dancixx opened this issue Apr 29, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dancixx
Copy link

dancixx commented Apr 29, 2022

Describe the bug
The menu item heights are different in rc and debug. The weird situation is that it works on iPhone 13 pro but not on 12 Pro.

UPDATE:
I investigate the source of the problem. It is cause by the FONT_SCALE multiplier in the constants.ts. If I set to 1 is works good, but I set back to const FONT_SCALE = Dimensions.get('screen').fontScale; it measure the scale size and because of that, the menuItem will be smaller.

To Reproduce

<HoldItem
            activateOn="tap"
            closeOnTap
            items={[
              {
                text: translations.WORKOUT_REMOVE_EXERCISE,
                onPress: (
                  entityId: string,
                  superSet: number,
                  setEntityIds: string[],
                ) => {
                  deleteExercise(entityId, superSet);
                  deleteSets(setEntityIds!);
                  updateExercisesOnDelete();
                },
              },
              // {
              //   text:
              //     /\d/.test(alphabet) && alphabet.includes('1')
              //       ? translations.WORKOUT_SUPER_SET_UP
              //       : translations.WORKOUT_SUPER_SET_DOWN,
              // },
              // {
              //   text:
              //     (alphabet.includes('1') &&
              //       !!alphabets[exerciseIndex + 2] &&
              //       !alphabets[exerciseIndex + 2].includes('3')) ||
              //     (alphabet.includes('2') &&
              //       !!alphabets[exerciseIndex + 1] &&
              //       !alphabets[exerciseIndex + 1].includes('3'))
              //       ? translations.WORKOUT_SUPER_SET_BREAK
              //       : !/\d/.test(alphabet)
              //       ? translations.WORKOUT_SUPER_SET_UP
              //       : translations.WORKOUT_SUPER_SET_REMOVE,
              // },
            ]}
            actionParams={{
              [translations.WORKOUT_REMOVE_EXERCISE]: [
                exercise.entityId!,
                exercise.superSet,
                exercise.setEntityIds,
              ],
            }}>
            <Pressable
              onPress={() => {
                Keyboard.dismiss();
              }}>
              <FontAwesomeIcon icon={faEllipsisH} size={30} color="#000000" />
            </Pressable>
</HoldItem>

Screenshots
Debug
Simulator Screen Shot - iPhone 13 Pro - 2022-04-29 at 07 03 36

Release
IMG_1559 (2)
IMG_1558 (1)

Package versions

  • React: 17.0.2
  • React Native: 0.67.4
  • React Native Reanimated: 2.8.0
  • React Native Hold Menu: latest
  • Expo: 42.0.4
@dancixx dancixx added the bug Something isn't working label Apr 29, 2022
@enesozturk
Copy link
Owner

The reason I get the font scale from the device is for accessibility. I need to calculate text heights to calculate the menu's height dynamically because some people use scaled-up fonts.

I didn't know it'll different per device or release mode. I need to investigate the issue, maybe Dimension's fontScale is acting differently. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants