Skip to content

Commit

Permalink
⭐️ Impl: RNIBlurView Scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Aug 16, 2024
1 parent 2bd0b13 commit b4e59f8
Show file tree
Hide file tree
Showing 11 changed files with 579 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ios/RNIBlurView/RNIBlurView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// RNIBlurView.h
// react-native-ios-visual-effect-view
//
// Created by Dominic Go on 6/6/24.
//

#import <react-native-ios-utilities/RNIBaseView.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/RCTViewComponentView.h>
#else
#import <React/RCTView.h>
#endif

@protocol RNIContentViewParentDelegate;
@protocol RNIContentViewDelegate;

@class RCTBridge;

#if RCT_NEW_ARCH_ENABLED
namespace react = facebook::react;
#endif

@interface RNIBlurView : RNIBaseView

@end
104 changes: 104 additions & 0 deletions ios/RNIBlurView/RNIBlurView.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// RNIBlurView.mm
// react-native-ios-visual-effect-view
//
// Created by Dominic Go on 6/6/24.
//

#import "RNIBlurView.h"

#import "react-native-ios-visual-effect-view/Swift.h"
#import <react-native-ios-utilities/RNIBaseView.h>

#import <react-native-ios-utilities/RNIContentViewParentDelegate.h>


#import <react-native-ios-utilities/UIApplication+RNIHelpers.h>
#import <react-native-ios-utilities/RNIObjcUtils.h>

#if RCT_NEW_ARCH_ENABLED
#include "RNIBlurViewComponentDescriptor.h"

#include <react-native-ios-utilities/RNIBaseViewState.h>
#include <react-native-ios-utilities/RNIBaseViewProps.h>

#import <React/RCTConversions.h>
#import <React/RCTFabricComponentsPlugins.h>
#import <React/RCTRootComponentView.h>
#import <React/RCTSurfaceTouchHandler.h>

#include <react/renderer/core/ComponentDescriptor.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/graphics/Float.h>
#include <react/renderer/core/graphicsConversions.h>

#import <react/renderer/components/RNIVisualEffectViewSpec/EventEmitters.h>
#import <react/renderer/components/RNIVisualEffectViewSpec/RCTComponentViewHelpers.h>
#else
#import <React/RCTTouchHandler.h>
#import <React/RCTInvalidating.h>
#endif

#ifdef RCT_NEW_ARCH_ENABLED
using namespace facebook::react;
#endif


@interface RNIBlurView () <
RNIContentViewParentDelegate,
#ifdef RCT_NEW_ARCH_ENABLED
RCTRNIBlurViewViewProtocol
#else
RCTInvalidating
#endif
> {
// TBA
}
@end

@implementation RNIBlurView {
}

// MARK: - Init
// ------------

- (void)initCommon {
[super initCommon];
}

// MARK: - RNIBaseView
// -------------------

+ (Class)viewDelegateClass
{
return [RNIBlurViewDelegate class];
}

// MARK: - Fabric
// --------------

#if RCT_NEW_ARCH_ENABLED
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<RNIBlurViewComponentDescriptor>();
}

Class<RCTComponentViewProtocol> RNIBlurViewCls(void)
{
return RNIBlurView.class;
}
#else

// MARK: - Paper
// -------------

- (void)invalidate
{
// to be impl.
}

#endif
@end



28 changes: 28 additions & 0 deletions ios/RNIBlurView/RNIBlurViewComponentDescriptor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// RNIBlurViewComponentDescriptor.h
// react-native-ios-visual-effect-view
//
// Created by Dominic Go on 6/6/24.
//

#if __cplusplus
#pragma once

#include "RNIBlurViewShadowNode.h"
#include "RNIBaseViewComponentDescriptor.h"

#include <react-native-ios-utilities/RNIBaseViewState.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>


namespace facebook::react {

class RNIBlurViewComponentDescriptor final
: public RNIBaseViewComponentDescriptor<RNIBlurViewShadowNode> {

public:
using RNIBaseViewComponentDescriptor::RNIBaseViewComponentDescriptor;
};

} // namespace facebook::react
#endif
Loading

0 comments on commit b4e59f8

Please sign in to comment.