Skip to content

react-native-sketch-canvas does not support new architecture even with RN v0.72 interop layer #236

Open
@karthiktrcapgemini

Description

Summary

Hi @terrylinla,
We have identified that this library is not working with the RN new architecture. So we have moved forward with RN 0.72.1 to enable this legacy module with the interop layer and new arch as suggested here -> reactwg/react-native-new-architecture#135

Reproducible sample code -

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

import { SketchCanvas } from '@terrylinla/react-native-sketch-canvas';

export default class example extends Component {
  render() {
    return (
      <View style={styles.container}>
        <View style={{ flex: 1, flexDirection: 'row' }}>
          <SketchCanvas
            style={{ flex: 1 }}
            strokeColor={'red'}
            strokeWidth={7}
          />
        </View>
      </View>
    );
  }
}

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

AppRegistry.registerComponent('example', () => example);

Steps to reproduce

  • yarn add react-native-sketch-canvas
  • cd ios
  • bundle install
  • RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
  • cd ..
  • open android/gradle.properties
  • change the newArchEnabled boolean from false to true
  • Add the component to unstable_reactLegacyComponentNames array in react-native.config.js
  • npx react-native run-ios
  • npx react-native run-android
  • Update the App.js file with the snippet in the Reproducible Sample Code section

Expected result -

  • Module opens and we are able to save the edited sketch

Actual Result -

-Module opens and we are able to add a sketch but then it throws this exception -

Simulator Screenshot - iPhone 14 - 2023-07-03 at 10 56 09

React Native Sketch Canvas Version

0.8.0

What platforms are you seeing the problem on?

Android, iOS

React Native Version

0.72.1

What version of Expo are you using?

Not using Expo

Device(s)

iPhone 14 (iOS 16.4) | Android Pixel 5 (API 33)

Additional information

No response

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions