react-native-hold-menu icon indicating copy to clipboard operation
react-native-hold-menu copied to clipboard

MenuItem heigth not equal in debug and release

Open dancixx opened this issue 3 years ago • 1 comments

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 avatar Apr 29 '22 05:04 dancixx

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.

enesozturk avatar Jul 23 '22 17:07 enesozturk