Skip to content

Black background appearing when using React Native 0.76 and expo SDK 52 [Android] #233

Description

@alterx

I've added a View with a red background to make it more apparent. This wasn't happening with RN 0.74.5 and Expo SDK 51.

I have a minimal reproduction example I can send (since Expo Snack is still using SDK 51) but this can be easily reproduced by creating a new expo app using yarn create expo-app --template blank, installing the latest version of @react-native-masked-view/masked-view (0.3.2) and using the example in this repo's README file or paste. Then, you can run Expo Go or a dev client, this bug happens on Android (14 in my device)

import { StyleSheet, Text, View } from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';

export default function App() {
  return (
    <View style={styles.container}>
      <View
        style={{
          height: 130,
          width: '100%',
          backgroundColor: 'red',
          padding: 20,
        }}
      >
        <MaskedView
          style={{
            flexDirection: 'row',
            flex: 1,
          }}
          maskElement={
            <View
              style={{
                backgroundColor: 'transparent',
              }}
            >
              <Text
                style={{
                  fontSize: 60,
                  color: 'black',
                  fontWeight: 'bold',
                }}
              >
                Basic Mask
              </Text>
            </View>
          }
        >
          {/* Shows behind the mask, you can put anything here, such as an image */}
          <View
            style={{ flex: 1, height: '100%', backgroundColor: '#324376' }}
          />
          <View
            style={{ flex: 1, height: '100%', backgroundColor: '#F5DD90' }}
          />
          <View
            style={{ flex: 1, height: '100%', backgroundColor: '#F76C5E' }}
          />
          <View
            style={{ flex: 1, height: '100%', backgroundColor: '#e1e1e1' }}
          />
        </MaskedView>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

in the App.js file.

For reference, these are the package versions I'm using:

    "@react-native-masked-view/masked-view": "^0.3.2",
    "expo": "~52.0.3",
    "react": "18.3.1",
    "react-native": "0.76.1"

WhatsApp Image 2024-11-12 at 18 39 06

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions