diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h new file mode 100644 index 000000000..4731cea4d --- /dev/null +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h @@ -0,0 +1,7 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#import + +@interface RCTInputAccessoryShadowView : RCTShadowView + +@end diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m new file mode 100644 index 000000000..b2664aaec --- /dev/null +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m @@ -0,0 +1,15 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#import "RCTInputAccessoryShadowView.h" + +#import + +@implementation RCTInputAccessoryShadowView + +- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex +{ + [super insertReactSubview:subview atIndex:atIndex]; + subview.width = (YGValue) { RCTScreenSize().width, YGUnitPoint }; +} + +@end diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m index aeeff835e..490aa841a 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m @@ -7,6 +7,7 @@ #import "RCTInputAccessoryViewManager.h" +#import "RCTInputAccessoryShadowView.h" #import "RCTInputAccessoryView.h" @implementation RCTInputAccessoryViewManager @@ -23,6 +24,11 @@ RCT_EXPORT_MODULE() return [[RCTInputAccessoryView alloc] initWithBridge:self.bridge]; } +- (RCTShadowView *)shadowView +{ + return [RCTInputAccessoryShadowView new]; +} + RCT_REMAP_VIEW_PROPERTY(backgroundColor, inputAccessoryView.backgroundColor, UIColor) @end diff --git a/RNTester/js/InputAccessoryViewExample.js b/RNTester/js/InputAccessoryViewExample.js index 13b588578..7ebcf5f00 100644 --- a/RNTester/js/InputAccessoryViewExample.js +++ b/RNTester/js/InputAccessoryViewExample.js @@ -13,7 +13,6 @@ const Alert = require('Alert'); const Button = require('Button'); -const Dimensions = require('Dimensions'); const InputAccessoryView = require('InputAccessoryView'); const React = require('React'); const ScrollView = require('ScrollView'); @@ -36,9 +35,8 @@ class TextInputBar extends React.PureComponent<*, *> { state = {text: ''}; render() { - const {width} = Dimensions.get('window'); return ( - + {