DEV Community

Cover image for React Native 0.77: What's New and How to Use It
Amit Kumar
Amit Kumar

Posted on

React Native 0.77: What's New and How to Use It

React Native 0.77 has officially arrived, and it’s packed with features to enhance the developer experience. This release brings powerful styling enhancements, improved Android support, and updated project templates. In this post, we’ll explore the major updates and include examples to help you get started with the new features.


Enhanced Styling Features

React Native 0.77 introduces several CSS properties (exclusive to the New Architecture), providing developers with more control over app design. Here’s what’s new:

1. display: contents

This allows an element to be removed from the layout hierarchy while retaining its children.

Example:

<View style={{ display: 'contents' }}>
  <Text>Child 1</Text>
  <Text>Child 2</Text>
</View>
Enter fullscreen mode Exit fullscreen mode

2. boxSizing

Supports both content-box (default) and border-box, offering precise control over element dimensions.

Example:

<View style={{ width: 100, height: 100, boxSizing: 'border-box', borderWidth: 10 }}>
  <Text>Box Content</Text>
</View>

Enter fullscreen mode Exit fullscreen mode

In border-box, the border is included in the defined dimensions, ensuring consistent sizing.

3. mixBlendMode

Enables dynamic color blending between elements and the background.

Example:

<View style={{ backgroundColor: 'blue', mixBlendMode: 'multiply' }}>
  <Text style={{ color: 'red' }}>Blended Text</Text>
</View>
Enter fullscreen mode Exit fullscreen mode

4. Outline Properties

The new properties include outlineWidth, outlineStyle, outlineSpread, and outlineColor. These allow for non-intrusive highlighting of elements.

Example:

<View style={{ outlineWidth: 2, outlineColor: 'orange', outlineStyle: 'solid' }}>
  <Text>Outlined Element</Text>
</View>
Enter fullscreen mode Exit fullscreen mode

Android-Specific Enhancements

1. Android 15 and 16KB Page Size Support

React Native 0.77 ensures compatibility with Android 15 and prepares for devices using 16KB memory pages, ensuring smooth performance across platforms.

2. Kotlin 2.0.21

Projects now build with Kotlin 2.0.21, enabling the latest language features and tools.


Community CLI and Template Updates

1. Deprecation of react-native init

To create new projects, use the recommended commands:

For Expo:

npx create-expo-app MyApp
Enter fullscreen mode Exit fullscreen mode

For Community CLI:

npx @react-native-community/cli init MyApp
Enter fullscreen mode Exit fullscreen mode
  1. Swift by Default for iOS

New iOS projects now use Swift, simplifying code and improving performance.


Breaking Changes

1. Removal of console.log() Streaming in Metro

Use React Native DevTools or third-party solutions like Expo Tools for debugging logs.

  1. Sticky Headers and Absolute Positioning Improvements ScrollView sticky headers and absolute positioning have been enhanced for consistency.

Example: Exploring All the New Styling Features Together

Here’s an example combining the new styling features introduced in React Native 0.77:

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const App = () => {
  return (
    <View style={styles.container}>
      <View style={styles.box}>
        <Text style={styles.blendedText}>Blended Element</Text>
      </View>
      <View style={styles.outlinedElement}>
        <Text>Outlined Element</Text>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  box: {
    width: 150,
    height: 150,
    backgroundColor: 'blue',
    mixBlendMode: 'multiply',
  },
  blendedText: {
    color: 'red',
    fontSize: 18,
  },
  outlinedElement: {
    marginTop: 20,
    outlineWidth: 2,
    outlineColor: 'orange',
    outlineStyle: 'solid',
  },
});

export default App;
Enter fullscreen mode Exit fullscreen mode

This app showcases the mixBlendMode and outline properties while aligning with React Native 0.77’s features.


Looking Ahead: React 19 Integration

React Native 0.78 will ship with React 19. To explore it now, use the following command:

npx @react-native-community/cli init YourReact19App --version 0.78.0-rc.0
Enter fullscreen mode Exit fullscreen mode

React Native 0.77 is a significant step forward in modernizing app development. Its new styling capabilities and Android optimizations make it easier to create dynamic and visually appealing apps. If you haven’t upgraded yet, now is the time to explore these features!

Top comments (0)