tamagui / tamagui

Style React fast with 100% parity on React Native, an optional UI kit, and optimizing compiler.
https://tamagui.dev
MIT License
11.45k stars 488 forks source link

Using elevation with animation prop on Card causes the production app to render empty screen #2511

Closed TheUnderScorer closed 6 months ago

TheUnderScorer commented 7 months ago

Current Behavior

Hi!

Whenever I render <Card /> compontent with both animation and elevation prop like this:

<Card
          elevation="$4"
          height={100}
          width={100}
          backgroundColor="green"
          animation="medium"
          onPress={() => {
            console.log('press');
          }}
          pressTheme
          pressStyle={{
            scale: 0.9,
          }}
          enterStyle={{
            opacity: 0.5,
            y: 20,
          }}
        >
          <Text>Contents</Text>
        </Card>

on production build, it causes the app to render an empty screen instead. It works as expected on debug build.

Expected Behavior

The app should render correctly on the production build.

Tamagui Version

1.94.3

Platform (Web, iOS, Android)

iOS

Reproduction

1. Clone following repo: https://github.com/TheUnderScorer/TamaguiIssue
2. Run `pnpm install` and `expo prebuild ios`
3. Run `expo run:ios --configuration Release`
4. Notice that app render empty, white screen.
5. Update `App.js` by removing `elevation` prop from `<Card />` component
6. Build app again via `expo run:ios --configuration Release`
7. Notice that app renders correctly

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 462.63 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm
    pnpm: 8.15.4 - ~/.nvm/versions/node/v21.6.2/bin/pnpm
  Browsers:
    Chrome: 123.0.6312.107
    Safari: 17.4.1
  npmPackages:
    @babel/core: ^7.20.0 => 7.24.4 
    @tamagui/animations-moti: ^1.94.3 => 1.94.3 
    @tamagui/config: ^1.94.3 => 1.94.3 
    @tamagui/themes: ^1.94.3 => 1.94.3 
    expo: ~50.0.14 => 50.0.14 
    expo-status-bar: ~1.11.1 => 1.11.1 
    prettier: ^3.2.5 => 3.2.5 
    react: 18.2.0 => 18.2.0 
    react-native: 0.73.6 => 0.73.6 
    react-native-reanimated: ~3.8.1 => 3.8.1 
    tamagui: ^1.94.3 => 1.94.3
byteab commented 7 months ago

try animateOnly={['transform', 'opacity']}

TheUnderScorer commented 7 months ago

Thanks @TheEhsanSarshar, that works, but I feel like it's just a workaround for underlying issue 😁

byteab commented 7 months ago

yeah I'll check that, having animateOnly is a good practice for performance as well

byteab commented 6 months ago

ok this PR will fix this issue