Skip to content

iOS crash when using surface: BottomSheetSurfaceComponentView does not initialize _props #77

Description

@carl-sauter

iOS crash when using surface

Using the surface prop causes an immediate crash on iOS.

Environment

  • React Native: 0.87
  • @swmansion/react-native-bottom-sheet: 0.16.2
  • iOS / New Architecture

Error

`RCTViewComponentView` subclasses (and `BottomSheetSurfaceComponentView` particularly) must setup `_props` instance variable with a default value in the constructor.

Reproduction

<BottomSheet
  detents={[0, 300, 600]}
  index={index}
  surface={<View style={StyleSheet.absoluteFill} />}
>
  <View />
</BottomSheet>

Removing the surface prop prevents the crash.

It looks like BottomSheetSurfaceComponentView does not initialize _props in its constructor, while BottomSheetComponentView does.

Possibly something like this is missing:

- (instancetype)initWithFrame:(CGRect)frame
{
  if (self = [super initWithFrame:frame]) {
    static const auto defaultProps =
        std::make_shared<const BottomSheetSurfaceViewProps>();
    _props = defaultProps;
  }

  return self;
}

Android does not seem to be affected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions